8000 Fix movies sync for Kodi 22 Piers by JeroenED · Pull Request #993 · jellyfin/jellyfin-kodi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Fix movies sync for Kodi 22 Piers #993

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JeroenED
Copy link
@JeroenED JeroenED commented Apr 21, 2025

Hi,

I created this pull request as I was suffering an issue with current kodi nightly. The problem seemed pretty easy to solve, however it is a problem on nightly and I am unsure if the problem will still be there when kodi piers will go stable.

Also, I feel the problem is pretty impactful, changing the type from a former version type to what used to be extras makes me feel you don't want to merge this for Omega.

Anyhow, this is what is fixing the issue for me on piers right now. It might tame the dragons before they go wild. Hope you want to merge it but no hard feeling if you take omega a priority.

Reference: https://forum.jellyfin.org/t-bug-when-using-current-kodi-nighly
Since kodi piers standard version is changed to 1.
Source from the MyVideosDatabase and https://github.com/xbmc/xbmc/blob/c0be4a8e34263cb939e453dbb4ce3430b46a458c/xbmc/video/VideoManagerTypes.h#L21
Extra reference: xbmc/xbmc@bc05180#diff-3e0425ad7a3f9835442da572adda9031febda02715ecac402eeb44a00579eb49R6675

@JeroenED JeroenED changed the title Update movies.py Fix movies sync for Kodi 22 Piers Apr 21, 2025
@oddstr13 oddstr13 added WIP Work In Progress - DO NOT MERGE blocked This item is blocked by another bugfix labels Apr 22, 2025
@oddstr13
Copy link
Member

This change will need version gating, and a separate migration step.

We also generally don't target nightlies, so this PR will have to wait until at least beta or rc, as that generally means things are starting to stabilize.


Looks like the database structure might be changing more substantially, but the migration seems to also be done in Kodi itself.

// renumber itemType to free the value 0 for nodes navigation
// former value 0 for versions becomes 1
// former value 1 for extras becomes 2

xbmc/xbmc@b01f67d...6ba797d#diff-3e0425ad7a3f9835442da572adda9031febda02715ecac402eeb44a00579eb49R6675

A new deep dive into Kodi internals may be needed for Piers release.

@JeroenED
Copy link
Author
JeroenED commented Apr 22, 2025

As I am currently on the latest nightly myself for another (non-jellyfin related) issue, I will keep this PR updated with changes required for piers. I use the capabilities of the plugin not on a daily basis but I easily see when something goes wrong. Also, you're not targetting nightlies which makes it not required that an issue is resolved on day 1.

Is this OK for you? Or is it better to create separate PRs for further changes?

@oddstr13
Copy link
Member
oddstr13 commented May 5, 2025

Yea, feel free to keep this branch up to date.
Try to keep different changes together in their own commits however, in case we end up wanting to split into multiple PRs anyways.

@@ -158,7 +158,7 @@ def omega_migration(self):

# Sets all existing movies without a version to standard version
for entry in self.cursor.fetchall():
self.add_videoversion(entry[0], entry[1], "movie", "0", 40400)
self.add_videoversion(entry[0], entry[1], "movie", "1", 40400)
Copy link
Member

Choose a reason for hiding this comment

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

Notes for later:
Needs separate migration step for Piers, see earlier comment.
May or may not actually need to do this migration, as looking at the Kodi source, the migration is supposed to get applied on upgrade.

Probably need a check for db version and two different queries for adding instead.

Copy link
codecov bot commented May 5, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 21.87%. Comparing base (1acddcc) to head (5c94481).
Report is 77 commits behind head on master.

Current head 5c94481 differs from pull request most recent head b87d191

Please upload reports for the commit b87d191 to get more accurate results.

Files with missing lines Patch % Lines
jellyfin_kodi/objects/kodi/movies.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #993   +/-   ##
=======================================
  Coverage   21.87%   21.87%           
=======================================
  Files          63       63           
  Lines        8686     8686           
  Branches     1411     1411           
=======================================
  Hits         1900     1900           
  Misses       6767     6767           
  Partials       19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Introduces a new migration step for Kodi versions 134 and above
by implementing the piers_migration method. This ensures all
existing movies without a version receive a standard version,
enhancing database consistency. Omega migration logic is now
limited to versions between 131 and 133.

No additional context provided.
@pdf
Copy link
Contributor
pdf commented May 31, 2025

A better option than just hard-coding the new (current) value for itemType might be to query the itemType from videoversiontype for id 40400.

Doing so will allow this to work across versions without needing multiple version-gated queries, and will support any future upstream migrations to the internal type mappings. It will also allow producing an error in the case that id 40400 ever disappears, so that we can know exactly what the problem is, rather than silently corrupting data again in future.

@Tualua
Copy link
Tualua commented Jun 2, 2025

Is there any way to build and install this version without waiting for approval?

@JeroenED
Copy link
Author
JeroenED commented Jun 2, 2025

@pdf Sounds indeed a better option. Will see what I can do.

@Tualua You can download the repo and replace all files in $HOME/.kodi/addons/plugin.video.jellyfin (this is the linux/libreelec path; I don't know the path for windows. I guess it's somewhere in %appdata%, but that's a wild guess)

JeroenED added 2 commits June 2, 2025 13:05
Updates migration to fetch version type dynamically from the database
rather than using hardcoded values, ensuring accurate mapping during
database upgrades. Refines video version insertion query to utilize
the correct item type from the version type table.

Helps prevent mismatches and enhances database integrity.
Omega and Piers don't have such xbmc.python version
Copy link
sonarqubecloud bot commented Jun 6, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This item is blocked by another bugfix WIP Work In Progress - DO NOT MERGE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0