Compare commits

...

2 commits

Author SHA1 Message Date
j
f671971b35 support sites that don't have 480p 2023-11-15 15:37:27 +01:00
j
c0420cabcb display additional keys 2023-11-15 15:36:26 +01:00
4 changed files with 33 additions and 5 deletions

View file

@ -31,6 +31,16 @@ pandora.ui.infoView = function(data, isMixed) {
return key.id; return key.id;
}), }),
posterKeys = ['title', 'date'], posterKeys = ['title', 'date'],
displayedKeys = [ // FIXME: can tis be a flag in the config?
'title', 'notes', 'name', 'summary', 'id',
'hue', 'saturation', 'lightness', 'cutsperminute', 'volume',
'user', 'rightslevel', 'bitrate', 'timesaccessed',
'numberoffiles', 'numberofannotations', 'numberofcuts', 'words', 'wordsperminute',
'annotations', 'groups', 'filename',
'duration', 'aspectratio', 'pixels', 'size', 'resolution',
'created', 'modified', 'accessed',
'random'
],
statisticsWidth = 128, statisticsWidth = 128,
$bar = Ox.Bar({size: 16}) $bar = Ox.Bar({size: 16})
@ -236,6 +246,7 @@ pandora.ui.infoView = function(data, isMixed) {
if (!isMultiple) { if (!isMultiple) {
['source', 'project'].forEach(function(key) { ['source', 'project'].forEach(function(key) {
displayedKeys.push(key);
if (canEdit || data[key]) { if (canEdit || data[key]) {
var $div = $('<div>') var $div = $('<div>')
.addClass('OxSelectable') .addClass('OxSelectable')
@ -379,7 +390,7 @@ pandora.ui.infoView = function(data, isMixed) {
// License ----------------------------------------------------------------- // License -----------------------------------------------------------------
renderGroup(['license']); Ox.getObjectById(pandora.site.itemKeys, 'license') && renderGroup(['license']);
$('<div>') $('<div>')
@ -388,6 +399,9 @@ pandora.ui.infoView = function(data, isMixed) {
.css({height: '16px'}) .css({height: '16px'})
.appendTo($text); .appendTo($text);
// Render any remaing keys defined in config
renderRemainingKeys();
// Duration, Aspect Ratio -------------------------------------------------- // Duration, Aspect Ratio --------------------------------------------------
@ -649,6 +663,7 @@ pandora.ui.infoView = function(data, isMixed) {
function renderGroup(keys) { function renderGroup(keys) {
var $element; var $element;
keys.forEach(function(key) { displayedKeys.push(key) });
if (canEdit || keys.filter(function(key) { if (canEdit || keys.filter(function(key) {
return data[key]; return data[key];
}).length) { }).length) {
@ -691,6 +706,18 @@ pandora.ui.infoView = function(data, isMixed) {
return $element; return $element;
} }
function renderRemainingKeys() {
var keys = pandora.site.itemKeys.filter(function(item) {
return item.id != '*' && item.type != 'layer' && !Ox.contains(displayedKeys, item.id);
}).map(function(item) {
return item.id;
});
if (keys.length) {
renderGroup(keys)
}
}
function toggleIconSize() { function toggleIconSize() {
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio); iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio);

View file

@ -140,7 +140,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}`
@ -222,7 +222,7 @@ async function loadEdit(id, args) {
data.title = data.edit.name data.title = data.edit.name
data.byline = data.edit.description data.byline = data.edit.description
data.link = `${pandora.proto}://${data.site}/edits/${data.edit.id}` 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.aspectratio = data.edit.clips[0].videoRatio
data.duration = data.edit.duration data.duration = data.edit.duration
return data return data

View file

@ -99,7 +99,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
@ -138,7 +138,7 @@ async function loadData(id, args) {
data.byline = data.item.director ? data.item.director.join(', ') : '' data.byline = data.item.director ? data.item.director.join(', ') : ''
} }
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
} }