Update Premiere Logic

This commit is contained in:
Preston 2020-10-08 21:53:34 -04:00
parent 9cbbfb78ef
commit 4240bf9e35
7 changed files with 18 additions and 12 deletions

8
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "freetube", "name": "freetube",
"version": "0.8.0", "version": "0.9.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -20568,9 +20568,9 @@
} }
}, },
"yt-channel-info": { "yt-channel-info": {
"version": "1.1.3", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/yt-channel-info/-/yt-channel-info-1.1.3.tgz", "resolved": "https://registry.npmjs.org/yt-channel-info/-/yt-channel-info-1.1.4.tgz",
"integrity": "sha512-qQ286btTvqBPL2VFHJa0WpKiHp62Jil5cwskGj8fSVeKjynr4QHDL24OmcZxQlqfP2WiB4Cz9DeK3JkN1KsVTw==", "integrity": "sha512-FQfttLEWMlVH4qXEkSxPQBkcg6RUquXeckoJtpJP8uMhv2HSRMQ6qND1kf/kQf6eThd8UaYTvXrsgWnIAOG44w==",
"requires": { "requires": {
"axios": "^0.19.2", "axios": "^0.19.2",
"querystring": "^0.2.0" "querystring": "^0.2.0"

View File

@ -41,7 +41,7 @@
"xml2json": "^0.12.0", "xml2json": "^0.12.0",
"youtube-chat": "^1.1.0", "youtube-chat": "^1.1.0",
"youtube-suggest": "^1.1.0", "youtube-suggest": "^1.1.0",
"yt-channel-info": "^1.1.3", "yt-channel-info": "^1.1.4",
"yt-comment-scraper": "^1.3.4", "yt-comment-scraper": "^1.3.4",
"yt-dash-manifest-generator": "^1.1.0", "yt-dash-manifest-generator": "^1.1.0",
"yt-trending-scraper": "^1.0.3", "yt-trending-scraper": "^1.0.3",

View File

@ -110,12 +110,10 @@ export default Vue.extend({
textDecode.pop() textDecode.pop()
textDecode = textDecode.map(data => JSON.parse(data)) textDecode = textDecode.map(data => JSON.parse(data))
let importingOldFormat = false
const firstEntry = textDecode[0] const firstEntry = textDecode[0]
if (firstEntry.channelId && firstEntry.channelName && firstEntry.channelThumbnail && firstEntry._id && firstEntry.profile) { if (firstEntry.channelId && firstEntry.channelName && firstEntry.channelThumbnail && firstEntry._id && firstEntry.profile) {
// Old FreeTube subscriptions format detected, so convert it to the new one: // Old FreeTube subscriptions format detected, so convert it to the new one:
textDecode = await this.convertOldFreeTubeFormatToNew(textDecode) textDecode = await this.convertOldFreeTubeFormatToNew(textDecode)
importingOldFormat = true
} }
const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0])) const primaryProfile = JSON.parse(JSON.stringify(this.profileList[0]))

View File

@ -41,6 +41,7 @@ export default Vue.extend({
publishedText: '', publishedText: '',
isLive: false, isLive: false,
isFavorited: false, isFavorited: false,
isUpcoming: false,
hideViews: false, hideViews: false,
optionsValues: [ optionsValues: [
'history', 'history',
@ -254,18 +255,25 @@ export default Vue.extend({
this.duration = this.calculateVideoDuration(this.data.lengthSeconds) this.duration = this.calculateVideoDuration(this.data.lengthSeconds)
this.description = this.data.description this.description = this.data.description
this.isLive = this.data.liveNow this.isLive = this.data.liveNow
this.isUpcoming = this.data.isUpcoming || this.data.premiere
this.viewCount = this.data.viewCount this.viewCount = this.data.viewCount
if (typeof (this.data.premiereTimestamp) !== 'undefined') {
this.publishedText = new Date(this.data.premiereTimestamp * 1000).toLocaleString()
} else {
this.publishedText = this.data.publishedText
}
if (typeof (this.data.publishedText) !== 'undefined' && this.data.publishedText !== null && !this.isLive) { if (typeof (this.data.publishedText) !== 'undefined' && this.data.publishedText !== null && !this.isLive) {
// produces a string according to the template in the locales string // produces a string according to the template in the locales string
this.toLocalePublicationString({ this.toLocalePublicationString({
publishText: this.data.publishedText, publishText: this.publishedText,
templateString: this.$t('Video.Publicationtemplate'), templateString: this.$t('Video.Publicationtemplate'),
timeStrings: this.$t('Video.Published'), timeStrings: this.$t('Video.Published'),
liveStreamString: this.$t('Video.Watching'), liveStreamString: this.$t('Video.Watching'),
upcomingString: this.$t('Video.Published.Upcoming'), upcomingString: this.$t('Video.Published.Upcoming'),
isLive: this.isLive, isLive: this.isLive,
isUpcoming: this.data.isUpcoming, isUpcoming: this.isUpcoming,
isRSS: this.data.isRSS isRSS: this.data.isRSS
}).then((data) => { }).then((data) => {
this.uploadedTime = data this.uploadedTime = data

View File

@ -78,7 +78,7 @@
> >
<span>{{ channelName }}</span> <span>{{ channelName }}</span>
</router-link> </router-link>
<template v-if="!isLive && !hideViews"> <template v-if="!isLive && !isUpcoming && !hideViews">
<span class="viewCount"> {{ parsedViewCount }}</span> <span class="viewCount"> {{ parsedViewCount }}</span>
<span v-if="viewCount === 1">{{ $t("Video.View").toLowerCase() }}</span> <span v-if="viewCount === 1">{{ $t("Video.View").toLowerCase() }}</span>
<span v-else>{{ $t("Video.Views").toLowerCase() }}</span> <span v-else>{{ $t("Video.Views").toLowerCase() }}</span>

View File

@ -278,7 +278,7 @@ const actions = {
return '0' + payload.liveStreamString return '0' + payload.liveStreamString
} else if (payload.isUpcoming || payload.publishText === null) { } else if (payload.isUpcoming || payload.publishText === null) {
// the check for null is currently just an inferring of knowledge, because there is no other possibility left // the check for null is currently just an inferring of knowledge, because there is no other possibility left
return payload.upcomingString return `${payload.upcomingString}: ${payload.publishText}`
} else if (payload.isRSS) { } else if (payload.isRSS) {
return payload.publishText return payload.publishText
} }

View File

@ -445,7 +445,7 @@ Video:
Year: Year Year: Year
Years: Years Years: Years
Ago: Ago Ago: Ago
Upcoming: Premieres soon Upcoming: Premieres on
Published on: Published on Published on: Published on
# $ is replaced with the number and % with the unit (days, hours, minutes...) # $ is replaced with the number and % with the unit (days, hours, minutes...)
Publicationtemplate: $ % ago Publicationtemplate: $ % ago