forked from 0x2620/pandora
add itemTitleKeys to config and move getItemTitle to its own file, use everywhere title strings are used
This commit is contained in:
parent
a9091db9ef
commit
fb5a5c5cf7
16 changed files with 41 additions and 49 deletions
|
@ -79,7 +79,7 @@ def load_config():
|
||||||
|
|
||||||
#add missing defaults
|
#add missing defaults
|
||||||
for section in (
|
for section in (
|
||||||
'capabilities', 'cantPlay', 'itemName', 'media', 'posters',
|
'capabilities', 'cantPlay', 'itemName', 'itemTitleKeys', 'media', 'posters',
|
||||||
'site', 'tv', 'user.ui', 'user.ui.part', 'user.ui.showFolder',
|
'site', 'tv', 'user.ui', 'user.ui.part', 'user.ui.showFolder',
|
||||||
'menuExtras', 'languages'
|
'menuExtras', 'languages'
|
||||||
):
|
):
|
||||||
|
|
|
@ -620,6 +620,7 @@
|
||||||
"plural": "Movies"
|
"plural": "Movies"
|
||||||
},
|
},
|
||||||
"itemRequiresVideo": true,
|
"itemRequiresVideo": true,
|
||||||
|
"itemTitleKeys": ["title", "director", "year"],
|
||||||
"itemViews": [
|
"itemViews": [
|
||||||
{"id": "info", "title": "Info"},
|
{"id": "info", "title": "Info"},
|
||||||
{"id": "player", "title": "Player"},
|
{"id": "player", "title": "Player"},
|
||||||
|
|
|
@ -636,6 +636,7 @@
|
||||||
"plural": "Movies"
|
"plural": "Movies"
|
||||||
},
|
},
|
||||||
"itemRequiresVideo": false,
|
"itemRequiresVideo": false,
|
||||||
|
"itemTitleKeys": ["title", "director", "year"],
|
||||||
"itemViews": [
|
"itemViews": [
|
||||||
{"id": "info", "title": "Info"},
|
{"id": "info", "title": "Info"},
|
||||||
{"id": "documents", "title": "Documents"},
|
{"id": "documents", "title": "Documents"},
|
||||||
|
|
|
@ -515,6 +515,7 @@
|
||||||
"plural": "Videos"
|
"plural": "Videos"
|
||||||
},
|
},
|
||||||
"itemRequiresVideo": true,
|
"itemRequiresVideo": true,
|
||||||
|
"itemTitleKeys": ["title", "director", "year"],
|
||||||
"itemViews": [
|
"itemViews": [
|
||||||
{"id": "info", "title": "Info"},
|
{"id": "info", "title": "Info"},
|
||||||
{"id": "player", "title": "Player"},
|
{"id": "player", "title": "Player"},
|
||||||
|
|
|
@ -435,6 +435,7 @@
|
||||||
"plural": "Videos"
|
"plural": "Videos"
|
||||||
},
|
},
|
||||||
"itemRequiresVideo": true,
|
"itemRequiresVideo": true,
|
||||||
|
"itemTitleKeys": ["title", "director", "year"],
|
||||||
"itemViews": [
|
"itemViews": [
|
||||||
{"id": "info", "title": "Info"},
|
{"id": "info", "title": "Info"},
|
||||||
{"id": "player", "title": "Player"},
|
{"id": "player", "title": "Player"},
|
||||||
|
|
|
@ -105,7 +105,7 @@ pandora.ui.browser = function() {
|
||||||
height: ratio <= 1 ? size : size / ratio,
|
height: ratio <= 1 ? size : size / ratio,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: info,
|
info: info,
|
||||||
title: data.title + (data.director && data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
title: pandora.getItemTitle(data),
|
||||||
url: url,
|
url: url,
|
||||||
width: ratio >= 1 ? size : size * ratio
|
width: ratio >= 1 ? size : size * ratio
|
||||||
};
|
};
|
||||||
|
@ -115,7 +115,7 @@ pandora.ui.browser = function() {
|
||||||
query: pandora.user.ui.find
|
query: pandora.user.ui.find
|
||||||
}), callback);
|
}), callback);
|
||||||
},
|
},
|
||||||
keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'],
|
keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys),
|
||||||
max: 1,
|
max: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
orientation: 'horizontal',
|
orientation: 'horizontal',
|
||||||
|
|
|
@ -94,7 +94,7 @@ pandora.ui.editPanel = function(isEmbed) {
|
||||||
editable: edit.type == 'static' && edit.editable,
|
editable: edit.type == 'static' && edit.editable,
|
||||||
enableSubtitles: ui.videoSubtitles,
|
enableSubtitles: ui.videoSubtitles,
|
||||||
formatTitle: function() {
|
formatTitle: function() {
|
||||||
return pandora.getItemTitle(Ox.last(arguments));
|
return pandora.getItemTitle(Ox.last(arguments), true);
|
||||||
},
|
},
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
getClipImageURL: function(id, width, height) {
|
getClipImageURL: function(id, width, height) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ pandora.ui.embedGrid = function() {
|
||||||
height: Math.round(ratio <= 1 ? size : size / ratio),
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: info,
|
info: info,
|
||||||
title: data.title + (data.director && data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
title: pandora.getItemTitle(data),
|
||||||
url: url,
|
url: url,
|
||||||
width: Math.round(ratio >= 1 ? size : size * ratio)
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ pandora.ui.embedGrid = function() {
|
||||||
}), callback);
|
}), callback);
|
||||||
return Ox.clone(data, true);
|
return Ox.clone(data, true);
|
||||||
},
|
},
|
||||||
keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'],
|
keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys),
|
||||||
max: 1,
|
max: 1,
|
||||||
selected: ui.listSelection,
|
selected: ui.listSelection,
|
||||||
size: 128,
|
size: 128,
|
||||||
|
@ -125,4 +125,4 @@ pandora.ui.embedGrid = function() {
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
13
static/js/getItemTitle.js
Normal file
13
static/js/getItemTitle.js
Normal file
|
@ -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 : '')
|
||||||
|
};
|
|
@ -80,7 +80,7 @@ pandora.ui.info = function() {
|
||||||
that.append(pandora.$ui.listInfo = pandora.ui.listInfo());
|
that.append(pandora.$ui.listInfo = pandora.ui.listInfo());
|
||||||
previousView == 'video' && resizeInfo();
|
previousView == 'video' && resizeInfo();
|
||||||
} else if (view == 'poster') {
|
} 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,
|
var ratio = result.data.posterRatio,
|
||||||
height = pandora.getInfoHeight(true);
|
height = pandora.getInfoHeight(true);
|
||||||
emptyInfo();
|
emptyInfo();
|
||||||
|
@ -379,11 +379,7 @@ pandora.ui.posterInfo = function(data) {
|
||||||
textOverflow: 'ellipsis',
|
textOverflow: 'ellipsis',
|
||||||
overflow: 'hidden'
|
overflow: 'hidden'
|
||||||
})
|
})
|
||||||
.html(
|
.html(pandora.getItemTitle(data)),
|
||||||
data.title + (
|
|
||||||
Ox.len(data.director) ? ' (' + data.director.join(', ') + ')' : ''
|
|
||||||
)
|
|
||||||
),
|
|
||||||
that = Ox.SplitPanel({
|
that = Ox.SplitPanel({
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,10 +14,10 @@ pandora.ui.item = function() {
|
||||||
id: pandora.user.ui.item,
|
id: pandora.user.ui.item,
|
||||||
keys: isVideoView ? [
|
keys: isVideoView ? [
|
||||||
'audioTracks',
|
'audioTracks',
|
||||||
'cuts', 'director', 'duration', 'durations', 'editable', 'layers',
|
'cuts', 'duration', 'durations', 'editable', 'layers',
|
||||||
'modified', 'parts', 'posterFrame', 'rendered', 'rightslevel',
|
'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) {
|
}, pandora.user.ui.itemView == 'info' && pandora.site.capabilities.canEditMetadata[pandora.user.level] ? 0 : -1, function(result) {
|
||||||
|
|
||||||
if (pandora.user.ui.item != item) {
|
if (pandora.user.ui.item != item) {
|
||||||
|
@ -32,7 +32,7 @@ pandora.ui.item = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pandora.$ui.itemTitle
|
pandora.$ui.itemTitle
|
||||||
.options({title: '<b>' + pandora.getItemTitle(result.data) + '</b>'})
|
.options({title: '<b>' + pandora.getItemTitle(result.data, true) + '</b>'})
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
// fixme: layers have value, subtitles has text?
|
// fixme: layers have value, subtitles has text?
|
||||||
|
|
|
@ -152,7 +152,7 @@ pandora.ui.list = function() {
|
||||||
height: Math.round(ratio <= 1 ? size : size / ratio),
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: info,
|
info: info,
|
||||||
title: data.title + (data.director && data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
title: pandora.getItemTitle(data),
|
||||||
url: url,
|
url: url,
|
||||||
width: Math.round(ratio >= 1 ? size : size * ratio)
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
||||||
};
|
};
|
||||||
|
@ -163,7 +163,7 @@ pandora.ui.list = function() {
|
||||||
}), callback);
|
}), callback);
|
||||||
return Ox.clone(data, true);
|
return Ox.clone(data, true);
|
||||||
},
|
},
|
||||||
keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'],
|
keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys),
|
||||||
selected: ui.listSelection,
|
selected: ui.listSelection,
|
||||||
size: 128,
|
size: 128,
|
||||||
sort: ui.listSort,
|
sort: ui.listSort,
|
||||||
|
@ -209,7 +209,7 @@ pandora.ui.list = function() {
|
||||||
height: Math.round(ratio <= 1 ? size : size / ratio),
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: info,
|
info: info,
|
||||||
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
title: pandora.getItemTitle(data),
|
||||||
url: url,
|
url: url,
|
||||||
width: Math.round(ratio >= 1 ? size : size * ratio)
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
||||||
},
|
},
|
||||||
|
@ -239,7 +239,7 @@ pandora.ui.list = function() {
|
||||||
});
|
});
|
||||||
return Ox.clone(data, true);
|
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,
|
selected: ui.listSelection,
|
||||||
size: 192,
|
size: 192,
|
||||||
sort: ui.listSort,
|
sort: ui.listSort,
|
||||||
|
@ -296,7 +296,7 @@ pandora.ui.list = function() {
|
||||||
height: Math.round(ratio <= 1 ? size : size / ratio),
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: info,
|
info: info,
|
||||||
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
title: pandora.getItemTitle(data),
|
||||||
url: url,
|
url: url,
|
||||||
width: Math.round(ratio >= 1 ? size : size * ratio)
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
||||||
},
|
},
|
||||||
|
@ -356,7 +356,7 @@ pandora.ui.list = function() {
|
||||||
}} : {})), callback);
|
}} : {})), callback);
|
||||||
return Ox.clone(data, true);
|
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,
|
selected: ui.listSelection,
|
||||||
size: 192,
|
size: 192,
|
||||||
sort: ui.listSort,
|
sort: ui.listSort,
|
||||||
|
|
|
@ -437,7 +437,7 @@ pandora.ui.listIconPanel = function(listData) {
|
||||||
height: size,
|
height: size,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key],
|
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),
|
url: pandora.getMediaURL('/' + data.id + '/icon' + size + '.jpg?' + data.modified),
|
||||||
width: size
|
width: size
|
||||||
};
|
};
|
||||||
|
@ -453,7 +453,7 @@ pandora.ui.listIconPanel = function(listData) {
|
||||||
}
|
}
|
||||||
}), callback);
|
}), callback);
|
||||||
},
|
},
|
||||||
keys: ['director', 'duration', 'id', 'modified', 'posterFrame', 'title', 'videoRatio', 'year'],
|
keys: ['duration', 'id', 'modified', 'posterFrame', 'videoRatio'].concat(pandora.site.itemTitleKeys),
|
||||||
max: 1,
|
max: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
//orientation: 'vertical',
|
//orientation: 'vertical',
|
||||||
|
|
|
@ -58,7 +58,7 @@ pandora.ui.previewDialog = function() {
|
||||||
that.update = function() {
|
that.update = function() {
|
||||||
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
|
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
|
||||||
pandora.requests.preview = pandora.api.find({
|
pandora.requests.preview = pandora.api.find({
|
||||||
keys: ['director', 'id', 'modified', 'posterRatio', 'title', 'year'],
|
keys: ['id', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys),
|
||||||
query: {
|
query: {
|
||||||
conditions: [{
|
conditions: [{
|
||||||
key: 'id',
|
key: 'id',
|
||||||
|
@ -73,11 +73,7 @@ pandora.ui.previewDialog = function() {
|
||||||
? pandora.site.posters.ratio
|
? pandora.site.posters.ratio
|
||||||
: item.posterRatio,
|
: item.posterRatio,
|
||||||
size = getSize(posterRatio),
|
size = getSize(posterRatio),
|
||||||
title = item.title + (
|
title = pandora.getItemTitle(item, true);
|
||||||
item.director.length ? ' (' + item.director.join(', ') + ')' : ''
|
|
||||||
) + (
|
|
||||||
item.year ? ' ' + item.year : ''
|
|
||||||
);
|
|
||||||
$image = $('<img>')
|
$image = $('<img>')
|
||||||
.attr({src: pandora.getMediaURL('/' + item.id + '/' + (
|
.attr({src: pandora.getMediaURL('/' + item.id + '/' + (
|
||||||
pandora.user.ui.showSitePosters ? 'siteposter' : 'poster'
|
pandora.user.ui.showSitePosters ? 'siteposter' : 'poster'
|
||||||
|
|
|
@ -98,12 +98,7 @@ pandora.ui.tv = function() {
|
||||||
title: pandora.site.site.name + ' — ' + (
|
title: pandora.site.site.name + ' — ' + (
|
||||||
list || Ox._('All {0}', [Ox._(pandora.site.itemName.plural)])
|
list || Ox._('All {0}', [Ox._(pandora.site.itemName.plural)])
|
||||||
) + ' — '
|
) + ' — '
|
||||||
+ result.data.title
|
+ pandora.getItemTitle(result.data, true),
|
||||||
+ (
|
|
||||||
result.data.director
|
|
||||||
? ' (' + result.data.director.join(', ') + ') '
|
|
||||||
: ''
|
|
||||||
) + result.data.year,
|
|
||||||
video: videoOptions.video,
|
video: videoOptions.video,
|
||||||
volume: pandora.user.ui.videoVolume
|
volume: pandora.user.ui.videoVolume
|
||||||
})
|
})
|
||||||
|
|
|
@ -1281,18 +1281,6 @@ pandora.getItemIdAndPosition = function() {
|
||||||
return ret;
|
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) {
|
pandora.getLargeClipTimelineURL = function(item, inPoint, outPoint, type, callback) {
|
||||||
var fps = 25,
|
var fps = 25,
|
||||||
width = Math.ceil((outPoint - inPoint) * fps),
|
width = Math.ceil((outPoint - inPoint) * fps),
|
||||||
|
|
Loading…
Reference in a new issue