Skip to content

Commit

Permalink
Merge pull request xbmc#6997 from fyfe/fix/tvshowlink-not-saved
Browse files Browse the repository at this point in the history
FIX: update link between movie and tv shows when saving a movies details
  • Loading branch information
Montellese committed Apr 22, 2015
2 parents 3768f24 + 099e17d commit 971ed7e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions xbmc/video/VideoDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2193,6 +2193,26 @@ int CVideoDatabase::UpdateDetailsForMovie(int idMovie, const CVideoInfoTag& deta
}
}

if (updatedDetails.find("showlink") != updatedDetails.end())
{
// remove existing links
vector<int> tvShowIds;
GetLinksToTvShow(idMovie, tvShowIds);
for (const auto& idTVShow : tvShowIds)
LinkMovieToTvshow(idMovie, idTVShow, true);

// setup links to shows if the linked shows are in the db
for (const auto& showLink : details.m_showLink)
{
CFileItemList items;
GetTvShowsByName(showLink, items);
if (!items.IsEmpty())
LinkMovieToTvshow(idMovie, items[0]->GetVideoInfoTag()->m_iDbId, false);
else
CLog::Log(LOGWARNING, "%s: Failed to link movie %s to show %s", __FUNCTION__, details.m_strTitle.c_str(), showLink.c_str());
}
}

// and update the movie table
std::string sql = "update movie set " + GetValueString(details, VIDEODB_ID_MIN, VIDEODB_ID_MAX, DbMovieOffsets);
if (idSet > 0)
Expand Down

0 comments on commit 971ed7e

Please sign in to comment.