Compare commits

..

2 commits

Author SHA1 Message Date
j
c05d0bbb44 merge conditional subtitle fixup from pandora 2024-02-17 10:54:05 +00:00
j
57a7ad2cc3 merge pandora.resolution 2024-02-17 10:51:40 +00:00
3 changed files with 13 additions and 10 deletions

View file

@ -155,7 +155,7 @@ async function loadEdit(id, args) {
} else { } else {
var video = {} var video = {}
var oshash = clip.streams[idx] 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) { if (clip['in'] && clip.out) {
video.src += `#t=${clip['in']},${clip.out}` video.src += `#t=${clip['in']},${clip.out}`
@ -255,9 +255,9 @@ async function loadEdit(id, args) {
poster = getClip(data.edit, parseDuration(args.parts[2])) poster = getClip(data.edit, parseDuration(args.parts[2]))
} }
if (poster && poster.item) { if (poster && poster.item) {
data.poster = `${pandora.proto}://${data.site}/${poster.item}/480p${poster.position}.jpg` data.poster = `${pandora.proto}://${data.site}/${poster.item}/${pandora.resolution}${poster.position.toFixed(3)}.jpg`
} else { } else {
data.poster = data.videos[0].src.split('/48')[0] + `/480p${data.videos[0].in}.jpg` data.poster = data.videos[0].src.split('/48')[0] + `/${pandora.resolution}p${data.videos[0].in.toFixed(3)}.jpg`
} }
data.aspectratio = data.edit.clips[0].videoRatio data.aspectratio = data.edit.clips[0].videoRatio
data.duration = data.edit.duration data.duration = data.edit.duration

View file

@ -106,7 +106,7 @@ async function loadData(id, args) {
data.videos = [] data.videos = []
data.item.durations.forEach((duration, idx) => { data.item.durations.forEach((duration, idx) => {
var oshash = data.item.streams[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({ data.videos.push({
src: url, src: url,
duration: duration duration: duration
@ -130,11 +130,13 @@ async function loadData(id, args) {
${layerData.title} ${layerData.title}
</h3>`) </h3>`)
data.layers[layer].forEach(annotation => { data.layers[layer].forEach(annotation => {
annotation.value = annotation.value.replace( if (pandora.url) {
/src="\//g, `src="${pandora.url.origin}/` annotation.value = annotation.value.replace(
).replace( /src="\//g, `src="${pandora.url.origin}/`
/href="\//g, `href="${pandora.url.origin}/` ).replace(
) /href="\//g, `href="${pandora.url.origin}/`
)
}
html.push(` html.push(`
<div class="annotation ${layerData.type}" data-in="${annotation.in}" data-out="${annotation.out}"> <div class="annotation ${layerData.type}" data-in="${annotation.in}" data-out="${annotation.out}">
${annotation.value} ${annotation.value}
@ -161,7 +163,7 @@ async function loadData(id, args) {
data.byline += ' (' + data.item.date.split('-')[0] + ')' data.byline += ' (' + data.item.date.split('-')[0] + ')'
} }
data.link = `${pandora.proto}://${data.site}/${data.item.id}/${data["in"]},${data.out}` 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 data.aspectratio = data.item.videoRatio
if (data['in'] == data['out']) { if (data['in'] == data['out']) {
data['out'] += 0.04 data['out'] += 0.04

View file

@ -100,6 +100,7 @@ pandoraAPI("init").then(response => {
...response.data ...response.data
} }
pandora.proto = pandora.site.site.https ? 'https' : 'http' pandora.proto = pandora.site.site.https ? 'https' : 'http'
pandora.resolution = Math.max.apply(null, pandora.site.video.resolutions)
if (pandora.site.site.videoprefix.startsWith('//')) { if (pandora.site.site.videoprefix.startsWith('//')) {
pandora.site.site.videoprefix = pandora.proto + ':' + pandora.site.site.videoprefix pandora.site.site.videoprefix = pandora.proto + ':' + pandora.site.site.videoprefix
} }