Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic database migration for Kodi Omega #834

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

mcarlton00
Copy link
Member

Builds off of #831 to fix #808

Detects if the video database version is 131 or higher (Kodi Omega beta3) to trigger a migration. Sets all existing movies that are missing a version as a "standard" version like the original PR.

Also cleans up a few linter spacing complaints from the original PR that I missed during my review.

Copy link

sonarcloud bot commented Mar 7, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@oddstr13 oddstr13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a good idea to have a look at how Django handles database migrations.
I think it is similar to this, except migration version is tracked in a table, and there's some magic to detect modules which are migrations.

This looks good for now tho.

No complications introduced for Kodi 20 as far as I can tell, but I've yet to test migration from 20 -> 21.

I'd like to test the migration itself, but I don't have the opportunity for a few days yet, so if you feel like yolo merging and pushing out a release now, that is fine with me.

@mcarlton00
Copy link
Member Author

That was my initial plan, and the purpose of the version field in that jellyfin.db database. But trying to use that left me in an interesting problem where the migration would happen even if we weren't on the newest Kodi, and then when you did update Kodi it wouldn't run again. Ultimately that would end with us needing to keep a mapping of jellyfin db version, kodi version, and database versions to know when to trigger a migration and it would be a great big pile of not fun. Plus, I have half a plan to completely redesign the metadata scans before we have to do another one of these.

imo waiting for more testing is fine. First migration we've done like this, afaik, so testing is good.

@oddstr13
Copy link
Member

I can't seem to find actual packages of the Kodi RCs, and I can't be bothered to figure out how to build it.

I can still watch my series in Kodi 20 with this patch locally. 🤷‍♂️

@oddstr13 oddstr13 merged commit d1a5c98 into jellyfin:master Mar 20, 2024
9 checks passed
@kontell
Copy link

kontell commented Mar 25, 2024

Had Kodi beta 2 installed and updated the addon to v1.0.0. Updated Kodi to the latest RC and got the same behaviour as before, missing movie library.

kodi.log

On another Android device with Beta 2 installed I tried to add a movie library with V1 of the addon but it just stalled at the first movie, shows added fine.

kodi (1).log

Kodi mirror

@quixotic120
Copy link

quixotic120 commented Mar 25, 2024

also missing movie library with latest RC/coreelec and 1.0.0, same behavior as 0.7.12. can post log as well once I get home from work. tried cleaning libraries in kodi, fixing libraries and rebuilding libraries in plugin, no success, but I was able to add my movie library each time

edit: log after fresh boot, cleared library and scanned in with plugin. TVs, music videos, and music shares all appear but movies are empty.

kodi.log

more info on setup - kodi 21.0-RC2, running on an android device flashed with coreelec 21.0-omega_rc2, add-on mode, jellyfin server 10.8.13

also possibly of note - if i clean library in kodi settings/media after scan it claims media items from the plugin are unavailable and asks if i want to remove them. Once for items from "plugin://plugin.media.video.jellyfin/" then again for items from "plugin://plugin.media.video.jellyfin/f137a2dd..." If i remove the first my music videos and movie libraries are outright removed, my tv library is sort of removed where I can only browse it via the plugin. dynamic mode is unavailable for all libraries as the plugin thinks they're still loaded, they're just empty now. If i remove the second entry it just removes the music video library. There's also a very long delay, like 1-2 minutes long, to access the plugin library after cleaning the library via kodi's menu

if i remove the library I can still access and play my movies via dynamic mode although this is slow to load

@mcarlton00
Copy link
Member Author

Logs aren't helpful in this case. On @kontell's first log and @quixotic120 log, they both indicate the migration ran without errors. @kontell's second log the migration never ran, because it's not an upgrade at that point, it's a fresh sync. And also no errors that I can see. And of course, I can't replicate the issue on my desktop or on a libreelec nightly build.

If you want to know if this is the same issue, you need to look in the videoversions table of the database. If it's populated, then it's not related to this PR and is something completely different.

"Clean library" has never worked, and will never work in the addon's current design. This is a very longstanding issue because we're doing what the Kodi devs explicitly say not to do and it can't be helped. Don't click that button. If you need to modify Jellyfin things in the database, go through the addon.

Lastly, if you're continuing to have an issue, please go to the actual issue and don't spread information across multiple places. Especially as this PR wasn't even what actually fixed said issue and simply made a migration for the fix somebody else implemented.

@mcarlton00 mcarlton00 deleted the omega-migration branch March 27, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Movies are empty with latest Kodi
4 participants