From f671971b35cf81834b119aa8dc4347518f4d1476 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 15 Nov 2023 15:37:27 +0100 Subject: [PATCH] support sites that don't have 480p --- static/mobile/js/edits.js | 4 ++-- static/mobile/js/item.js | 4 ++-- static/mobile/js/main.js | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/static/mobile/js/edits.js b/static/mobile/js/edits.js index 25fa0027..d9f967b8 100644 --- a/static/mobile/js/edits.js +++ b/static/mobile/js/edits.js @@ -140,7 +140,7 @@ async function loadEdit(id, args) { } else { var video = {} var oshash = clip.streams[idx] - video.src = getVideoURL(clip.item, 480, idx+1, '', oshash) + video.src = getVideoURL(clip.item, pandora.resolution, idx+1, '', oshash) /* if (clip['in'] && clip.out) { video.src += `#t=${clip['in']},${clip.out}` @@ -222,7 +222,7 @@ async function loadEdit(id, args) { data.title = data.edit.name data.byline = data.edit.description data.link = `${pandora.proto}://${data.site}/edits/${data.edit.id}` - data.poster = data.videos[0].src.split('/48')[0] + `/480p${data.videos[0].in}.jpg` + data.poster = data.videos[0].src.split('/' + pandora.resolution)[0] + `/${pandora.resolution}p${data.videos[0].in}.jpg` data.aspectratio = data.edit.clips[0].videoRatio data.duration = data.edit.duration return data diff --git a/static/mobile/js/item.js b/static/mobile/js/item.js index 3a57bcba..9e1a6d73 100644 --- a/static/mobile/js/item.js +++ b/static/mobile/js/item.js @@ -99,7 +99,7 @@ async function loadData(id, args) { data.videos = [] data.item.durations.forEach((duration, idx) => { var oshash = data.item.streams[idx] - var url = getVideoURL(data.item.id, 480, idx+1, '', oshash) + var url = getVideoURL(data.item.id, pandora.resolution, idx+1, '', oshash) data.videos.push({ src: url, duration: duration @@ -138,7 +138,7 @@ async function loadData(id, args) { data.byline = data.item.director ? data.item.director.join(', ') : '' } data.link = `${pandora.proto}://${data.site}/${data.item.id}/${data["in"]},${data.out}` - data.poster = `${pandora.proto}://${data.site}/${data.item.id}/480p${data["in"]}.jpg` + data.poster = `${pandora.proto}://${data.site}/${data.item.id}/${pandora.resolution}p${data["in"]}.jpg` data.aspectratio = data.item.videoRatio if (data['in'] == data['out']) { data['out'] += 0.04 diff --git a/static/mobile/js/main.js b/static/mobile/js/main.js index 56a00b17..9d0f3c42 100644 --- a/static/mobile/js/main.js +++ b/static/mobile/js/main.js @@ -100,6 +100,7 @@ pandoraAPI("init").then(response => { ...response.data } pandora.proto = pandora.site.site.https ? 'https' : 'http' + pandora.resolution = Math.max.apply(null, pandora.site.video.resolutions) if (pandora.site.site.videoprefix.startsWith('//')) { pandora.site.site.videoprefix = pandora.proto + ':' + pandora.site.site.videoprefix }