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

Reimplement native mode to function client side #938

Merged
merged 5 commits into from
Nov 18, 2024

Conversation

mcarlton00
Copy link
Member

@mcarlton00 mcarlton00 commented Nov 13, 2024

I regret this already.

Fixes #936 and #937, supercedes #925 and #926.

Stores path replacement information in the data.json file. Users are prompted to enter path information after selecting native mode from the setup wizard, and have an additional "Manage path replacements" option inside of the addon itself. No limit as to how many replacements can be added. Haven't tested with direct NFS/SMB paths because I don't have any set up for it right now, but local path replacement seems to work as intended so no reason to expect they wouldn't.

2024-11-13_18-35-10

Realistically should have it's own custom menu screens to match the existing popup dialogs instead of the standard listitem selection/input screens, but after staring at the XML required for far too long I don't care enough to figure it out.

fixes #936
fixes #937
closes #925
closes #926

This comment was marked as outdated.

@it5c0z1mG
Copy link

You are truely amazing, this works perfectly! Smb native xbox app, how you managed to turn that around so quickly im baffled! I would love to buy you a pint or 2, amazing work!!

2 points to note

  1. After full library sync setting an alternate device name in the config settings doesnt take effect unless you also generate a new device id afterwards as before it was automatic, not an issue just to be noted for anyone else installing on a seperate device for testing.

  2. Where do the managed paths save to? as attempting to edit a mistake within the ui saves a new copy but doesnt remove the old one unless you reset the entire database and start again from step 1
    Where would i find a the file to edit manually via text editor or is a delete option for paths possible within the managed paths ui atall?

Again thanks you have outdone yourself

@mcarlton00
Copy link
Member Author

You found a logic error I made. Latest commit should fix the double entry error, and if you edit a path and leave either remote or local path empty it will clear it from the list.

The device name is expected behavior given how the whole login flow works.

@oddstr13 I'm not fixing that last linter complaint because it's dumb.

@pogora

This comment was marked as spam.

@oddstr13
Copy link
Member

Stupid or not, I've completely delegated Python formatting questions to the black formatter, and am now enforcing it for new PRs – it'll get auto-formatted in the way suggested the next time I save that file regardless.

I've been considering testing out a new formatter (which is supposedly faster while maintaining compatibility with black), but that discussion is off-topic for this PR.

@oddstr13
Copy link
Member

I've looked over the code and don't see anything obviously wrong.

@sundermann @marcovolpato00 @fcr Could you guys test this PR?

@fcr
Copy link

fcr commented Nov 14, 2024

I've looked over the code and don't see anything obviously wrong.

@sundermann @marcovolpato00 @fcr Could you guys test this PR?

@oddstr13 I've installed the changes and pointed to nfs paths as the local paths and the changes work fine. Note that I did not change any of my previous settings so the sync Playback mode is still "add-on (default)". Regardless, the Dual subtitles plugin was able to find the subtitles local to the video file and the video played flawlessly.

@mcarlton00 A huge thanks for your effort and patience.

@oddstr13
Copy link
Member

Note that I did not change any of my previous settings so the sync Playback mode is still "add-on (default)". Regardless, the Dual subtitles plugin was able to find the subtitles local to the video file and the video played flawlessly.

That is surprising, I would have expected you would need a full resync in native mode before anything like that changed.

@controversialfigure
Copy link

So, I've been using @sundermann version for the last few days without issue (from #926)
Tested @mcarlton00 version this evening. Started fresh (removed all database entries, removed plugin completely). Using NFS shares added in the Kodi file browser, and then mapped in the addon settings.

Everything seems to work as expected in my testing so far. Overall it feels much more performant again, especially compared to using the addon mode.

@it5c0z1mG
Copy link

Just tested and it hasnt been able to remove the previous entry,

Open kodi, wait for sync to complete, go to manage path replacements, click on the path p:p, edit both to t:t, click okay, both paths are now present and did not remove.

Added a log file, seem to show a few errors, i have no understanding of what it means though, hopefully you will,

This being said, if all it means is be careful not to mess up when adding them, its not a big deal,

Performance is the same if not better than before and now with it being client based i even take my jelly library offline and not stop playback, this is a vast improvement from before,

Thank you to everyone who fixed this, instead of removing it you gave it an upgrade!!

Thanks again!

kodi.log

@fcr
Copy link

fcr commented Nov 15, 2024

Note that I did not change any of my previous settings so the sync Playback mode is still "add-on (default)". Regardless, the Dual subtitles plugin was able to find the subtitles local to the video file and the video played flawlessly.

That is surprising, I would have expected you would need a full resync in native mode before anything like that changed.

I only need the direct access to particular paths in my libraries - those with foreign movies that require dual subtitles.
Hence I have never used "native mode". The Playback mode has always been set to "add-on", but in previous versions of Jellyfin (pre version 10,10), the direct paths have been populated where needed and it all worked.

The only problem that I encountered was that where videos on direct paths were watched, Kodi did not update the watched state of those videos. This problem still persists with the current situation so, perhaps it is connected to my not using pure native mode.

@kurosh
Copy link

kurosh commented Nov 15, 2024

Hi, when will this native mode workaround be available for Jellyfin4Kodi from the repo?

@controversialfigure
Copy link

The only problem that I encountered was that where videos on direct paths were watched, Kodi did not update the watched state of those videos. This problem still persists with the current situation so, perhaps it is connected to my not using pure native mode.

I think you’re right in this being related to your setup of using direct paths in addon mode.

It my testing with direct paths and using native mode, the watched status is reflected in Kodi and on the Jellyfin server.

@oddstr13
Copy link
Member

Hi, when will this native mode workaround be available for Jellyfin4Kodi from the repo?

When I am satisfied that it has been sufficiently tested, and have available time to do it.

So, get testing ;)

@Ulrar
Copy link

Ulrar commented Nov 15, 2024

I've installed it, using two NFS libraries and it seems to just work. Thanks !

@it5c0z1mG
Copy link

Proberley a stupid question, if i have this version installed before its released, will it auto update when its merged and realesed?

Sorry im new to github and not sure how it all works

@marcovolpato00
Copy link

Tried with my NFS share and works perfectly.

Hope it will be merged, thank you @mcarlton00 !

@oddstr13 oddstr13 added Native Mode Issue is related to Native playback mode needs-testing Some testing is requested/required before merging labels Nov 18, 2024
@hoewer
Copy link

hoewer commented Nov 18, 2024

I have tested your commits with FTP-based libraries (approx. 20 entries). Runs absolutely flawlessly.
I highly appreciate you work, @mcarlton00 !

@youhitgit
Copy link

Problems I have with native mode

  1. When items are deleted on the server they are not deleted from kodi
  2. When you have either a movie or a tv show episode that has 2 versions, you are not asked which version you want to play.

Using addon mode I don't have either of these problems.

Does anyone else have these problems or is it just me ?

@Ulrar
Copy link

Ulrar commented Nov 20, 2024

A note for anyone struggling, I had to hit reset database in the add-on settings and then resync to get rid of the file no longer available error, after making sure the add-on is in native mode

@Ejz85
Copy link

Ejz85 commented Nov 22, 2024

Hey!

I can't make this work with some of my SMB shares.. I spent 2 days now trying all different configs.

My setup:

NAS Synology docker Jellyfin server:

Volumes:
      - /volume1/Film2:/Film2:rw
      - /volume1/Mounts/Shows:/Shows:rw

So Movies is hosted on a drive on my NAS. Shared via SMB. This is working in kodi.
Shows is hosted on my Windows 11 PC also shared via SMB. This is not working. I mounted this on my NAS.
If I look at my libraries in Jellyfin dashboard, it says: /Shows

data.json looks like:

            "paths": {
                "/Shows": "smb://pc/Shows/",
                "/volume1/Film2/Movies": "smb://nas/movies/",
            }

"File is no longer available" is showing when trying to play something from the "Show".

@Ulrar
Copy link

Ulrar commented Nov 22, 2024

@Ejz85 did you reset your database in the kodi addon settings?
Also make sure you've added those smb shares in Kodi's file manager

@Ejz85
Copy link

Ejz85 commented Nov 22, 2024

@Ejz85 did you reset your database in the kodi addon settings? Also make sure you've added those smb shares in Kodi's file manager

I did reset about 20 times by now. ;)
Uhm, so maybe the problem is with the file manager. Like, I did add the SMB share and can play the files via the File manager.. But I didn't actually add each path to each shared SMB folder. But the thing is, I didn't add it like that for the ones that are working.. So that's why I'm a bit confused.

But yea I think I may have solved it now by adding them in file manager.

@Ulrar
Copy link

Ulrar commented Nov 22, 2024

I've noticed that as well, i had it partially working before I added both paths separately to the file manager and reset, which made all the files work reliably

@Ejz85
Copy link

Ejz85 commented Nov 22, 2024

Hm well it's actually still not working, I had to get some sleep last night. All my shares on my NAS works but none of the ones on my Windows 11 PC. And now they are added in file manager in kodi as well and that didn't make a difference.

@roninf
Copy link

roninf commented Nov 24, 2024

For me everythings seems to be working, except music, music files are never found when not played using the plugin itself.
And for me it seems that i cant change paths manually in the data.json, as soon as i do that the plugin seems to be broken.

@oddstr13
Copy link
Member

You must reset and re-sync the database after modifying the paths in data.json, as the mapping is used when syncing, and then the full path is stored in the database.

This is not a change from how native mode worked before, the only change is that you need to configure the path on the client, instead of on the server.

@fcr
Copy link

fcr commented Nov 24, 2024

My experience with native mode is similar to @roninf. Switching to "native" modeI I defined the native paths only for the video but left the music in Kodi as a local library since I prefer the Kodi metadata scrapers. After resetting and re-syncing the database, the video worked as advertised. However, when I tried to rescan the music library (that of course had been reset), Kodi went into an infinite loop.
So for now I use "add-on" mode with native paths for the video in order to get dual subtitles. It all works except that the video watched status is not passed on to Jellyfin.

@Ejz85
Copy link

Ejz85 commented Nov 24, 2024

I finally got it to work after 3 days. I had a few different problems, because I kept fixing one thing and then something else stopped working. At one point none of my Windows SMB shares were working but all my NAS ones did.. And then a day later I fixed some of the PC shares, but then some of my NAS shares didn't work.

But the main issue I was having was that I didn't add a / at the end of the remote path (the ones that comes first). This created the problem where kodi randomly added a / in some of my paths in the middle of a folder name.. For example, tvshowsdl became tvshows/dl/..

But in the end I didn't get the SMB shares to work again on my NAS so I finally just turned on NFS on my NAS and that worked instantly. And yes, I did reset and re-sync like a million times between every little change i made.

@roninf
Copy link

roninf commented Nov 24, 2024

You must reset and re-sync the database after modifying the paths in data.json, as the mapping is used when syncing, and then the full path is stored in the database.

This is not a change from how native mode worked before, the only change is that you need to configure the path on the client, instead of on the server.

I cant even reset the database after modifying the file, the addon does not start correctly. It wont even show up under running addons.

Something with the path for music is wrong in my case, the slashes are not set correctly no matter what the input is.
jf

I dont know where the "forward slashes" come from while backward would be correct.

Update:

Great got music files to work now, setting the path like "smb://nas/music".
And guess what... now movie files and series are not working anymore. I have changed nothing at all for movies though....

This is how it is setup now:

"/media/blurays": "\\diskstation\video\blurays",`
"/media/highdefinition": "\\diskstation\video\highdefinition",
"/media/highdefinition3d": "\\diskstation\video\highdefinition3d",
"/media/sdvideos": "\\diskstation\video\sdvideos",
"/media/serien": "\\diskstation\video\serien",
"/media/ultrahd": "\\diskstation\video\ultrahd",
"/music": "smb://diskstation/music/"

@sic6SaNdMaN
Copy link

sic6SaNdMaN commented Nov 25, 2024

Thank you to everyone who fixed this, instead of removing it you gave it an upgrade!!

Well I don't see this being an upgrade in any form, as I have to configure all of these path-replacements on all of my boxes and various installations.
Instead of having a configuration centralized on the server and just working for every client, the same configuration-process has to be done repeatedly on all clients.
That's a huge regression. Especially when you concern, how tricky those paths can be and that most of the clients are TV-boxes or Streamer-boxes and you have to enter all of these paths with a remote instead of a keyboard...
Sooo... no, not an upgrade, not an upgrade by any means at all.

BUT: Nonetheless I'm happy it exists. It surely can help, when direct paths are really needed.

@bitpixl
Copy link

bitpixl commented Nov 25, 2024

Just want to say thank you for reimplementing native mode 👍

Working great again (and faster compared to addon-mode).

@DaveMinion
Copy link

Can someone please provide a comprehensive tutorial, video or written, on how to actually set-up KOdi with JF in Native mode now as before it was dead simple and took no time and it, for me at least, worked fine. Trying to sort this out reading this Git and posting on the Kodi forum and I am conly confused and shocked seeing there is now a TON or work required to maintaine what was super simple and easy previoously, and still have no idea how to actually get the thing to work.

@DaveMinion
Copy link

Thank you to everyone who fixed this, instead of removing it you gave it an upgrade!!

Well I don't see this being an upgrade in any form, as I have to configure all of these path-replacements on all of my boxes and various installations. Instead of having a configuration centralized on the server and just working for every client, the same configuration-process has to be done repeatedly on all clients. That's a huge regression. Especially when you concern, how tricky those paths can be and that most of the clients are TV-boxes or Streamer-boxes and you have to enter all of these paths with a remote instead of a keyboard... Sooo... no, not an upgrade, not an upgrade by any means at all.

BUT: Nonetheless I'm happy it exists. It surely can help, when direct paths are really needed.

It sounds like something was "fixed" by making every aspect of this mode far more difficult, cumbersome, work intensive and difficult to understand. I don't spend hours and days reading every bit of info trying to work out minute issues, I know I have JF working on multiple lcal clients in Kodi using Native Mode, it was simple, easy and it WORKED. Now I haven't a clue how to get Native mode to work, it sounds like there's a ton of maintnence and configuration reruied for every client and nothing about it sounds pleasant. Add-on mode doesn't provide access to local Extras folders that are easy and simple to use in Kodi (unlike the built-in Kodi extra nonsense they've been trying to get working, poorly, for a decade) so losing that function because changes to JF for "reasons" is not making me happy. That you can't even paste into these file replacement path boxes in INSANE!.

@mouserad
Copy link

I am using Kodi on a Nvidia Shield and have a problem with the local path. Do I have to write the whole nfs path there (f.e. nfs://192.168.0.1/storage/video/movies) or is there a shorter version? In Kodi filemanager i have added this share with the name movies. Is this just a symlink or a real mount point and if whats the whole path? /mnt/movies for example doesnt work.

@sic6SaNdMaN
Copy link

sic6SaNdMaN commented Dec 13, 2024

It's a simple string replacement.
So if the local folder ON YOUR JELLYFIN SERVER is
/mnt/big_drive/Movies
then you have to replace it with
nfs://STORAGE-SERVER/big_drive/Movies
for example.
And because it is a simple string replacement, this can be shortened to:
/mnt => nfs://STORAGE-SERVER
because "/big_drive/Movies" is added afterwards anyways.

To find out your paths to your movies/series, use "Information" in Kodi on a Movie and navigate to the "refresh" button (I think) in the down left corner. Then the path to the file will be shown.
With that Info you can write the according path replacements.

Keep in mind that Kodi must have access to this path! Nothing changed here.

@mouserad
Copy link

Thanks for the information. When i write the whole path it is working. I was only searching for a shorter path because typing with my remote controller sucks 🤣

@sic6SaNdMaN
Copy link

I always use the shortest version and it works like a charm.
For me it's
/mnt/bind_mounts/Movies
=>
smb://rpi4/Movies
so the replacment is simply
/mnt/bind_mounts => smb://rpi4
that's all.

@sic6SaNdMaN
Copy link

Thanks for the information. When i write the whole path it is working. I was only searching for a shorter path because typing with my remote controller sucks 🤣

@mouserad If you have a Bluetooth- or USB-Keyboard than all Android devices will happily connect them and you can type paths (and or passwords etc.) much more easily. For longer setups with more information to hack in I always connect an external keyboard.
And if you don't have one: Having a cheap USB-Keyboard flying around is not the worst invest of a few bucks and a little extra space :)

@mouserad
Copy link

Thanks but i am naturally lazy😆 I usually work for longer texts with my android app and send texts to my kodi device but this time i was also curios how kodi handles the source paths.

@DaveMinion
Copy link

I am still completely lost. People are entering 2 different file paths? To what end? I have shared folders which contain multiple mounted drives that have sub-folders that sort movies. I have individual shared folders that contain sub folders which contiain movies. I have 12 shared drives with a main folder containing tons of TV shows folders. What "string" am I supposed to be entering. There has been nothing 'simple' about this. Before it was dead simple.

@sic6SaNdMaN
Copy link

So you have 12 different libraries defined in your jellyfin server?!

@DaveMinion
Copy link

What path are we supposed to be entering? Let's start there. Because this simple process is completely confusing. I have a library for Movies, one for TV Shows, one for Music Concerts, ooOne for Comedy Concerts, one for All Elite Wrestling, 2 different music libraries, ones for Movie Trailers, Videos, Cartoons and then 2 other movie libraries that I don't use within my Kodi clients. What path of the Kodi Add-on wanting entered from the Jellyfin server?

@sic6SaNdMaN
Copy link

In every library there must be configured the native path with which your jellyfin server does access the files.

Example:
Screenshot_20241214-013231_Jellyfin

This is the native path on the server.
This path normally isn't present on any client.
So the path has to be replaced with one, that the client can reach. Per smb or nfs, for example.

But you had to enter thise replacement-paths bevor the removal, too. Otherwise it would have never worked. So instead of entering these on the server in the libraries you now habe to enter them in Clents under path replacements.

And here is a final example.

If your directory structure on the server is sth. like this
/mnt/media/movies
/mnt/media/tv_shows
/mnt/media/music_concerts
...

and your server is reachable via smb, let's say at
smb://jellyfin-server
and the shares are like
smb://jellyfin-server/movies
smb://jellyfin-server/tv_shows
smb://jellyfin-server/music_concerts
...

than the path replacement would be
/mnt/media => smb://jellyfin-server

OR:
If you only have one share "media" and directories under it:
smb://jellyfin-server/media/movies
smb://jellyfin-server/media/tv_shows
smb://jellyfin-server/media/music_concerts
...

it would be
/mnt/ => smb://jellyfin-server
because "media" is present on both sides.

======

But you said you have shares.
So shares on rig1 (will call it NAS1) and rig2 (will call it NAS2) mointed on the jellyfin-server.
Like
Mounts from NAS1:
/mnt/smb_remote_mounts/movies
/mnt/smb_remote_mounts/tv_shows
Mounts from NAS2:
/mnt/smb_remote_mounts/music_concerts
...

Then you will have to have several path replacements.
Examples:
When the shares on NAS1 are
//NAS1/movies
and
//NAS1/tv_shows

=>

/mnt/smb_remote_mounts => smb://NAS1

If the shares are named completely different, like
//NAS2/public/media/goodstuff/best_concerts_ever

then you will need a replacement like this
/mnt/smb_remote_mounts/music_concerts => smb://NAS2/public/media/goodstuff/best_concerts_ever

The goal is always, that you replace the PATHES to your files (you can always replace the whole pathes), so that the client can find the files under the replacement path

Over and out on this.

@DaveMinion
Copy link

For my Movies library my sources are:

\MediaServer1\Movies 1
\MediaServer2\Movies 2
\MainPC\Movies 3

TV Shows are:

\MediaServer2\TV Shows\TV Shows 1
\MediaServer2\TV Shows\TV Shows 2
\MediaServer2\TV Shows\TV Shows 3
\MediaServer2\TV Shows\TV Shows 4
\MediaServer2\TV Shows\TV Shows 5
\MediaServer2\TV Shows\TV Shows 6
\MediaServer2\TV Shows\TV Shows 7
\MediaServer2\TV Shows\TV Shows 8
\MediaServer2\TV Shows\TV Shows 9
\MediaServer2\TV Shows\TV Shows 10
\MediaServer2\TV Shows\TV Shows 11

Concerts:

\MainPC\F\Concerts Music

\MainPC\F\Concerts Comedy

And thus like that. I am not new to Kodi and been using Jellyfin for a few years now. This entire process has only been confusing from the start.

@controversialfigure
Copy link

Do each of those shares represent a separate library in jellyfin with different content, or do you have multiple sources for a specific library?

For example:

…\TV Shows 1 through …\TV Shows 11 all mapped to a single TV show library.

or

…\TV Shows 1 mapped to TV Show Library 1, ….\TV Shows 2 to TV Show Library 2, etc.

@DaveMinion
Copy link

Yes each are lists of the various drives/folders that are grouped into the named library ie: Movies, TV Show,s Concerts ect.

My whole library is a mess right now though after trying to sort out some drive locations and now I figure I need to start from a fresh brand new install. Joy!

@roninf
Copy link

roninf commented Dec 16, 2024

I am having a weird issue as well though i am not sure that is related to the addon only.

When using native paths no matter what i do any movie started using the "Enter" Key directly from the movies library is shown as "no more part of the library" and won`t play.
As soon as i use the context menu (c) and choose play from here (external player) the movie plays just fine as expected.

Next weird thing is a movie shown up as new movie in a widget will play as well even if not using the context menu.

I could not figure out what exactly the issue is here...

@DaveMinion
Copy link

The entire add-on in Kodi is just completely borked for me now. Can't get it to do anything other that see my server and let my user account login. Can't add/manage libraries, and access any media, nothing. And that's using add-on mode not even trying to figure out the change to native mode. Nothing works. At all. Frustrated because this did work so easy and simple and awesome. And now. Nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Native Mode Issue is related to Native playback mode needs-testing Some testing is requested/required before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Native mode with Jellyfin Server 10.10 Wrong song url in "recently added albums"