jellyfin / jellyfin-kodi

Jellyfin Plugin for Kodi
https://jellyfin.org
GNU General Public License v3.0
845 stars 113 forks source link

Movies are empty with latest Kodi #808

Closed dbarkar closed 6 months ago

dbarkar commented 9 months ago

Describe the bug When I install Jellyfin video plugin to Kodi and sync my library, Movies are empty. Other libraries like TV Shows are properly synchornized. Looks like video plugin "owns" Movies (I can't add folders there) but movies are not pulled. I found this problem on Android TV, but it also happens on PC and probably on other platforms, my logs are from PC.

This is a recent regression. I checked these revisions: https://github.com/xbmc/xbmc/commit/5198ea50825e1f5adbd55b467eb3982fa8618766 (master @ 2024-Jan-13) - bugged https://github.com/xbmc/xbmc/commit/979dbf5fe5d0b42daf633434afc3986651c8646a (21.0b2-Omega @ 2023-Dec-9) - working.

To Reproduce Steps to reproduce the behavior:

  1. Install Kodi
  2. Setup Jellyfin server, add library for Movies
  3. Install Jellyfin plugin to Kodi, connect to the server, synchronize
  4. See that Movies are still empty

Expected behavior Movies are synchonized.

Logs Failure (master) - https://paste.kodi.tv/sipakinizu.kodi Success (21.0b2-Omega) - https://paste.kodi.tv/uhavuyogus.kodi

System (please complete the following information):

mcarlton00 commented 9 months ago

This has been discussed on the forum a bit. It appears that Kodi has broken something around database versions. Hopefully whatever it was gets fixed before a full release, but we may have to change something if they don't

https://forum.jellyfin.org/t-movies-do-not-appear-on-coreelec-nightly-starting-20240109-cont

dbarkar commented 9 months ago

I don't think they are going to fix anything - https://github.com/xbmc/xbmc/issues/24507

mcarlton00 commented 9 months ago

Oh no, they'll put absolutely no effort into doing anything for us. They hate how this addon functions, because frankly it's a disgusting hack that probably shouldn't exist. My hope is that whatever they did was unintentional and will be changed again before a full release. It probably won't and we'll have to figure out a fix, but at this moment it's looking like that has to wait until the next beta since running nightly versions is an absolute nightmare for me

sarbes commented 9 months ago

"Hate" is such a strong word...

There have been some DB changes involving the "movie versions" feature. I think it's plausible that this broke something on your side.

LeVraiRoiDHyrule commented 9 months ago

Hi, I just noticed this issue too. But I was on a nightly and then downgraded back to release 20.3. I don't know if this problem is for the same reasons as here or if it is because of the version downgrade I just did.

pdf commented 9 months ago

Below is the schema diff, in case it's useful

--- /tmp/20.sql 2024-01-23 23:01:02.773076425 +1100
+++ /tmp/21.sql 2024-01-23 23:01:39.772200224 +1100
@@ -28,6 +28,8 @@
 CREATE TABLE tag_link (tag_id integer, media_id integer, media_type TEXT);
 CREATE TABLE rating (rating_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, rating_type TEXT, rating FLOAT, votes INTEGER);
 CREATE TABLE uniqueid (uniqueid_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, value TEXT, type TEXT);
+CREATE TABLE videoversiontype (id INTEGER PRIMARY KEY, name TEXT, owner INTEGER, itemType INTEGER);
+CREATE TABLE videoversion (idFile INTEGER PRIMARY KEY, idMedia INTEGER, media_type TEXT, itemType INTEGER, idType INTEGER);
 CREATE INDEX ix_bookmark ON bookmark (idFile, type);
 CREATE UNIQUE INDEX ix_settings ON settings ( idFile )
 ;
@@ -67,6 +69,8 @@
 CREATE UNIQUE INDEX ix_actor_link_1 ON actor_link (actor_id, media_type, media_id, role);
 CREATE INDEX ix_actor_link_2 ON actor_link (media_id, media_type, actor_id);
 CREATE INDEX ix_actor_link_3 ON actor_link (media_type);
+CREATE INDEX ix_videoversion ON videoversion (idMedia, media_type);
+CREATE INDEX ix_movie_title ON movie (c00);
 CREATE UNIQUE INDEX ix_tag_1 ON tag (name);
 CREATE UNIQUE INDEX ix_tag_link_1 ON tag_link (tag_id, media_type, media_id);
 CREATE UNIQUE INDEX ix_tag_link_2 ON tag_link (media_id, media_type, tag_id);
@@ -89,7 +93,7 @@
 CREATE UNIQUE INDEX ix_country_link_1 ON country_link (country_id, media_type, media_id);
 CREATE UNIQUE INDEX ix_country_link_2 ON country_link (media_id, media_type, country_id);
 CREATE INDEX ix_country_link_3 ON country_link (media_type);
-CREATE TRIGGER delete_movie AFTER DELETE ON movie FOR EACH ROW BEGIN DELETE FROM genre_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM actor_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM director_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM studio_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM country_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM writer_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM movielinktvshow WHERE idMovie=old.idMovie; DELETE FROM art WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM tag_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM rating WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM uniqueid WHERE media_id=old.idMovie AND media_type='movie'; END;
+CREATE TRIGGER delete_movie AFTER DELETE ON movie FOR EACH ROW BEGIN DELETE FROM genre_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM actor_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM director_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM studio_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM country_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM writer_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM movielinktvshow WHERE idMovie=old.idMovie; DELETE FROM art WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM tag_link WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM rating WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM uniqueid WHERE media_id=old.idMovie AND media_type='movie'; DELETE FROM videoversion WHERE idMedia=old.idMovie AND media_type='movie'; END;
 CREATE TRIGGER delete_tvshow AFTER DELETE ON tvshow FOR EACH ROW BEGIN DELETE FROM actor_link WHERE media_id=old.idShow AND media_type='tvshow'; DELETE FROM director_link WHERE media_id=old.idShow AND media_type='tvshow'; DELETE FROM studio_link WHERE media_id=old.idShow AND media_type='tvshow'; DELETE FROM tvshowlinkpath WHERE idShow=old.idShow; DELETE FROM genre_link WHERE media_id=old.idShow AND media_type='tvshow'; DELETE FROM movielinktvshow WHERE idShow=old.idShow; DELETE FROM seasons WHERE idShow=old.idShow; DELETE FROM art WHERE media_id=old.idShow AND media_type='tvshow'; DELETE FROM tag_link WHERE media_id=old.idShow AND media_type='tvshow'; DELETE FROM rating WHERE media_id=old.idShow AND media_type='tvshow'; DELETE FROM uniqueid WHERE media_id=old.idShow AND media_type='tvshow'; END;
 CREATE TRIGGER delete_musicvideo AFTER DELETE ON musicvideo FOR EACH ROW BEGIN DELETE FROM actor_link WHERE media_id=old.idMVideo AND media_type='musicvideo'; DELETE FROM director_link WHERE media_id=old.idMVideo AND media_type='musicvideo'; DELETE FROM genre_link WHERE media_id=old.idMVideo AND media_type='musicvideo'; DELETE FROM studio_link WHERE media_id=old.idMVideo AND media_type='musicvideo'; DELETE FROM art WHERE media_id=old.idMVideo AND media_type='musicvideo'; DELETE FROM tag_link WHERE media_id=old.idMVideo AND media_type='musicvideo'; DELETE FROM uniqueid WHERE media_id=old.idMVideo AND media_type='musicvideo'; END;
 CREATE TRIGGER delete_episode AFTER DELETE ON episode FOR EACH ROW BEGIN DELETE FROM actor_link WHERE media_id=old.idEpisode AND media_type='episode'; DELETE FROM director_link WHERE media_id=old.idEpisode AND media_type='episode'; DELETE FROM writer_link WHERE media_id=old.idEpisode AND media_type='episode'; DELETE FROM art WHERE media_id=old.idEpisode AND media_type='episode'; DELETE FROM rating WHERE media_id=old.idEpisode AND media_type='episode'; DELETE FROM uniqueid WHERE media_id=old.idEpisode AND media_type='episode'; END;
@@ -97,18 +101,18 @@
 CREATE TRIGGER delete_set AFTER DELETE ON sets FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idSet AND media_type='set'; END;
 CREATE TRIGGER delete_person AFTER DELETE ON actor FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.actor_id AND media_type IN ('actor','artist','writer','director'); END;
 CREATE TRIGGER delete_tag AFTER DELETE ON tag_link FOR EACH ROW BEGIN DELETE FROM tag WHERE tag_id=old.tag_id AND tag_id NOT IN (SELECT DISTINCT tag_id FROM tag_link); END;
-CREATE TRIGGER delete_file AFTER DELETE ON files FOR EACH ROW BEGIN DELETE FROM bookmark WHERE idFile=old.idFile; DELETE FROM settings WHERE idFile=old.idFile; DELETE FROM stacktimes WHERE idFile=old.idFile; DELETE FROM streamdetails WHERE idFile=old.idFile; END;
+CREATE TRIGGER delete_file AFTER DELETE ON files FOR EACH ROW BEGIN DELETE FROM bookmark WHERE idFile=old.idFile; DELETE FROM settings WHERE idFile=old.idFile; DELETE FROM stacktimes WHERE idFile=old.idFile; DELETE FROM streamdetails WHERE idFile=old.idFile; DELETE FROM videoversion WHERE idFile=old.idFile; DELETE FROM art WHERE media_id=old.idFile AND media_type='videoversion'; END;
 CREATE VIEW episode_view AS SELECT   episode.*,  files.strFileName AS strFileName,  path.strPath AS strPath,  files.playCount AS playCount,  files.lastPlayed AS lastPlayed,  files.dateAdded AS dateAdded,  tvshow.c00 AS strTitle,  tvshow.c08 AS genre,  tvshow.c14 AS studio,  tvshow.c05 AS premiered,  tvshow.c13 AS mpaa,  bookmark.timeInSeconds AS resumeTimeInSeconds,   bookmark.totalTimeInSeconds AS totalTimeInSeconds,   bookmark.playerState AS playerState,   rating.rating AS rating,   rating.votes AS votes,   rating.rating_type AS rating_type,   uniqueid.value AS uniqueid_value,   uniqueid.type AS uniqueid_type FROM episode  JOIN files ON    files.idFile=episode.idFile  JOIN tvshow ON    tvshow.idShow=episode.idShow  JOIN seasons ON    seasons.idSeason=episode.idSeason  JOIN path ON    files.idPath=path.idPath  LEFT JOIN bookmark ON    bookmark.idFile=episode.idFile AND bookmark.type=1  LEFT JOIN rating ON    rating.rating_id=episode.c03  LEFT JOIN uniqueid ON    uniqueid.uniqueid_id=episode.c20
 /* episode_view(idEpisode,idFile,c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,idShow,userrating,idSeason,strFileName,strPath,playCount,lastPlayed,dateAdded,strTitle,genre,studio,premiered,mpaa,resumeTimeInSeconds,totalTimeInSeconds,playerState,rating,votes,rating_type,uniqueid_value,uniqueid_type) */;
-CREATE VIEW tvshowcounts AS SELECT       tvshow.idShow AS idShow,      MAX(files.lastPlayed) AS lastPlayed,      NULLIF(COUNT(episode.c12), 0) AS totalCount,      COUNT(files.playCount) AS watchedcount,      NULLIF(COUNT(DISTINCT(episode.c12)), 0) AS totalSeasons,       MAX(files.dateAdded) as dateAdded     FROM tvshow      LEFT JOIN episode ON        episode.idShow=tvshow.idShow      LEFT JOIN files ON        files.idFile=episode.idFile GROUP BY tvshow.idShow
-/* tvshowcounts(idShow,lastPlayed,totalCount,watchedcount,totalSeasons,dateAdded) */;
+CREATE VIEW tvshowcounts AS SELECT       tvshow.idShow AS idShow,      MAX(files.lastPlayed) AS lastPlayed,      NULLIF(COUNT(episode.c12), 0) AS totalCount,      COUNT(files.playCount) AS watchedcount,      NULLIF(COUNT(DISTINCT(episode.c12)), 0) AS totalSeasons,       MAX(files.dateAdded) as dateAdded,       COUNT(bookmark.type) AS inProgressCount     FROM tvshow      LEFT JOIN episode ON        episode.idShow=tvshow.idShow      LEFT JOIN files ON        files.idFile=episode.idFile       LEFT JOIN bookmark ON        bookmark.idFile=files.idFile AND bookmark.type=1 GROUP BY tvshow.idShow
+/* tvshowcounts(idShow,lastPlayed,totalCount,watchedcount,totalSeasons,dateAdded,inProgressCount) */;
 CREATE VIEW tvshowlinkpath_minview AS SELECT   idShow,   min(idPath) AS idPath FROM tvshowlinkpath GROUP BY idShow
 /* tvshowlinkpath_minview(idShow,idPath) */;
-CREATE VIEW tvshow_view AS SELECT   tvshow.*,  path.idParentPath AS idParentPath,  path.strPath AS strPath,  tvshowcounts.dateAdded AS dateAdded,  lastPlayed, totalCount, watchedcount, totalSeasons,   rating.rating AS rating,   rating.votes AS votes,   rating.rating_type AS rating_type,   uniqueid.value AS uniqueid_value,   uniqueid.type AS uniqueid_type FROM tvshow  LEFT JOIN tvshowlinkpath_minview ON     tvshowlinkpath_minview.idShow=tvshow.idShow  LEFT JOIN path ON    path.idPath=tvshowlinkpath_minview.idPath  INNER JOIN tvshowcounts ON    tvshow.idShow = tvshowcounts.idShow   LEFT JOIN rating ON    rating.rating_id=tvshow.c04   LEFT JOIN uniqueid ON    uniqueid.uniqueid_id=tvshow.c12
-/* tvshow_view(idShow,c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,userrating,duration,idParentPath,strPath,dateAdded,lastPlayed,totalCount,watchedcount,totalSeasons,rating,votes,rating_type,uniqueid_value,uniqueid_type) */;
-CREATE VIEW season_view AS SELECT   seasons.idSeason AS idSeason,  seasons.idShow AS idShow,  seasons.season AS season,  seasons.name AS name,  seasons.userrating AS userrating,  tvshow_view.strPath AS strPath,  tvshow_view.c00 AS showTitle,  tvshow_view.c01 AS plot,  tvshow_view.c05 AS premiered,  tvshow_view.c08 AS genre,  tvshow_view.c14 AS studio,  tvshow_view.c13 AS mpaa,  count(DISTINCT episode.idEpisode) AS episodes,  count(files.playCount) AS playCount,  min(episode.c05) AS aired FROM seasons  JOIN tvshow_view ON    tvshow_view.idShow = seasons.idShow  JOIN episode ON    episode.idShow = seasons.idShow AND episode.c12 = seasons.season  JOIN files ON    files.idFile = episode.idFile GROUP BY seasons.idSeason,         seasons.idShow,         seasons.season,         seasons.name,         seasons.userrating,         tvshow_view.strPath,         tvshow_view.c00,         tvshow_view.c01,         tvshow_view.c05,         tvshow_view.c08,         tvshow_view.c14,         tvshow_view.c13
-/* season_view(idSeason,idShow,season,name,userrating,strPath,showTitle,plot,premiered,genre,studio,mpaa,episodes,playCount,aired) */;
+CREATE VIEW tvshow_view AS SELECT   tvshow.*,  path.idParentPath AS idParentPath,  path.strPath AS strPath,  tvshowcounts.dateAdded AS dateAdded,  lastPlayed, totalCount, watchedcount, totalSeasons,   rating.rating AS rating,   rating.votes AS votes,   rating.rating_type AS rating_type,   uniqueid.value AS uniqueid_value,   uniqueid.type AS uniqueid_type,   tvshowcounts.inProgressCount AS inProgressCount FROM tvshow  LEFT JOIN tvshowlinkpath_minview ON     tvshowlinkpath_minview.idShow=tvshow.idShow  LEFT JOIN path ON    path.idPath=tvshowlinkpath_minview.idPath  INNER JOIN tvshowcounts ON    tvshow.idShow = tvshowcounts.idShow   LEFT JOIN rating ON    rating.rating_id=tvshow.c04   LEFT JOIN uniqueid ON    uniqueid.uniqueid_id=tvshow.c12
+/* tvshow_view(idShow,c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,userrating,duration,idParentPath,strPath,dateAdded,lastPlayed,totalCount,watchedcount,totalSeasons,rating,votes,rating_type,uniqueid_value,uniqueid_type,inProgressCount) */;
+CREATE VIEW season_view AS SELECT   seasons.idSeason AS idSeason,  seasons.idShow AS idShow,  seasons.season AS season,  seasons.name AS name,  seasons.userrating AS userrating,  tvshow_view.strPath AS strPath,  tvshow_view.c00 AS showTitle,  tvshow_view.c01 AS plot,  tvshow_view.c05 AS premiered,  tvshow_view.c08 AS genre,  tvshow_view.c14 AS studio,  tvshow_view.c13 AS mpaa,  count(DISTINCT episode.idEpisode) AS episodes,  count(files.playCount) AS playCount,  min(episode.c05) AS aired,   count(bookmark.type) AS inProgressCount FROM seasons  JOIN tvshow_view ON    tvshow_view.idShow = seasons.idShow  JOIN episode ON    episode.idShow = seasons.idShow AND episode.c12 = seasons.season  JOIN files ON    files.idFile = episode.idFile   LEFT JOIN bookmark ON    bookmark.idFile = files.idFile AND bookmark.type = 1 GROUP BY seasons.idSeason,         seasons.idShow,         seasons.season,         seasons.name,         seasons.userrating,         tvshow_view.strPath,         tvshow_view.c00,         tvshow_view.c01,         tvshow_view.c05,         tvshow_view.c08,         tvshow_view.c14,         tvshow_view.c13
+/* season_view(idSeason,idShow,season,name,userrating,strPath,showTitle,plot,premiered,genre,studio,mpaa,episodes,playCount,aired,inProgressCount) */;
 CREATE VIEW musicvideo_view AS SELECT  musicvideo.*,  files.strFileName as strFileName,  path.strPath as strPath,  files.playCount as playCount,  files.lastPlayed as lastPlayed,  files.dateAdded as dateAdded,   bookmark.timeInSeconds AS resumeTimeInSeconds,   bookmark.totalTimeInSeconds AS totalTimeInSeconds,   bookmark.playerState AS playerState,   uniqueid.value AS uniqueid_value,   uniqueid.type AS uniqueid_type FROM musicvideo  JOIN files ON    files.idFile=musicvideo.idFile  JOIN path ON    path.idPath=files.idPath  LEFT JOIN bookmark ON    bookmark.idFile=musicvideo.idFile AND bookmark.type=1  LEFT JOIN uniqueid ON    uniqueid.uniqueid_id=musicvideo.c15
 /* musicvideo_view(idMVideo,idFile,c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,userrating,premiered,strFileName,strPath,playCount,lastPlayed,dateAdded,resumeTimeInSeconds,totalTimeInSeconds,playerState,uniqueid_value,uniqueid_type) */;
-CREATE VIEW movie_view AS SELECT  movie.*,  sets.strSet AS strSet,  sets.strOverview AS strSetOverview,  files.strFileName AS strFileName,  path.strPath AS strPath,  files.playCount AS playCount,  files.lastPlayed AS lastPlayed,   files.dateAdded AS dateAdded,   bookmark.timeInSeconds AS resumeTimeInSeconds,   bookmark.totalTimeInSeconds AS totalTimeInSeconds,   bookmark.playerState AS playerState,   rating.rating AS rating,   rating.votes AS votes,   rating.rating_type AS rating_type,   uniqueid.value AS uniqueid_value,   uniqueid.type AS uniqueid_type FROM movie  LEFT JOIN sets ON    sets.idSet = movie.idSet  JOIN files ON    files.idFile=movie.idFile  JOIN path ON    path.idPath=files.idPath  LEFT JOIN bookmark ON    bookmark.idFile=movie.idFile AND bookmark.type=1  LEFT JOIN rating ON    rating.rating_id=movie.c05  LEFT JOIN uniqueid ON    uniqueid.uniqueid_id=movie.c09
-/* movie_view(idMovie,idFile,c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,idSet,userrating,premiered,strSet,strSetOverview,strFileName,strPath,playCount,lastPlayed,dateAdded,resumeTimeInSeconds,totalTimeInSeconds,playerState,rating,votes,rating_type,uniqueid_value,uniqueid_type) */;
+CREATE VIEW movie_view AS SELECT  movie.*,  sets.strSet AS strSet,  sets.strOverview AS strSetOverview,  files.strFileName AS strFileName,  path.strPath AS strPath,  files.playCount AS playCount,  files.lastPlayed AS lastPlayed,   files.dateAdded AS dateAdded,   bookmark.timeInSeconds AS resumeTimeInSeconds,   bookmark.totalTimeInSeconds AS totalTimeInSeconds,   bookmark.playerState AS playerState,   rating.rating AS rating,   rating.votes AS votes,   rating.rating_type AS rating_type,   uniqueid.value AS uniqueid_value,   uniqueid.type AS uniqueid_type,   EXISTS(     SELECT 1     FROM  videoversion vv     WHERE vv.idMedia = movie.idMovie     AND   vv.media_type = 'movie'     AND   vv.itemType = 0     AND   vv.idFile <> movie.idFile   ) AS hasVideoVersions,   EXISTS(     SELECT 1     FROM  videoversion vv     WHERE vv.idMedia = movie.idMovie     AND   vv.media_type = 'movie'     AND   vv.itemType = 1   ) AS hasVideoExtras,   CASE     WHEN vv.idFile = movie.idFile AND vv.itemType = 0 THEN 1     ELSE 0   END AS isDefaultVersion,   vv.idFile AS videoVersionIdFile,   vvt.id AS videoVersionTypeId,  vvt.name AS videoVersionTypeName,  vvt.itemType AS videoVersionTypeItemType FROM movie  LEFT JOIN sets ON    sets.idSet = movie.idSet  LEFT JOIN rating ON    rating.rating_id = movie.c05  LEFT JOIN uniqueid ON    uniqueid.uniqueid_id = movie.c09  LEFT JOIN videoversion vv ON    vv.idMedia = movie.idMovie AND vv.media_type = 'movie' AND vv.itemType = 0  JOIN videoversiontype vvt ON    vvt.id = vv.idType AND vvt.itemType = vv.itemType  JOIN files ON    files.idFile = vv.idFile  JOIN path ON    path.idPath = files.idPath  LEFT JOIN bookmark ON    bookmark.idFile = vv.idFile AND bookmark.type = 1
+/* movie_view(idMovie,idFile,c00,c01,c02,c03,c04,c05,c06,c07,c08,c09,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,idSet,userrating,premiered,strSet,strSetOverview,strFileName,strPath,playCount,lastPlayed,dateAdded,resumeTimeInSeconds,totalTimeInSeconds,playerState,rating,votes,rating_type,uniqueid_value,uniqueid_type,hasVideoVersions,hasVideoExtras,isDefaultVersion,videoVersionIdFile,videoVersionTypeId,videoVersionTypeName,videoVersionTypeItemType) */;
oddstr13 commented 9 months ago

"Hate" is such a strong word...

There have been some DB changes involving the "movie versions" feature. I think it's plausible that this broke something on your side.

Well, I can't speak for other parties involved, but both me and @mcarlton00 … strongly dislike the fact that we're touching the DB. My dream scenario would be presenting Kodi with a virtual filesystem that it could scan, along with metadata. Not sure of how feasible that is with the current available facilities, or how much need to be changed in Kodi for something like that, however.

Anyways, I've been expecting that particular feature PR to break things for us for a couple of years now, it was only a matter of time.

@pdf Thanks for the diff, I'm sure it'll at least provide some pointers!

AmonFlorian commented 8 months ago

Basically what I see is: Kodi has now an option menu that lets you choose different versions of a file if they are found on scanning. The table "videoversiontype" is prefilled with 37 possible "versiontypes" as default - and can be filled with extra versions from id 40437 upwards. If Kodi gets a "hasVideoVersions" (if movieid is listed in videoversion-table) and user has enabled the option to choose what version to play (can be disabled to play a default version) then he gets a popup to choose from available versions of that type. See: https://kodi.wiki/view/Video_versions

@oddstr13 @mcarlton00 Doesn't Jellyfin already have similar "extracting" algorithms for emby-schemes? I ran up and down the last days but could only come up with the "VideoExtras" (e.g. behindthescenes, trailers, etc.).

Overall I think it's quite a neat Kodi feature - though I can't understand why the OpenSource-community can't go hand-in-hand but over on xbmc they go like "ye - they fiddle with our DB so it's their problem". Everybody could benefit from another way to get external sources into their views... :(

Would love to see that feature available on Jellyfin, too though. All the best - and if I can be of any help in any way. Feel free to give me a shout.

mcarlton00 commented 8 months ago

You're correct, Jellyfin already has version support for movies, and has had it since it started. Docs. And the addon has code to automatically handle that, so when you select something with multiple versions you should get prompted what version you want to play. However Kodi has now added a way to do that with just kodi, natively, and as a result the database schema has changed. Fortunately, this has the potential to simplify the playback code where we aren't going to have to check for versions when something is selected. Unfortunately, fixing this going forward also is going to mean breaking backwards compatibility with older kodi versions unless we do so carefully and have multiple different sql queries that get used in different versions. Such is life when we're piggybacking off another fully independent piece of software.

over on xbmc they go like "ye - they fiddle with our DB so it's their problem"

Yes, this was what I meant when I said we're not going to get a ton of help from upstream. The fact of the matter that this addon (along with plexkodiconnect and emby for kodi) function in a way team kodi explicitly says "you should not do this". Addons are not meant to interact with the database directly, and this situation highlights why. The recommended route is how jellycon, embycon, and other "dynamic" streaming plugins work, where they retrieve and display data from remote sources at the same time. Obviously those are a bit slower due to the extra processing time, but this is the tradeoff.

My dream scenario would be presenting Kodi with a virtual filesystem that it could scan, along with metadata.

@oddstr13 I've actually played with this a bit. It would be fairly trivial to just set up a directory with nfo files and strm files, however I believe this could turn into a significant impact on disk space for large libraries, especially if we include images (poster/fanart/backdrops/etc). The other part is that this still involves us making edits to $KODI_HOME/userdata/sources.xml manually, as last I checked there was no api endpoint to do so.

Orhideous commented 8 months ago

I believe this could turn into a significant impact on disk space for large libraries,

How significant this impact could be? I'm sure that aforementioned size can't be bigger than the size of the Jellyfin data directory (well, 10-15GB? 30?), and as for the large number of files... well, running the Kodi+Jellyfin addon on a half-dead SD card under RPi is definitely nonsense.

pdf commented 8 months ago

Would such an exported filesystem allow playback status sync though? I suspect not, right? That's the only reason I use the add-on right now since all my Kodi usage is local/direct via NFS. If there was an add-on option to only sync playback status instead of messing with the library DB for Direct mode, I would 100% use that.

mcarlton00 commented 8 months ago

@Orhideous A bit off topic for this issue directly, but since you asked:

From some quick searching through my library, I'm seeing 1-4Kb per nfo file. Strm file themselves are largely negligible (64 bytes on my testing file). Rough math and estimating out from there, ~200Mb for a library with 50,000 files in it? This is actually pretty straightforward and not at all unreasonable. It starts getting a lot more problematic if we include posters and other images there, which could be 100s of Kb each, and we start to imagine that size could begin to be a problem on low end devices. I don't remember for sure, but I believe Kodi would also then copy that image to it's internal directories. It's been quite a while since I used vanilla Kodi and looked into how it behaved. I know that we have some users running on things like Pis or Fire TVs where this storage capacity requirements could potentially become a problem. There's also some potential for performance issues based on number of files, but I don't know where these limits are in the real world and I'd need to do significantly more testing before this becomes anything more than a footnote in my wandering, mostly incoherent thoughts of how to improve things. Transcoding support is also a small concern, but I believe last time I spent any time in this rabbit hole I confirmed that Kodi will read plugin://plugin.video.jellyfin/ URLs ok so we could still have our own playback processing and still support anything we need to. This could all be a non-issue though, as I know we can embed URLs to posters in nfo files. Which naturally introduces another issue, because that requires either embedding an api key in the URL inside the nfo file (gross), or making the urls again use plugin://plugin.video.jellyfin/ URLs to route them through the plugin, which will naturally take longer to process than going to an image URL directly. And there's always the chance that the parser will get very unhappy about this.

Since I'm already on my soapbox of ridiculousness, a potentially cleaner solution would be to have our own sqlite database alongside Kodi's, along with a compatibility layer that would allow Kodi to see it as if a "normal" filesystem. There's multiple major hurdles and questions with this approach, though. The first is just the technical challenge to make a "virtual" filesystem that Kodi's parser is capable of reading. I suspect this would be challenging on it's own, without the added complications that it has to work on multiple different OSes (linux, windows, android, iOS, and now webOS). Assuming that's even possible, then we start getting into fun performance questions. Can we query a database, real time generate the xml needed for a nfo file, and hand it back to Kodi's parser in a fast enough way that this even makes sense to do? Of course, going this route means that we still have to deal with the whole database sync thing, which has it's own headaches. And if we can do this, then we can make the virtual filesystem hooks just pull directly from the Jellyfin server on demand instead of this sync nonsense, and at that point we've just re-implemented JellyCon with extra steps.

Thank you for coming to my TED Talk, I spend far too much of my time theory crafting stupid solutions to stupid problems. And all of these ideas are absolutely massive, fundamental reworks of how the addon functions, and I really haven't had a ton of time to devote to this particular brand of madness as of late.

Would such an exported filesystem allow playback status sync though?

@pdf One part of this is absolutely trivial and wouldn't change much at all from it's current implementation, one part is an interesting thought that would require some more research into what Kodi's official APIs offer. We don't read playback status from the database at all currently, we hook into the playback events to detect when things start and stop and what their position is. Updating playback status in the database from the jellyfin server is the part I'm unsure about currently, but it's obviously possible as it's effectively the entire basis of things like Trakt.

mcarlton00 commented 8 months ago

Reviewing the diff that @pdf provided and doing some preliminary digging, I'm pretty sure what needs to change is

https://github.com/jellyfin/jellyfin-kodi/blob/2e6eff9fb3f3ce756abf159855d1015fd0ed4e59/jellyfin_kodi/objects/kodi/queries.py#L286-L294 along with https://github.com/jellyfin/jellyfin-kodi/blob/2e6eff9fb3f3ce756abf159855d1015fd0ed4e59/jellyfin_kodi/objects/movies.py#L145 and https://github.com/jellyfin/jellyfin-kodi/blob/2e6eff9fb3f3ce756abf159855d1015fd0ed4e59/jellyfin_kodi/objects/kodi/movies.py#L49

The simplest way is simply going to be adding the extra fields to that query, possibly nulled? Not sure what's required yet to make it work because I don't have a functioning beta3 install. I still can't get kodi to build manually, and the flatpak version apparently hasn't been updated? Or I'm dumb and forgot the right commands. Either way, that should make everything work as it does now. If we want to utilize the new movie versions feature instead of the one built into jellyfin, it will obviously take more effort to sort through and put each version into the db separately instead of handling it at playback time.

However as mentioned, we need to have multiple queries so we can maintain backwards compatibility for those users who can't update to 21 right away, or are currently on stable. We've done this at least once before in https://github.com/jellyfin/jellyfin-kodi/pull/462/commits/0aa2e7132003b8ebf600b001d42e4fc00507d505 and can use that as a template.

AmonFlorian commented 8 months ago

Reviewing the diff that @pdf provided and doing some preliminary digging, I'm pretty sure what needs to change is

https://github.com/jellyfin/jellyfin-kodi/blob/2e6eff9fb3f3ce756abf159855d1015fd0ed4e59/jellyfin_kodi/objects/kodi/queries.py#L286-L294

along with https://github.com/jellyfin/jellyfin-kodi/blob/2e6eff9fb3f3ce756abf159855d1015fd0ed4e59/jellyfin_kodi/objects/movies.py#L145

and https://github.com/jellyfin/jellyfin-kodi/blob/2e6eff9fb3f3ce756abf159855d1015fd0ed4e59/jellyfin_kodi/objects/kodi/movies.py#L49

The simplest way is simply going to be adding the extra fields to that query, possibly nulled? Not sure what's required yet to make it work because I don't have a functioning beta3 install. I still can't get kodi to build manually, and the flatpak version apparently hasn't been updated? Or I'm dumb and forgot the right commands. Either way, that should make everything work as it does now. If we want to utilize the new movie versions feature instead of the one built into jellyfin, it will obviously take more effort to sort through and put each version into the db separately instead of handling it at playback time.

However as mentioned, we need to have multiple queries so we can maintain backwards compatibility for those users who can't update to 21 right away, or are currently on stable. We've done this at least once before in 0aa2e71 and can use that as a template.

Nope. Structure of movie table is the same: https://github.com/xbmc/xbmc/blob/master/xbmc/video/VideoDatabase.cpp

Difference is that you need (forcefully) the same movie in the videoversion-table so movieview works as intended. At least I think so. Will try some tinkering as I have Kodi 21 up and running. As "videoversion" table doesn't exist on Kodi <21b3 you could possibly go an "exists" route and write as needed or just cancel that.

AmonFlorian commented 8 months ago

Ok. At least I get a videolist on 21b3 now - adding "Standard version" for all movies added. Widget for "recently added" etc. not working as of now. Missing a "del videoversion" when removing a file. Will post a commit on my fork later and will try on Kodi 20.

Edit: nvm ... Widgets work as intended after a restart of Kodi 21b3.

AmonFlorian commented 8 months ago

@mcarlton00 Mind to give it a quick look? Works for me on Kodi 20.4 as well as Kodi 21 beta3.

https://github.com/jellyfin/jellyfin-kodi/compare/master...AmonFlorian:jellyfin-kodi:master

mcarlton00 commented 8 months ago

From a quick glance it seems fine, but I don't have time to test it for myself today. Feel free to open a PR with the changes, more likely to get more eyes on it that way.

chriswalken commented 8 months ago

@AmonFlorian thanks a lot for these changes. I tried them out and they are not working for me on an NVidia Shield 2017. I will try to dig in more in a few days but I wanted to give a heads up that I think more people need to test this before it goes in. I did the steps below multiple times, and I will also try this on a Linux desktop when I get back to this.

  1. Downloaded master
  2. Hand merged the changes (I did remove the whitespace errors but this shouldn't matter)
  3. Built
  4. Installed over top of the existing addon
  5. Reset the movie db from the jellyfin addon settings
  6. Restarted kodi - sometimes but not always making sure the db files was removed before restarting
  7. Synced the movie db

I still end up with no movies in the UI. I confirmed by looking at the MyVideos131.db file that the new videoversion table exists and has the same number of entries as the movie table. The logs show Kodi making the movie db query and getting back 0 items.

Thanks again and I can test any potential fix for this.

presterjohn13 commented 8 months ago

@AmonFlorian thanks a lot for these changes. I tried them out and they are not working for me on an NVidia Shield 2017. I will try to dig in more in a few days but I wanted to give a heads up that I think more people need to test this before it goes in. I did the steps below multiple times, and I will also try this in a Linux desktop when I get back to this.

  1. Cloned master
  2. Hand merged the changes (I did remove the whitespace errors but this shouldn't matter)
  3. Built
  4. Installed
  5. Reset the movie db from the jellyfin addon settings
  6. Restarted kodi - sometimes but not always making sure the db files was removed before restarting
  7. Synced the movie db

I still end up with no movies in the UI. I confirmed by looking at the MyVideos131.db file that the new videoversion table exists. The logs show Kodi making the movie db query and getting back 9 items.

Thanks again and I can test any potential fix for this.

I also tried this, on Nvidia Shield Pro 2019, with the same results.

I'm also happy to test anything. Unfortunately, I'm struggling to wrap my head around how this addon works, so testing will be my limits, I wish I could do more!

AmonFlorian commented 8 months ago

@chriswalken I didn't need to remove or tinker with the kodi-db manually. I just went with "repair database" from the addon. After changes were made I made sure to close Kodi once and after starting it up again, all movies were in as normal. I wonder what the Shield may do different. Did you shutdown Kodi once after step 7? Can you check the videoversion table and see if there are as many entries as there are in the movie-table?

presterjohn13 commented 8 months ago

@chriswalken I didn't need to remove or tinker with the kodi-db manually. I just went with "repair database" from the addon. After changes were made I made sure to close Kodi once and after starting it up again, all movies were in as normal. I wonder what the Shield may do different. Did you shutdown Kodi once after step 7? Can you check the videoversion table and see if there are as many entries as there are in the movie-table?

I wonder if I have somehow messed up moving your build from GitHub to my Kodi install. Are you able to upload a .zip and I'll try that?

AmonFlorian commented 8 months ago

You simply need to replace the three .py-files listed in the commit on your kodi install. No need to compile or anything.

chriswalken commented 8 months ago

@chriswalken I didn't need to remove or tinker with the kodi-db manually. I just went with "repair database" from the addon. After changes were made I made sure to close Kodi once and after starting it up again, all movies were in as normal. I wonder what the Shield may do different. Did you shutdown Kodi once after step 7? Can you check the videoversion table and see if there are as many entries as there are in the movie-table?

Yes I verified the videoversion table has the same number of entries as the movie table. Both tables look to be filled correctly (I see movie titles in the movie table, and the videoversion table has increasing IDs). Also in all cases I exited Kodi after updating the addon and resetting the DB within it. Sometimes I also killed the process after exiting (this is a nuace of the shield where processes can stay running in the background and you double tap one of the buttons and get a 'task switcher' view).

I didn't say this in my comment but the first way I tried this was just replacing the three files after hand merging the changes. When that didn't work I deleted the pyc cache and tried again, even though I did see the relevant pyc files had been updated. I only commented here after doing the full addon install.

Technically I still haven't ruled out my hand merging being the issue, so next I'll just replace with the updated raw files. The diff is tiny so I think it's unlikely I messed this up, but I do think I should rule it out completely.

Thanks again. I think I'll be able to run more tests tonight or tomorrow.

axionman commented 8 months ago

Hi, I just replaced the 3 files as told above and I confirm it now works on KODI 21 beta3. Thanks a lot !

chriswalken commented 8 months ago

@axionman if you don't mind me asking what platform are you on (windows, Android, etc)?

axionman commented 8 months ago

@axionman if you don't mind me asking what platform are you on (windows, Android, etc)?

Sorry, I run Kodi on a Nvidia Shield pro 2019, android TV

chriswalken commented 8 months ago

@axionman if you don't mind me asking what platform are you on (windows, Android, etc)?

Sorry, I run Kodi on a Nvidia Shield pro 2019, android TV

Thanks and very interesting. Maybe it is something I'm doing. I'll remove the jellyfin addon and start from scratch as a next step.

axionman commented 8 months ago

@axionman if you don't mind me asking what platform are you on (windows, Android, etc)?

Sorry, I run Kodi on a Nvidia Shield pro 2019, android TV

Thanks and very interesting. Maybe it is something I'm doing. I'll remove the jellyfin addon and start from scratch as a next step.

You're welcome. How I proceeded:

I downloaded the 3 files Moved them in their respective folders. Cleaned the libraray with Kodi option. Opened the jellifin for Kodi extension, and updated the library. Once the update was finished, the movies came back :)

presterjohn13 commented 8 months ago

@axionman if you don't mind me asking what platform are you on (windows, Android, etc)?

Sorry, I run Kodi on a Nvidia Shield pro 2019, android TV

Thanks and very interesting. Maybe it is something I'm doing. I'll remove the jellyfin addon and start from scratch as a next step.

You're welcome. How I proceeded:

I downloaded the 3 files Moved them in their respective folders. Cleaned the libraray with Kodi option. Opened the jellifin for Kodi extension, and updated the library. Once the update was finished, the movies came back :)

I tried those exact steps and I'm not having any success. However, it's a fresh install, I'm unsure if that would make a difference, though.

jbinkley60 commented 8 months ago

Each sharing solution is going to have to devise its own solution for working with the new Kodi Movie version feature, including the ones mentioned above and others. I have a test release for the Mezzmo Kodi addon which supports Kodi 21 beta 3 and the Movie Version feature but only to the point of things still working not taking advantage of the feature. Fortunately for me the only thing which broke was actor / actress information searches because Kodi leverages the Movie View internally so I had to populate the videoversion table to keep Movie View being created.

The first question each Kodi sharing solution developer is going to have to answer is how much of the Movie Version feature to support or just enough to keep the sharing solutions working because most, if not all, already have the same functionality, albeit implemented slightly differently. Like a number of Kodi features, including bookmarks, playcounters and similar, the management of the data being shared may still reside in the sharing solution and not within Kodi, to share across all clients.

In other words, a sharing solution may update the videoversion table to support the proper versions listed in the videroversiontye table but management of this may come from the sharing solution and not from a Kodi instance using the native Kodi management tools. Exceptions here might be sharing solutions which write directly to the Kodi / shared database directly from the native Kodi controls (i.e. MySQL). I can speak for Mezzmo in that there isn't a northbound native Kodi API to push changes from one client to another so I provide Mezzmo controls which allow this from every client via the Mezzmo Kodi addon. Each sharing solution will need to decide how to handle this.

Artwork support for Kodi Movie Versions will also need to be addressed since new entries are needed in the Kodi art table to support the Movie version artwork. This isn't a big deal but something else which needs addressed by each Kodi sharing solution.

AmonFlorian commented 8 months ago

@chriswalken I didn't need to remove or tinker with the kodi-db manually. I just went with "repair database" from the addon. After changes were made I made sure to close Kodi once and after starting it up again, all movies were in as normal. I wonder what the Shield may do different. Did you shutdown Kodi once after step 7? Can you check the videoversion table and see if there are as many entries as there are in the movie-table?

Yes I verified the videoversion table has the same number of entries as the movie table. Both tables look to be filled correctly (I see movie titles in the movie table, and the videoversion table has increasing IDs). Also in all cases I exited Kodi after updating the addon and resetting the DB within it. Sometimes I also killed the process after exiting (this is a nuace of the shield where processes can stay running in the background and you double tap one of the buttons and get a 'task switcher' view).

I didn't say this in my comment but the first way I tried this was just replacing the three files after hand merging the changes. When that didn't work I deleted the pyc cache and tried again, even though I did see the relevant pyc files had been updated. I only commented here after doing the full addon install.

Technically I still haven't ruled out my hand merging being the issue, so next I'll just replace with the updated raw files. The diff is tiny so I think it's unlikely I messed this up, but I do think I should rule it out completely.

Thanks again. I think I'll be able to run more tests tonight or tomorrow.

As soon as there are videoversions listed you should be fine. Is the ID "40400" listed in your videoversiontype as "Standard Edition"? Mind to send me your video.db privately?

chriswalken commented 8 months ago

In my opinion a first step for all sharing solutions would be to first just get the movie library displaying, which I think is what @AmonFlorian changes do. My Shield 2017 won't just install beta2 over beta3 which would have been a perfect short term solution for me since I don't want to reinstall Kodi. My main shield is a pro 2019 that got stuck in a weird state where the movies still display but the library is stuck at a point where it was a month or so ago, so not a showstopper there.

@AmonFlorian I don't really want to share the DB, at least not yet, but here's a screenshot showing what I think means it's populated correctly (I'm not at home right now but I did copy off the DB file yesterday).

chriswalken commented 8 months ago

Cropped picture because of the add that was showing:

markup_1000009627

squidrpi commented 8 months ago

Movies blank for me with the script changes and reset everything. Running on a RPi5 Libreelec nightly-20240302. I have no records in videoversiontype. videoversion count matches movie table.

AmonFlorian commented 8 months ago

In my opinion a first step for all sharing solutions would be to first just get the movie library displaying, which I think is what @AmonFlorian changes do. My Shield 2017 won't just install beta2 over beta3 which would have been a perfect short term solution for me since I don't want to reinstall Kodi. My main shield is a pro 2019 that got stuck in a weird state where the movies still display but the library is stuck at a point where it was a month or so ago, so not a showstopper there.

@AmonFlorian I don't really want to share the DB, at least not yet, but here's a screenshot showing what I think means it's populated correctly (I'm not at home right now but I did copy off the DB file yesterday).

Could you check the "videoversiontype" as well? Shouldn't be empty!

videoversiontype is pre-populated by kodi.

chriswalken commented 8 months ago

Movies blank for me with the script changes and reset everything. Running on a RPi5 Libreelec nightly-20240302. I have no records in videoversiontype. videoversion count matches movie table.

My videoversiontype is also created but has no rows.

Screenshot_20240303-135950

AmonFlorian commented 8 months ago

So strange - Kodi should prepopulate.

Try this @chriswalken and give me a shout.

INSERT INTO videoversiontype ( itemType, owner, name, id ) VALUES ( 0, 0, 'Standard Edition', 40400 );

Background: as it's a dirty fix to just have a movieview shown we should just need the one value used in this case.

jbinkley60 commented 8 months ago

Right now I am setting all movies to standard version, 40400, until this gets sorted out and I decide it I want to attempt sharing solution version nomenclatures to Kodi native Movie Version naming. I think I already know this answer but it could change.

squidrpi commented 8 months ago

INSERT INTO videoversiontype ( itemType, owner, name, id ) VALUES ( 0, 0, 'Standard Edition', 40400 );

Yes movies now show properly after inserting that record.

chriswalken commented 8 months ago

INSERT INTO videoversiontype ( itemType, owner, name, id ) VALUES ( 0, 0, 'Standard Edition', 40400 );

Yes movies now show properly after inserting that record.

@AmonFlorian I can also confirm this fixed the issue for me. Inserting this entry, copying the db back to the Shield, and restarting Kodi now has movies displaying!

Could this mean these changes are missing something in the addon DB reset code, or Kodi's beta2 -> beta3 upgrade scripts are missing something? I actually have a system I can poke around on. My Shield 2019 Pro that is stuck in that weird state where it works but it's on a snapshot of the movie DB ~1 month ago has only had the beta2 -> beta3 upgrade done. I haven't tried these changes on it yet. I actually didn't catch the Pro 2019 library weirdness before upgrading the Shield 2017 which 'fully' broke during its upgrade.

Thanks again for everything. It was quite a shocker when I hit this since it's a kodi-breaking issue. I was about to remove the addon and scan in the network share as a short term fix.

chriswalken commented 8 months ago

@AmonFlorian can you please tell me where you see a 'repair database' option. On both my Shields I'm only seeing a 'Reset local Kodi database' option in the jellyfin addon, which is what I did on my Shield 2017. I don't see anything with 'repair'.

Looking at my Shield 2019 movie database that was beta2 -> beta3 upgraded, has not had these jellyfin addon updates applied, and has since had several jellyfin syncs happen that don't appear in the UI (again movies display but all newer ones are missing).

It looks like:

  1. During the beta2 -> beta3 upgrade:

    • A videoversion table was created and populated with entries for each existing movie
    • A videoversiontype table was created and populated with 387 entries, of which only the 37 are non-blank (see below)
  2. Subsequent jellyfin syncs created movie entries but no videoversion entries (expected since these updates are not there)

I've now updated the jellyfin addon on the newer Shield but I haven't reset the database yet.

- Shield 2019's MyVideos131.db that hasn't been reset yet:

sqlite> select COUNT(*) from movie ;
X

sqlite> select COUNT(*) from videoversion ;
X - Y, where I'm guessing Y = <num movies added to jellyfin since beta2 -> beta3 upgrade>

sqlite> select COUNT(*) from videoversiontype ;
387

sqlite> select * from videoversiontype ;
40400|Standard Edition|0|0
40401|Extended Edition|0|0
40402|Unrated Version|0|0
40403|Uncut Version|0|0
40404|Remastered Version|0|0
40406|Theatrical Cut|0|0
40407|Director's Cut|0|0
40408|Special Edition|0|0
40409|Limited Edition|0|0
40410|Complete Edition|0|0
40411|The Final Cut|0|0
40412|Super Duper Cut|0|0
40413|Collector's Edition|0|0
40414|Ultimate Collector's Edition|0|0
40415|Criterion Collection Edition|0|0
40416|Fan Edit|0|0
40417|Black and White Edition|0|0
40431|10th Anniversary Edition|0|0
40432|20th Anniversary Edition|0|0
40433|25th Anniversary Edition|0|0
40434|30th Anniversary Edition|0|0
40435|40th Anniversary Edition|0|0
40436|50th Anniversary Edition|0|0
40437||0|0
40438||0|0
40439||0|0
<rest of the entries have format '<prev num +1>||0|0'>
AmonFlorian commented 8 months ago

The repair option I used might be just a translation thing as English is not my mother's tongue. Could be that it's "reset" in English. I will check that as soon as I'm free. The option used is listed under "Manage libraries/databases" (whatever it may be called in EN) though. What it does: delete everything from selected library, add library to Kodi db again.

The videoversiontype data you've posted is exactly what Kodi should populate (as I've mentioned in an earlier post).

On any videoversion-able Kodi each movie needs at least one entry in the videoversion-table as per movieview-query to be listed. In your case X<Y and X.idMovie exists in Y.idMedia at least once. Or sth line that.

Excuse me for not being of great help rn - a bit in a hurry. As there are other programming tasks I am bound to workwise I might or might not be able to dig deeper into that whole thing.

rraymondgh commented 8 months ago

I've tried PR out movies are now working

setup:

 $ gh repo clone jellyfin/jellyfin-kodi
 $ cd jellyfin-kodi/
 $ gh pr checkout 831

 # now on LibreElec box that has NFS mount to cloned GitHub repo
 $ rsync -av nfs/MyBook/jellyfin-kodi/jellyfin_kodi/ .kodi/addons/plugin.video.jellyfin/jellyfin_kodi

repair database

env:

LibreELEC (community): nightly-20240302-74b37e1 (RPi2.arm)
LibreELEC:~ # /usr/lib/kodi/kodi.bin -v
Kodi Media Center 21.0-BETA3 (20.90.830) Git:36c6d1449858c4d5fa3299af82ae3cf2341b3db3
Copyright (C) 2005-2021 Team Kodi - http://kodi.tv
chriswalken commented 8 months ago

Thanks again for the info. I've now found the repair option. It's in the jellyfin addon after you open it, 'Manage Libraries -> Repair libraries'.

Anyone seeing this, you need to repair the library via the option above after merging in these changes, NOT reset the database via the jellyfin addon settings. Resetting the database breaks it as the videoversiontype table is not restored afterwards. Even repairing a 'jellyfin addon reset db' doesn't fix it.

However, deleting a 'broken' MyVideos131.db file from disk and restarting Kodi does restore the videoversiontype table, and you can 'jellyfin repair' after that and it works. So there seems to be an additional update needed in the jellyfin addon DB reset code, but there also are clear steps to end up with a correct, working DB.

Thanks @AmonFlorian for the code and troubleshooting help, and everyone for the testing feedback.

squidrpi commented 8 months ago

However, deleting a 'broken' MyVideos131.db file from disk and restarting Kodi does restore the videoversiontype table, and you can 'jellyfin repair' after that and it works. So there seems to be an additional update needed in the jellyfin addon DB reset code, but there also are clear steps to end up with a correct, working DB.

Doesn't work for me. I always have to do a manual INSERT of the record to get it to work.

Easy in libreelec, "systemctl stop kodi", "sqlite3 MyVideos131.db", INSERT record, "systemctl start kodi"

chriswalken commented 8 months ago

However, deleting a 'broken' MyVideos131.db file from disk and restarting Kodi does restore the videoversiontype table, and you can 'jellyfin repair' after that and it works. So there seems to be an additional update needed in the jellyfin addon DB reset code, but there also are clear steps to end up with a correct, working DB.

Doesn't work for me. I always have to do a manual INSERT of the record to get it to work.

Easy in libreelec, "systemctl stop kodi", "sqlite3 MyVideos131.db", INSERT record, "systemctl start kodi"

Good to know, thanks. I only ran those steps once, on a Shield (so Android). It feels like the init of a fresh moviedb would be common code, possibly done early during startup, but in have no idea what Kodi does under the hood.

werran2 commented 8 months ago

hi guys. I got a TV version of 21.3, how to fix this issue for now as I could not edit any soucecode files?

pdf commented 8 months ago

hi guys. I got a TV version of 21.3, how to fix this issue for now as I could not edit any soucecode files?

Wait for this to be fixed completely, and for the add-on to be updated to support Kodi 21. Otherwise, downgrade to a stable version of Kodi (20.x).

chriswalken commented 8 months ago

hi guys. I got a TV version of 21.3, how to fix this issue for now as I could not edit any soucecode files?

Wait for this to be fixed completely, and for the add-on to be updated to support Kodi 21. Otherwise, downgrade to a stable version of Kodi (20.x).

You may be able to use a file manager like X-plore to replace the files. It's one of the ways I did it on the Android TV based shield.

mcarlton00 commented 8 months ago

Just an update for those not following the PR as well, I've confirmed that @AmonFlorian's change fixes the issue on a fresh sync on Kodi21 beta3 using a libreelec nightly built on a Pi. The downside, as several of you have found, is that it doesn't retroactively fix old entries, it only fixes new entries, requiring manual user action to fix the movie library. I'm working on an automated migration so this won't need to happen once the real release goes out. I have it mostly working with the caveat that it sometimes requires restarting Kodi to populate the home screen again, but others it seems to work fine. I haven't identified what the issue is here yet, and ultimately it's a fairly minor annoyance, but I'd like to get that sorted before pushing it up for further testing. Progress, but slow going. Thanks for your patience.