Fix subscription order for live or streamed videos

This commit is contained in:
Preston 2020-09-02 21:00:24 -04:00
parent 21352c6c71
commit f895703446
3 changed files with 14 additions and 79 deletions

78
package-lock.json generated
View File

@ -11136,14 +11136,6 @@
} }
} }
}, },
"javascript-time-ago": {
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/javascript-time-ago/-/javascript-time-ago-2.0.13.tgz",
"integrity": "sha512-zH+obXUQ4vlc9UlERFe637rNJQaVYLizwODUfGzYN/cNW/owkk5wzb327gAfEXFpI4yhFcStEaoqoJtMGAmrAg==",
"requires": {
"relative-time-format": "^0.1.3"
}
},
"jest": { "jest": {
"version": "26.4.2", "version": "26.4.2",
"resolved": "https://registry.npmjs.org/jest/-/jest-26.4.2.tgz", "resolved": "https://registry.npmjs.org/jest/-/jest-26.4.2.tgz",
@ -16248,11 +16240,6 @@
"integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=",
"dev": true "dev": true
}, },
"relative-time-format": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/relative-time-format/-/relative-time-format-0.1.3.tgz",
"integrity": "sha512-0O6i4fKjsx8qhz57zorG+LrIDnF9pSvP5s7H9R1Nb5nSqih5dvRyKzNKs6MxhL3bv4iwsz4DuDwAyw+c47QFIA=="
},
"remove-trailing-separator": { "remove-trailing-separator": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
@ -16551,15 +16538,6 @@
} }
} }
}, },
"rss-to-json": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/rss-to-json/-/rss-to-json-1.1.1.tgz",
"integrity": "sha512-d+TwrFI5wAHbZ/fTd3Pvty14tadBjKHAjfMcUam9FWoWrC9g5rHJN9Slw10OZwk6Mey+hqdXwdmymO7d8ebVmw==",
"requires": {
"axios": "^0.19.2",
"xml2json": "^0.12.0"
}
},
"rsvp": { "rsvp": {
"version": "4.8.5", "version": "4.8.5",
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
@ -18991,62 +18969,6 @@
"resolved": "https://registry.npmjs.org/videojs-swf/-/videojs-swf-5.4.1.tgz", "resolved": "https://registry.npmjs.org/videojs-swf/-/videojs-swf-5.4.1.tgz",
"integrity": "sha1-IHfvccdJ8seCPvSbq65N0qywj4c=" "integrity": "sha1-IHfvccdJ8seCPvSbq65N0qywj4c="
}, },
"videojs-vtt-thumbnails-fork": {
"version": "github:gilgusmaximus/videojs-vtt-thumbnails#9186e32823390328a62cf7d2fd5206d7349ea31e",
"from": "github:gilgusmaximus/videojs-vtt-thumbnails#build",
"requires": {
"global": "^4.4.0",
"request": "^2.88.2",
"video.js": "^7.2.0 || ^6.6.0"
},
"dependencies": {
"global": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz",
"integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==",
"requires": {
"min-document": "^2.19.0",
"process": "^0.11.10"
}
},
"request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
"requires": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.3",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
}
},
"tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
"requires": {
"psl": "^1.1.28",
"punycode": "^2.1.1"
}
}
}
},
"videojs-vtt-thumbnails-freetube": { "videojs-vtt-thumbnails-freetube": {
"version": "0.0.15", "version": "0.0.15",
"resolved": "https://registry.npmjs.org/videojs-vtt-thumbnails-freetube/-/videojs-vtt-thumbnails-freetube-0.0.15.tgz", "resolved": "https://registry.npmjs.org/videojs-vtt-thumbnails-freetube/-/videojs-vtt-thumbnails-freetube-0.0.15.tgz",

View File

@ -122,7 +122,16 @@ const actions = {
calculatePublishedDate(_, publishedText) { calculatePublishedDate(_, publishedText) {
const date = new Date() const date = new Date()
if (publishedText === 'Live') {
return publishedText
}
const textSplit = publishedText.split(' ') const textSplit = publishedText.split(' ')
if (textSplit[0].toLowerCase() === 'streamed') {
textSplit.shift()
}
const timeFrame = textSplit[1] const timeFrame = textSplit[1]
const timeAmount = parseInt(textSplit[0]) const timeAmount = parseInt(textSplit[0])
let timeSpan = null let timeSpan = null

View File

@ -207,7 +207,11 @@ export default Vue.extend({
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
ytch.getChannelVideos(channelId, 'latest').then(async (response) => { ytch.getChannelVideos(channelId, 'latest').then(async (response) => {
const videos = await Promise.all(response.items.map(async (video) => { const videos = await Promise.all(response.items.map(async (video) => {
if (video.liveNow) {
video.publishedDate = new Date().getTime()
} else {
video.publishedDate = await this.calculatePublishedDate(video.publishedText) video.publishedDate = await this.calculatePublishedDate(video.publishedText)
}
return video return video
})) }))