forked from 0x2620/pandora
map imdb keyword to topic
This commit is contained in:
parent
f0a4aba751
commit
784bbbae73
1 changed files with 15 additions and 4 deletions
|
@ -9,6 +9,9 @@ pandora.ui.metadataDialog = function(data) {
|
|||
'producer', 'writer', 'cinematographer', 'editor', 'composer', 'actor',
|
||||
'genre', 'keyword', 'summary'
|
||||
],
|
||||
mapKeys = {
|
||||
'keyword': 'topic'
|
||||
},
|
||||
updateKeys,
|
||||
dialogHeight = Math.round((window.innerHeight - 48) * 0.9),
|
||||
dialogWidth = Math.round(window.innerWidth * 0.9),
|
||||
|
@ -156,7 +159,7 @@ pandora.ui.metadataDialog = function(data) {
|
|||
: key == 'runtime' ? Math.round(value / 60) + ' min'
|
||||
: key == 'productionCompany' ? value.join('; ')
|
||||
: Ox.isArray(
|
||||
Ox.getObjectById(pandora.site.itemKeys, key).type
|
||||
getItemKey(key).type
|
||||
) ? value.join(', ')
|
||||
: value;
|
||||
}
|
||||
|
@ -165,6 +168,14 @@ pandora.ui.metadataDialog = function(data) {
|
|||
return dialogWidth - 32 - Ox.UI.SCROLLBAR_SIZE;
|
||||
}
|
||||
|
||||
function getItemKey(key) {
|
||||
return Ox.getObjectById(pandora.site.itemKeys, getKey(key));
|
||||
}
|
||||
|
||||
function getKey(key) {
|
||||
return mapKeys[key] || key;
|
||||
}
|
||||
|
||||
function getMetadata() {
|
||||
pandora.api.getMetadata({
|
||||
id: data.imdbId,
|
||||
|
@ -279,7 +290,7 @@ pandora.ui.metadataDialog = function(data) {
|
|||
function getTitle(key) {
|
||||
return Ox._(
|
||||
key == 'alternativeTitles' ? 'Alternative Titles'
|
||||
: Ox.getObjectById(pandora.site.itemKeys, key).title
|
||||
: getItemKey(key).title
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -350,8 +361,8 @@ pandora.ui.metadataDialog = function(data) {
|
|||
var edit = {id: data.id}, type;
|
||||
updateKeys.forEach(function(key) {
|
||||
type = key == 'alternativeTitles' ? []
|
||||
: Ox.getObjectById(pandora.site.itemKeys, key).type;
|
||||
edit[key] = imdb[key] || (
|
||||
: getItemKey(key).type;
|
||||
edit[getKey(key)] = imdb[key] || (
|
||||
Ox.isArray(type) ? [] : ''
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue