boop5 / xbmcTweaks

Other
3 stars 3 forks source link

Not working anymore with KODI v14 #2

Open treynaer opened 9 years ago

treynaer commented 9 years ago

After exporting my lib, removing the databases, updating to KODI, adding the changes to the database and importing my lib again I found out TVShows wasn't working anymore.

I changed two things in movie.sql and rebuild the db from scratch:

/* View für Episoden(Serien) anpassen, um den watched state zu verteilen EDIT: Removed tvshow.c16 AS strShowPath,
 */     
DROP VIEW IF EXISTS `episodeview`;      
CREATE VIEW `episodeview` AS
    SELECT 
        episode.*, files.strFileName AS strFileName, path.strPath AS strPath, 
        filestate.playCount AS playCount, filestate.lastPlayed AS lastPlayed, files.dateAdded AS dateAdded, 
        tvshow.c00 AS strTitle, tvshow.c14 AS strStudio, tvshow.c05 AS premiered, tvshow.c13 AS mpaa, 
        bookmark_orig.timeInSeconds AS resumeTimeInSeconds,
        bookmark_orig.totalTimeInSeconds AS totalTimeInSeconds, seasons.idSeason AS idSeason
    FROM episode
    JOIN files ON files.idFile=episode.idFile
    JOIN tvshow ON tvshow.idShow=episode.idShow
    LEFT JOIN seasons ON seasons.idShow=episode.idShow AND seasons.season=episode.c12
    JOIN path ON files.idPath=path.idPath
    LEFT JOIN bookmark_orig ON bookmark_orig.idFile=episode.idFile AND bookmark_orig.type=1 AND bookmark_orig.sqlUser = SUBSTRING_INDEX(USER(),'@',1)
    LEFT JOIN filestate ON filestate.idFile = files.idFile AND filestate.sqlUser = SUBSTRING_INDEX(USER(),'@',1);

/* View für Serien anpassen, um den watched state zu verteilen EDIT: Added path.idParentPath AS idParentPath
 */     
DROP VIEW IF EXISTS `tvshowview`;
CREATE VIEW `tvshowview` AS
    SELECT 
        tvshow.*, path.idParentPath AS idParentPath, path.strPath AS strPath, path.dateAdded AS dateAdded, 
        MAX(filestate.lastPlayed) AS lastPlayed, NULLIF(COUNT(episode.c12), 0) AS totalCount, 
        COUNT(filestate.playCount) AS watchedcount, NULLIF(COUNT(DISTINCT(episode.c12)), 0) AS totalSeasons
    FROM tvshow
    LEFT JOIN tvshowlinkpath ON tvshowlinkpath.idShow=tvshow.idShow
    LEFT JOIN path ON path.idPath=tvshowlinkpath.idPath
    LEFT JOIN episode ON episode.idShow=tvshow.idShow
    LEFT JOIN files ON files.idFile=episode.idFile
    LEFT JOIN filestate on filestate.idFile = episode.idFile AND filestate.sqlUser = SUBSTRING_INDEX(USER(),'@',1)
    GROUP BY tvshow.idShow

Now TVShows is working again, but there is still something wrong with the Watched markers. I have no idea how to fixe this.

treynaer commented 9 years ago

Movies Watched markers are also not working. The way the markers are stored is probably changed.

treynaer commented 9 years ago

Looks like there is changed a lot with TVShows. tvshowview is split up to tvshowcounts and tvshowview. There is a new view seasonview.

screenshot 2014-12-29 19 39 09

The bu_files trigger wasn't created, thats probably the reason why the watched markers where gone.

treynaer commented 9 years ago

See pull request, it should work again. I found out how you fixed the users is tvshowview and added it to the newly created views.

tvshowview shouldn't be changed. Only tvshowcounts and seasonview.