diff --git a/pandora/app/config.py b/pandora/app/config.py index 07da5849..081479c2 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -79,7 +79,7 @@ def load_config(): #add missing defaults for section in ( - 'capabilities', 'cantPlay', 'itemName', 'media', 'posters', + 'capabilities', 'cantPlay', 'itemName', 'itemTitleKeys', 'media', 'posters', 'site', 'tv', 'user.ui', 'user.ui.part', 'user.ui.showFolder', 'menuExtras', 'languages' ): diff --git a/pandora/config.0xdb.jsonc b/pandora/config.0xdb.jsonc index ed408d4f..aef25e46 100644 --- a/pandora/config.0xdb.jsonc +++ b/pandora/config.0xdb.jsonc @@ -620,6 +620,7 @@ "plural": "Movies" }, "itemRequiresVideo": true, + "itemTitleKeys": ["title", "director", "year"], "itemViews": [ {"id": "info", "title": "Info"}, {"id": "player", "title": "Player"}, diff --git a/pandora/config.indiancinema.jsonc b/pandora/config.indiancinema.jsonc index 33dd755a..2a846557 100644 --- a/pandora/config.indiancinema.jsonc +++ b/pandora/config.indiancinema.jsonc @@ -636,6 +636,7 @@ "plural": "Movies" }, "itemRequiresVideo": false, + "itemTitleKeys": ["title", "director", "year"], "itemViews": [ {"id": "info", "title": "Info"}, {"id": "documents", "title": "Documents"}, diff --git a/pandora/config.padma.jsonc b/pandora/config.padma.jsonc index 6062c82f..07fbfd1c 100644 --- a/pandora/config.padma.jsonc +++ b/pandora/config.padma.jsonc @@ -515,6 +515,7 @@ "plural": "Videos" }, "itemRequiresVideo": true, + "itemTitleKeys": ["title", "director", "year"], "itemViews": [ {"id": "info", "title": "Info"}, {"id": "player", "title": "Player"}, diff --git a/pandora/config.pandora.jsonc b/pandora/config.pandora.jsonc index b45cb96e..05b82b30 100644 --- a/pandora/config.pandora.jsonc +++ b/pandora/config.pandora.jsonc @@ -435,6 +435,7 @@ "plural": "Videos" }, "itemRequiresVideo": true, + "itemTitleKeys": ["title", "director", "year"], "itemViews": [ {"id": "info", "title": "Info"}, {"id": "player", "title": "Player"}, diff --git a/static/js/browser.js b/static/js/browser.js index d928cb5f..6759820d 100644 --- a/static/js/browser.js +++ b/static/js/browser.js @@ -105,7 +105,7 @@ pandora.ui.browser = function() { height: ratio <= 1 ? size : size / ratio, id: data.id, info: info, - title: data.title + (data.director && data.director.length ? ' (' + data.director.join(', ') + ')' : ''), + title: pandora.getItemTitle(data), url: url, width: ratio >= 1 ? size : size * ratio }; @@ -115,7 +115,7 @@ pandora.ui.browser = function() { query: pandora.user.ui.find }), callback); }, - keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'], + keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys), max: 1, min: 1, orientation: 'horizontal', diff --git a/static/js/editPanel.js b/static/js/editPanel.js index db976155..d2776bdb 100644 --- a/static/js/editPanel.js +++ b/static/js/editPanel.js @@ -94,7 +94,7 @@ pandora.ui.editPanel = function(isEmbed) { editable: edit.type == 'static' && edit.editable, enableSubtitles: ui.videoSubtitles, formatTitle: function() { - return pandora.getItemTitle(Ox.last(arguments)); + return pandora.getItemTitle(Ox.last(arguments), true); }, fullscreen: false, getClipImageURL: function(id, width, height) { diff --git a/static/js/embedGrid.js b/static/js/embedGrid.js index dc02e212..8d430481 100644 --- a/static/js/embedGrid.js +++ b/static/js/embedGrid.js @@ -40,7 +40,7 @@ pandora.ui.embedGrid = function() { height: Math.round(ratio <= 1 ? size : size / ratio), id: data.id, info: info, - title: data.title + (data.director && data.director.length ? ' (' + data.director.join(', ') + ')' : ''), + title: pandora.getItemTitle(data), url: url, width: Math.round(ratio >= 1 ? size : size * ratio) }; @@ -51,7 +51,7 @@ pandora.ui.embedGrid = function() { }), callback); return Ox.clone(data, true); }, - keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'], + keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys), max: 1, selected: ui.listSelection, size: 128, @@ -125,4 +125,4 @@ pandora.ui.embedGrid = function() { return that; -}; \ No newline at end of file +}; diff --git a/static/js/getItemTitle.js b/static/js/getItemTitle.js new file mode 100644 index 00000000..286036c6 --- /dev/null +++ b/static/js/getItemTitle.js @@ -0,0 +1,13 @@ +'use strict'; + +pandora.getItemTitle = function(itemData, includeYear) { + return (itemData.title || Ox._('Untitled')) + ( + Ox.len(itemData.director) || (includeYear && itemData.year) + ? ' (' + ( + Ox.len(itemData.director) + ? itemData.director + : [Ox._('Unknown Director')] + ).join(', ') + ')' + : '' + ) + (includeYear && itemData.year ? ' ' + itemData.year : '') +}; diff --git a/static/js/info.js b/static/js/info.js index a87e2593..27d82251 100644 --- a/static/js/info.js +++ b/static/js/info.js @@ -80,7 +80,7 @@ pandora.ui.info = function() { that.append(pandora.$ui.listInfo = pandora.ui.listInfo()); previousView == 'video' && resizeInfo(); } else if (view == 'poster') { - pandora.api.get({id: id, keys: ['director', 'modified', 'posterRatio', 'title']}, function(result) { + pandora.api.get({id: id, keys: ['modified', 'posterRatio'].concat(pandora.site.itemTitleKeys)}, function(result) { var ratio = result.data.posterRatio, height = pandora.getInfoHeight(true); emptyInfo(); @@ -379,11 +379,7 @@ pandora.ui.posterInfo = function(data) { textOverflow: 'ellipsis', overflow: 'hidden' }) - .html( - data.title + ( - Ox.len(data.director) ? ' (' + data.director.join(', ') + ')' : '' - ) - ), + .html(pandora.getItemTitle(data)), that = Ox.SplitPanel({ elements: [ { diff --git a/static/js/item.js b/static/js/item.js index a8102c32..107b84ba 100644 --- a/static/js/item.js +++ b/static/js/item.js @@ -14,10 +14,10 @@ pandora.ui.item = function() { id: pandora.user.ui.item, keys: isVideoView ? [ 'audioTracks', - 'cuts', 'director', 'duration', 'durations', 'editable', 'layers', + 'cuts', 'duration', 'durations', 'editable', 'layers', 'modified', 'parts', 'posterFrame', 'rendered', 'rightslevel', - 'size', 'title', 'videoRatio', 'year' - ] : [] + 'size', 'videoRatio', + ].concat(pandora.site.itemTitleKeys) : [] }, pandora.user.ui.itemView == 'info' && pandora.site.capabilities.canEditMetadata[pandora.user.level] ? 0 : -1, function(result) { if (pandora.user.ui.item != item) { @@ -32,7 +32,7 @@ pandora.ui.item = function() { } pandora.$ui.itemTitle - .options({title: '' + pandora.getItemTitle(result.data) + ''}) + .options({title: '' + pandora.getItemTitle(result.data, true) + ''}) .show(); // fixme: layers have value, subtitles has text? diff --git a/static/js/list.js b/static/js/list.js index 456e7332..9523d77f 100644 --- a/static/js/list.js +++ b/static/js/list.js @@ -152,7 +152,7 @@ pandora.ui.list = function() { height: Math.round(ratio <= 1 ? size : size / ratio), id: data.id, info: info, - title: data.title + (data.director && data.director.length ? ' (' + data.director.join(', ') + ')' : ''), + title: pandora.getItemTitle(data), url: url, width: Math.round(ratio >= 1 ? size : size * ratio) }; @@ -163,7 +163,7 @@ pandora.ui.list = function() { }), callback); return Ox.clone(data, true); }, - keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'], + keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys), selected: ui.listSelection, size: 128, sort: ui.listSort, @@ -209,7 +209,7 @@ pandora.ui.list = function() { height: Math.round(ratio <= 1 ? size : size / ratio), id: data.id, info: info, - title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), + title: pandora.getItemTitle(data), url: url, width: Math.round(ratio >= 1 ? size : size * ratio) }, @@ -239,7 +239,7 @@ pandora.ui.list = function() { }); return Ox.clone(data, true); }, - keys: ['clips', 'director', 'duration', 'id', 'modified', 'posterRatio', 'title', 'videoRatio', 'year'], + keys: ['clips', 'duration', 'id', 'modified', 'posterRatio', 'videoRatio'].concat(pandora.site.itemTitleKeys), selected: ui.listSelection, size: 192, sort: ui.listSort, @@ -296,7 +296,7 @@ pandora.ui.list = function() { height: Math.round(ratio <= 1 ? size : size / ratio), id: data.id, info: info, - title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), + title: pandora.getItemTitle(data), url: url, width: Math.round(ratio >= 1 ? size : size * ratio) }, @@ -356,7 +356,7 @@ pandora.ui.list = function() { }} : {})), callback); return Ox.clone(data, true); }, - keys: ['clips', 'director', 'duration', 'id', 'modified', 'posterRatio', 'rendered', 'title', 'year'], + keys: ['clips', 'duration', 'id', 'modified', 'posterRatio', 'rendered'].concat(pandora.site.itemTitleKeys), selected: ui.listSelection, size: 192, sort: ui.listSort, diff --git a/static/js/listDialog.js b/static/js/listDialog.js index 5a8a7665..3083f0f2 100644 --- a/static/js/listDialog.js +++ b/static/js/listDialog.js @@ -437,7 +437,7 @@ pandora.ui.listIconPanel = function(listData) { height: size, id: data.id, info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key], - title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), + title: pandora.getItemTitle(data), url: pandora.getMediaURL('/' + data.id + '/icon' + size + '.jpg?' + data.modified), width: size }; @@ -453,7 +453,7 @@ pandora.ui.listIconPanel = function(listData) { } }), callback); }, - keys: ['director', 'duration', 'id', 'modified', 'posterFrame', 'title', 'videoRatio', 'year'], + keys: ['duration', 'id', 'modified', 'posterFrame', 'videoRatio'].concat(pandora.site.itemTitleKeys), max: 1, min: 1, //orientation: 'vertical', diff --git a/static/js/previewDialog.js b/static/js/previewDialog.js index fce4f46d..c0681c42 100644 --- a/static/js/previewDialog.js +++ b/static/js/previewDialog.js @@ -58,7 +58,7 @@ pandora.ui.previewDialog = function() { that.update = function() { pandora.requests.preview && pandora.api.cancel(pandora.requests.preview); pandora.requests.preview = pandora.api.find({ - keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'], + keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys), query: { conditions: [{ key: 'id', @@ -73,11 +73,7 @@ pandora.ui.previewDialog = function() { ? pandora.site.posters.ratio : item.posterRatio, size = getSize(posterRatio), - title = item.title + ( - item.director.length ? ' (' + item.director.join(', ') + ')' : '' - ) + ( - item.year ? ' ' + item.year : '' - ); + title = pandora.getItemTitle(item, true); $image = $('') .attr({src: pandora.getMediaURL('/' + item.id + '/' + ( pandora.user.ui.showSitePosters ? 'siteposter' : 'poster' diff --git a/static/js/tv.js b/static/js/tv.js index dbbf8dff..03a9a392 100644 --- a/static/js/tv.js +++ b/static/js/tv.js @@ -98,12 +98,7 @@ pandora.ui.tv = function() { title: pandora.site.site.name + ' — ' + ( list || Ox._('All {0}', [Ox._(pandora.site.itemName.plural)]) ) + ' — ' - + result.data.title - + ( - result.data.director - ? ' (' + result.data.director.join(', ') + ') ' - : '' - ) + result.data.year, + + pandora.getItemTitle(result.data, true), video: videoOptions.video, volume: pandora.user.ui.videoVolume }) diff --git a/static/js/utils.js b/static/js/utils.js index 710a0bd8..29309241 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1281,18 +1281,6 @@ pandora.getItemIdAndPosition = function() { return ret; } -pandora.getItemTitle = function(itemData) { - return (itemData.title || Ox._('Untitled')) + ( - Ox.len(itemData.director) || itemData.year - ? ' (' + ( - Ox.len(itemData.director) - ? itemData.director - : [Ox._('Unknown Director')] - ).join(', ') + ')' - : '' - ) + (itemData.year ? ' ' + itemData.year : '') -}; - pandora.getLargeClipTimelineURL = function(item, inPoint, outPoint, type, callback) { var fps = 25, width = Math.ceil((outPoint - inPoint) * fps),