Skip to content

Commit

Permalink
Add the ability to store more than one onlineid
Browse files Browse the repository at this point in the history
  • Loading branch information
phate89 committed Jun 19, 2016
1 parent 79be405 commit b65602f
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 76 deletions.
4 changes: 2 additions & 2 deletions xbmc/GUIInfoManager.cpp
Expand Up @@ -8618,7 +8618,7 @@ std::string CGUIInfoManager::GetVideoLabel(int item)
return StringUtils::Join(m_currentFile->GetVideoInfoTag()->m_director, g_advancedSettings.m_videoItemSeparator);
break;
case VIDEOPLAYER_IMDBNUMBER:
return m_currentFile->GetVideoInfoTag()->m_strIMDBNumber;
return m_currentFile->GetVideoInfoTag()->GetUniqueID();
case VIDEOPLAYER_RATING:
{
std::string strRating;
Expand Down Expand Up @@ -10153,7 +10153,7 @@ std::string CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std::
if (item->HasEPGInfoTag())
return item->GetEPGInfoTag()->IMDBNumber();
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strIMDBNumber;
return item->GetVideoInfoTag()->GetUniqueID();
break;
}
case LISTITEM_EPISODENAME:
Expand Down
6 changes: 3 additions & 3 deletions xbmc/addons/Scraper.cpp
Expand Up @@ -1035,16 +1035,16 @@ bool CScraper::GetArtistDetails(CCurlFile &fcurl, const CScraperUrl &scurl,

bool CScraper::GetArtwork(XFILE::CCurlFile &fcurl, CVideoInfoTag &details)
{
if (details.m_strIMDBNumber.empty())
if (!details.HasUniqueID())
return false;

CLog::Log(LOGDEBUG, "%s: Reading artwork for '%s' using %s scraper "
"(file: '%s', content: '%s', version: '%s')", __FUNCTION__, details.m_strIMDBNumber.c_str(),
"(file: '%s', content: '%s', version: '%s')", __FUNCTION__, details.GetUniqueID().c_str(),
Name().c_str(), Path().c_str(), ADDON::TranslateContent(Content()).c_str(), Version().asString().c_str());

std::vector<std::string> vcsIn;
CScraperUrl scurl;
vcsIn.push_back(details.m_strIMDBNumber);
vcsIn.push_back(details.GetUniqueID());
std::vector<std::string> vcsOut = RunNoThrow("GetArt", scurl, fcurl, &vcsIn);

bool fRet(false);
Expand Down
14 changes: 13 additions & 1 deletion xbmc/interfaces/json-rpc/VideoLibrary.cpp
Expand Up @@ -1002,6 +1002,8 @@ int CVideoLibrary::RequiresAdditionalDetails(const MediaType& mediaType, const C
details = details | VideoDbDetailsCast;
else if (propertyValue == "ratings")
details = details | VideoDbDetailsRating;
else if (propertyValue == "uniqueid")
details = details | VideoDbDetailsUniqueID;
else if (propertyValue == "showlink")
details = details | VideoDbDetailsShowLink;
else if (propertyValue == "streamdetails")
Expand Down Expand Up @@ -1146,7 +1148,17 @@ void CVideoLibrary::UpdateVideoTag(const CVariant &parameterObject, CVideoInfoTa
if (ParameterNotNull(parameterObject, "mpaa"))
details.SetMPAARating(parameterObject["mpaa"].asString());
if (ParameterNotNull(parameterObject, "imdbnumber"))
details.SetIMDBNumber(parameterObject["imdbnumber"].asString());
details.SetUniqueID(parameterObject["imdbnumber"].asString());
if (ParameterNotNull(parameterObject, "uniqueid"))
{
std::map<std::string, std::string> uniqueids;
for (CVariant::const_iterator_map rIt = parameterObject["uniqueid"].begin_map(); rIt != parameterObject["uniqueid"].end_map(); rIt++)
uniqueids[rIt->first] = rIt->second.asString();
if (uniqueids.find(details.GetDefaultUniqueID()) == uniqueids.end())
uniqueids[details.GetDefaultUniqueID()] = details.GetUniqueID();
details.SetUniqueIDs(uniqueids);
updatedDetails.insert("uniqueid");
}
if (ParameterNotNull(parameterObject, "premiered"))
{
CDateTime premiered;
Expand Down
9 changes: 6 additions & 3 deletions xbmc/interfaces/json-rpc/schema/methods.json
Expand Up @@ -1493,7 +1493,8 @@
{ "name": "userrating", "$ref": "Optional.Integer" },
{ "name": "ratings", "$ref": "Video.Ratings" },
{ "name": "dateadded", "$ref": "Optional.String" },
{ "name": "premiered", "$ref": "Optional.String", "description": "linked with year. Overriedes year" }
{ "name": "premiered", "$ref": "Optional.String", "description": "linked with year. Overriedes year" },
{ "name": "uniqueid", "type": "object", "additionalProperties": { "type": "string", "minLength": 1 } }
],
"returns": "string"
},
Expand Down Expand Up @@ -1538,7 +1539,8 @@
{ "name": "ratings", "$ref": "Video.Ratings" },
{ "name": "dateadded", "$ref": "Optional.String" },
{ "name": "runtime", "$ref": "Optional.Integer", "description": "Runtime in seconds" },
{ "name": "status", "$ref": "Optional.String" }
{ "name": "status", "$ref": "Optional.String" },
{ "name": "uniqueid", "type": "object", "additionalProperties": { "type": "string", "minLength": 1 } }
],
"returns": "string"
},
Expand Down Expand Up @@ -1581,7 +1583,8 @@
{ "name": "resume", "type": [ "null", { "$ref": "Video.Resume", "required": true } ], "default": null },
{ "name": "userrating", "$ref": "Optional.Integer" },
{ "name": "ratings", "$ref": "Video.Ratings" },
{ "name": "dateadded", "$ref": "Optional.String" }
{ "name": "dateadded", "$ref": "Optional.String" },
{ "name": "uniqueid", "type": "object", "additionalProperties": { "type": "string", "minLength": 1 } }
],
"returns": "string"
},
Expand Down
18 changes: 11 additions & 7 deletions xbmc/interfaces/json-rpc/schema/types.json
Expand Up @@ -602,13 +602,14 @@
"Video.Fields.Movie": {
"extends": "Item.Fields.Base",
"items": { "type": "string",
"description": "Requesting the cast, ratings, showlink, streamdetails and/or tag field will result in increased response times",
"description": "Requesting the cast, ratings, showlink, streamdetails, uniqueid and/or tag field will result in increased response times",
"enum": [ "title", "genre", "year", "rating", "director", "trailer",
"tagline", "plot", "plotoutline", "originaltitle", "lastplayed",
"playcount", "writer", "studio", "mpaa", "cast", "country",
"imdbnumber", "runtime", "set", "showlink", "streamdetails",
"top250", "votes", "fanart", "thumbnail", "file", "sorttitle",
"resume", "setid", "dateadded", "tag", "art", "userrating", "ratings", "premiered" ]
"resume", "setid", "dateadded", "tag", "art", "userrating",
"ratings", "premiered", "uniqueid" ]
}
},
"Video.Fields.MovieSet": {
Expand All @@ -620,13 +621,14 @@
"Video.Fields.TVShow": {
"extends": "Item.Fields.Base",
"items": { "type": "string",
"description": "Requesting the cast, ratings and/or tag field will result in increased response times",
"description": "Requesting the cast, ratings, uniqueid and/or tag field will result in increased response times",
"enum": [ "title", "genre", "year", "rating", "plot",
"studio", "mpaa", "cast", "playcount", "episode",
"imdbnumber", "premiered", "votes", "lastplayed",
"fanart", "thumbnail", "file", "originaltitle",
"sorttitle", "episodeguide", "season", "watchedepisodes",
"dateadded", "tag", "art", "userrating", "ratings", "runtime" ]
"dateadded", "tag", "art", "userrating", "ratings",
"runtime", "uniqueid" ]
}
},
"Video.Fields.Season": {
Expand All @@ -639,7 +641,7 @@
"Video.Fields.Episode": {
"extends": "Item.Fields.Base",
"items": { "type": "string",
"description": "Requesting the cast, ratings, streamdetails and/or tag field will result in increased response times",
"description": "Requesting the cast, ratings, streamdetails, uniqueid and/or tag field will result in increased response times",
"enum": [ "title", "plot", "votes", "rating", "writer",
"firstaired", "playcount", "runtime", "director",
"productioncode", "season", "episode", "originaltitle",
Expand Down Expand Up @@ -785,7 +787,8 @@
"tag": { "$ref": "Array.String" },
"userrating": { "type": "integer" },
"ratings": { "type": "Video.Ratings" },
"premiered": { "type": "string" }
"premiered": { "type": "string" },
"uniqueid": { "type": "object", "additionalProperties": { "type": "string", "minLength": 1 } }
}
},
"Video.Details.MovieSet": {
Expand Down Expand Up @@ -826,7 +829,8 @@
"tag": { "$ref": "Array.String" },
"userrating": { "type": "integer" },
"ratings": { "type": "Video.Ratings" },
"runtime": { "type": "integer", "description": "Runtime in seconds" }
"runtime": { "type": "integer", "description": "Runtime in seconds" },
"uniqueid": { "type": "object", "additionalProperties": { "type": "string", "minLength": 1 } }
}
},
"Video.Details.Season": {
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/json-rpc/schema/version.txt
@@ -1 +1 @@
7.15.1
7.16.0
2 changes: 1 addition & 1 deletion xbmc/interfaces/legacy/InfoTagVideo.cpp
Expand Up @@ -119,7 +119,7 @@ namespace XBMCAddon

String InfoTagVideo::getIMDBNumber()
{
return infoTag->m_strIMDBNumber;
return infoTag->GetUniqueID();
}

int InfoTagVideo::getSeason()
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/legacy/ListItem.cpp
Expand Up @@ -398,7 +398,7 @@ namespace XBMCAddon
else if (key == "set")
item->GetVideoInfoTag()->m_strSet = value;
else if (key == "imdbnumber")
item->GetVideoInfoTag()->m_strIMDBNumber = value;
item->GetVideoInfoTag()->SetUniqueID(value);
else if (key == "code")
item->GetVideoInfoTag()->m_strProductionCode = value;
else if (key == "aired")
Expand Down
4 changes: 2 additions & 2 deletions xbmc/network/upnp/UPnPInternal.cpp
Expand Up @@ -315,7 +315,7 @@ PopulateObjectFromTag(CVideoInfoTag& tag,
object.m_XbmcInfo.date_added = tag.m_dateAdded.GetAsW3CDate().c_str();
object.m_XbmcInfo.rating = tag.GetRating().rating;
object.m_XbmcInfo.votes = tag.GetRating().votes;
object.m_XbmcInfo.unique_identifier = tag.m_strIMDBNumber.c_str();
object.m_XbmcInfo.unique_identifier = tag.GetUniqueID().c_str();
for (const auto& country : tag.m_country)
object.m_XbmcInfo.countries.Add(country.c_str());
object.m_XbmcInfo.user_rating = tag.m_iUserRating;
Expand Down Expand Up @@ -820,7 +820,7 @@ PopulateTagFromObject(CVideoInfoTag& tag,

tag.m_dateAdded.SetFromW3CDate((const char*)object.m_XbmcInfo.date_added);
tag.AddRating(object.m_XbmcInfo.rating, object.m_XbmcInfo.votes);
tag.m_strIMDBNumber = object.m_XbmcInfo.unique_identifier;
tag.SetUniqueID(object.m_XbmcInfo.unique_identifier.GetChars());
for (unsigned int index = 0; index < object.m_XbmcInfo.countries.GetItemCount(); index++)
tag.m_country.push_back(object.m_XbmcInfo.countries.GetItem(index)->GetChars());
tag.m_iUserRating = object.m_XbmcInfo.user_rating;
Expand Down
4 changes: 2 additions & 2 deletions xbmc/utils/DatabaseUtils.cpp
Expand Up @@ -226,7 +226,7 @@ std::string DatabaseUtils::GetField(Field field, const MediaType &mediaType, Dat
else if (field == FieldDirector) result = StringUtils::Format("episode_view.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
else if (field == FieldSeason) result = StringUtils::Format("episode_view.c%02d", VIDEODB_ID_EPISODE_SEASON);
else if (field == FieldEpisodeNumber) result = StringUtils::Format("episode_view.c%02d", VIDEODB_ID_EPISODE_EPISODE);
else if (field == FieldUniqueId) result = StringUtils::Format("episode_view.c%02d", VIDEODB_ID_EPISODE_UNIQUEID);
else if (field == FieldUniqueId) result = StringUtils::Format("episode_view.c%02d", VIDEODB_ID_EPISODE_IDENT_ID);
else if (field == FieldEpisodeNumberSpecialSort) result = StringUtils::Format("episode_view.c%02d", VIDEODB_ID_EPISODE_SORTEPISODE);
else if (field == FieldSeasonSpecialSort) result = StringUtils::Format("episode_view.c%02d", VIDEODB_ID_EPISODE_SORTSEASON);
else if (field == FieldFilename) return "episode_view.strFilename";
Expand Down Expand Up @@ -645,7 +645,7 @@ int DatabaseUtils::GetField(Field field, const MediaType &mediaType, bool asInde
else if (field == FieldDirector) index = VIDEODB_ID_EPISODE_DIRECTOR;
else if (field == FieldSeason) index = VIDEODB_ID_EPISODE_SEASON;
else if (field == FieldEpisodeNumber) index = VIDEODB_ID_EPISODE_EPISODE;
else if (field == FieldUniqueId) index = VIDEODB_ID_EPISODE_UNIQUEID;
else if (field == FieldUniqueId) index = VIDEODB_ID_EPISODE_IDENT_ID;
else if (field == FieldEpisodeNumberSpecialSort) index = VIDEODB_ID_EPISODE_SORTEPISODE;
else if (field == FieldSeasonSpecialSort) index = VIDEODB_ID_EPISODE_SORTSEASON;
else if (field == FieldFilename) return VIDEODB_DETAILS_EPISODE_FILE;
Expand Down

0 comments on commit b65602f

Please sign in to comment.