Fix issues with playlists and fix issue with leaving watch page from an invalid id

This commit is contained in:
Preston 2020-08-25 10:18:14 -04:00
parent b5a38862f4
commit 781e971357
4 changed files with 13 additions and 11 deletions

View File

@ -202,6 +202,9 @@ export default Vue.extend({
// For Invidious data, as duration is sent in seconds // For Invidious data, as duration is sent in seconds
calculateVideoDuration: function (lengthSeconds) { calculateVideoDuration: function (lengthSeconds) {
if (typeof lengthSeconds === 'string') {
return lengthSeconds
}
let durationText = '' let durationText = ''
let time = lengthSeconds let time = lengthSeconds
let hours = 0 let hours = 0

View File

@ -25,22 +25,16 @@ Vue.use(VueI18n)
// List of locales approved for use // List of locales approved for use
const activeLocales = ['en-US', 'de-DE', 'es-MX', 'fi', 'fr-FR', 'ja', 'pt-BR', 'pt-PT', 'ru', 'vi', 'zh-CN', 'zh-TW'] const activeLocales = ['en-US', 'de-DE', 'es-MX', 'fi', 'fr-FR', 'ja', 'pt-BR', 'pt-PT', 'ru', 'vi', 'zh-CN', 'zh-TW']
const messages = {} const messages = {}
const fileLocation = isDev ? 'static/locales/' : `${__dirname}/static/locales/`
// Take active locales and load respective YAML file // Take active locales and load respective YAML file
activeLocales.forEach((locale) => { activeLocales.forEach((locale) => {
try { try {
// File location when running in dev // File location when running in dev
const doc = yaml.safeLoad(fs.readFileSync(`static/locales/${locale}.yaml`)) const doc = yaml.safeLoad(fs.readFileSync(`${fileLocation}${locale}.yaml`))
messages[locale] = doc messages[locale] = doc
} catch (e) { } catch (e) {
console.log(e) console.log(e)
try {
// File location when compiled
const doc = yaml.safeLoad(fs.readFileSync(`${__dirname}/static/locales/${locale}.yaml`))
messages[locale] = doc
} catch (e) {
console.log(e)
}
} }
}) })

View File

@ -92,7 +92,13 @@ export default Vue.extend({
infoSource: 'local' infoSource: 'local'
} }
this.playlistItems = result.items this.playlistItems = result.items.map((video) => {
video.videoId = video.id
video.lengthSeconds = video.duration
video.author = video.author.name
return video
})
this.isLoading = false this.isLoading = false
}).catch((err) => { }).catch((err) => {

View File

@ -700,9 +700,8 @@ export default Vue.extend({
if (this.rememberHistory && !this.isLoading && !this.isLive) { if (this.rememberHistory && !this.isLoading && !this.isLive) {
const player = this.$refs.videoPlayer.player const player = this.$refs.videoPlayer.player
if (typeof player !== 'undefined' && this.saveWatchedProgress) { if (player !== null && this.saveWatchedProgress) {
const currentTime = this.$refs.videoPlayer.player.currentTime() const currentTime = this.$refs.videoPlayer.player.currentTime()
console.log(currentTime)
const payload = { const payload = {
videoId: this.videoId, videoId: this.videoId,
watchProgress: currentTime watchProgress: currentTime