[videodb] clear out art from tvshow/seasons that were combined #4999

Merged
merged 1 commit into from Jul 11, 2014

3 participants

@jmarshallnz
Team Kodi member

In the v85 database update we combined seasons/shows from multipaths, but this would have left links in the art table, as the triggers would not have kicked off due to analytics not being available.

This cleans them out.

@jmarshallnz
Team Kodi member

jenkins build this please

@Montellese mind taking a quick look?

@Montellese Montellese and 1 other commented on an outdated diff Jul 11, 2014
xbmc/video/VideoDatabase.cpp
@@ -4637,11 +4637,16 @@ void CVideoDatabase::UpdateTables(int iVersion)
// drop multipaths from the path table - they're not needed for anything at all
m_pDS->exec("DELETE FROM path WHERE strPath LIKE 'multipath://%'");
}
+ if (iVersion < 87)
+ { // due to the tvshow merging above, there could be orphaned season or show art
+ m_pDS->exec("DELETE from art WHERE media_type='tvshow' AND media_id NOT IN (SELECT idShow FROM tvshow)");
+ m_pDS->exec("DELETE from art WHERE media_type='season' AND media_id NOT IN (SELECT idSeason FROM seasons)");
@Montellese
Team Kodi member

I'd go with

DELETE from art WHERE media_type='tvshow' AND NOT EXISTS (SELECT 1 FROM tvshow WHERE tvshow.idShow = art.media_id)

and

DELETE from art WHERE media_type='season' AND NOT EXISTS (SELECT 1 FROM seasons WHERE seasons.idSeason = art.media_id)
@jmarshallnz
Team Kodi member

sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jonathan Marshall [videodb] clear out art from tvshow/seasons that were combined in the…
… v85 database update, as the triggers would not have kicked off
426702e
@jmarshallnz jmarshallnz merged commit 637e3ef into xbmc:master Jul 11, 2014
@jmarshallnz jmarshallnz deleted the jmarshallnz:season_cleanup branch Jul 11, 2014
@MilhouseVH

@jmarshallnz - although #4999 has removed some junk from the art table, it hasn't removed the CSI artwork referencing the Video-Private folder which no longer exists, and is being linked to the next new show to be scraped.

It appears that this artwork is linked to seasons that are themselves linked to a non-existant tvshow (idShow=217).

I've queried the db here which hopefully explains what is going on. The "real" CSI tvshow is idShow=121, with artwork in the "Video" (not Video-Private) folder.

The fix in #4999 has successfully deleted artwork not linked to seasons, but it hasn't deleted rows from the art table that are linked to seasons that are themselves not linked to a tvshow..

If the seasons were deleted that aren't linked to a show, then the fix in #4999 would have clobbered the CSI artwork as expected.

As mentioned in #4977, when scraping a new show without artwork, even with the addition of #4999, the new show is still being assigned the old CSI artwork because the new show, Extant, is being created with the old idShow 217 and thus "inherits" all of that shows artwork when the new show is missing the same.

@jmarshallnz
Team Kodi member

This seems unrelated in that case to the changes made recently (i.e. old leftovers) ?

I suggest the fix for that is in CleanLibrary, where we move the block clearing things that link to tvshows out from an if clause.

@MilhouseVH

Sure would be nice if the db upgrade could remove those seasons not linked to tvshows (and then remove the artwork not linked to seasons etc.), otherwise I don't mind running a library clean to fix this.

When you have something ping me and I'll do my best to test it!

@jmarshallnz
Team Kodi member

It's got nothing to do with whether or not your db is updated or not. The fault is entirely with the clean library routine. I'll pop up a PR in a few.

@MilhouseVH

What I meant was that it would be nice if the problem could be "fixed" as a one-off during a db upgrade, with the longer term fix in the clean library routine as you suggest. Many users may have accumulated this problem over time and may run into it (old artwork assigned to new shows) before they perform another clean library.

@jmarshallnz
Team Kodi member

There's some argument for that, but it would be a much bigger change than I'm willing to make.

@MilhouseVH

Fair enough! :)

@jmarshallnz
Team Kodi member
@MartijnKaijser MartijnKaijser added this to the Helix 14.0-alpha1 milestone Jul 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment