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',
|
'producer', 'writer', 'cinematographer', 'editor', 'composer', 'actor',
|
||||||
'genre', 'keyword', 'summary'
|
'genre', 'keyword', 'summary'
|
||||||
],
|
],
|
||||||
|
mapKeys = {
|
||||||
|
'keyword': 'topic'
|
||||||
|
},
|
||||||
updateKeys,
|
updateKeys,
|
||||||
dialogHeight = Math.round((window.innerHeight - 48) * 0.9),
|
dialogHeight = Math.round((window.innerHeight - 48) * 0.9),
|
||||||
dialogWidth = Math.round(window.innerWidth * 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 == 'runtime' ? Math.round(value / 60) + ' min'
|
||||||
: key == 'productionCompany' ? value.join('; ')
|
: key == 'productionCompany' ? value.join('; ')
|
||||||
: Ox.isArray(
|
: Ox.isArray(
|
||||||
Ox.getObjectById(pandora.site.itemKeys, key).type
|
getItemKey(key).type
|
||||||
) ? value.join(', ')
|
) ? value.join(', ')
|
||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
@ -165,6 +168,14 @@ pandora.ui.metadataDialog = function(data) {
|
||||||
return dialogWidth - 32 - Ox.UI.SCROLLBAR_SIZE;
|
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() {
|
function getMetadata() {
|
||||||
pandora.api.getMetadata({
|
pandora.api.getMetadata({
|
||||||
id: data.imdbId,
|
id: data.imdbId,
|
||||||
|
@ -279,7 +290,7 @@ pandora.ui.metadataDialog = function(data) {
|
||||||
function getTitle(key) {
|
function getTitle(key) {
|
||||||
return Ox._(
|
return Ox._(
|
||||||
key == 'alternativeTitles' ? 'Alternative Titles'
|
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;
|
var edit = {id: data.id}, type;
|
||||||
updateKeys.forEach(function(key) {
|
updateKeys.forEach(function(key) {
|
||||||
type = key == 'alternativeTitles' ? []
|
type = key == 'alternativeTitles' ? []
|
||||||
: Ox.getObjectById(pandora.site.itemKeys, key).type;
|
: getItemKey(key).type;
|
||||||
edit[key] = imdb[key] || (
|
edit[getKey(key)] = imdb[key] || (
|
||||||
Ox.isArray(type) ? [] : ''
|
Ox.isArray(type) ? [] : ''
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue