-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Directstream MusicLibrary Support #159
Conversation
Added music library files through a redirection in .strm files instead of a direct link to the plex server (giving issues with music scraper) or direct link to plugin (not allowed by kodi) Basically; to the same as for movies but now through .strm files which are saved in the addon_data folder. Though, this wasn't a simple task. First of all the scraper was deleting files if it couldn't verify their integrity (which it couldn't because a .strm is not a music file for the scraper). Therefore the directory is not told to the scraper, but instead the absolute path is parsed as filename and the dir set to ''. Because this path is usually followed for video files, some breakout were installed for correct function.
The check if the audioplugin existed was incorrect - fixed The plugin directly called the playurl on the second attempt, this was incorrect and caused metadata bugs. It is now correctly calling itself.
I'm closing it for now to work out the bugs. |
I was just writing you back! It was looking awesome! :-) Any show-stopper bugs? |
It's just the playlist / albums that don't seem to work that is most annoying. In the current implementation this works fine, and is thereby more functional. In case a single item is played, it works fine though. But when you try to play more than a single song or queue a song, for some reason it tries to parse a single file as a directory and fails:
I'm wondering what causes it, because "musicdb://albums/1/14.strm?albumid=1" can be played back without issues. So the big question is now, why is it parsing it as a directory? Actually, a little testing showed that .strm, .m3u and .pls files are all parsed as directory when you trying to queue them, and that is independent on if they are in the music library or not... |
From what I can tell now, is that this is a bug on how kodi queues playlist files... I tried to go through the source code of kodi, and the queue seems to be initiated from this file: The class function |
An update on this Pull Request; the suggested method of using .strm files might work to overcome the scraper giving errors of not being able to scrape the files on the plex server. There is one issue though, and that is that nothing can be queued and only single items can be played. This is caused by a bug in Kodi, which tries to parse playlist files as a directory and fails. I've opened a Pull Request at xbmc/xbmc#11175, and hope team Kodi will fix this bug before the release of version 17.0. I haven't found any useful detours yet to circumvent this bug. So until then, I don't consider this method useful as you can't play more than a single song at a time with it. A different method to tackle this issue might be by making the library in the add-on instead of injecting it in the library of Kodi. I mean by that; parsing it in the same way as the current implementation of the photo add-on. |
Hey @Memesa, that looks great, thanks for the update! I hope the Kodi team will merge your pull request |
@Memesa, can you drive the discussion on the Kodi side? See xbmc/xbmc#11175 |
Well the Kodi PR has merged. For something else I am looking at it, can you tell me if you are expecting Kodi to process the metadata tags from streams? Many addons do it themselves. And there is the suggestion that Kodi could stop passing internet streams to TagLib for efficiency (rather than trying to read tags we know aren't there, or read them but not use them). Would that impact your work? |
Very nice! :-) I don't think PKC needs Kodi to process stream metadata. It will pull all the relevant metadata information either from the Kodi music db directly or from the Plex Media Server. |
@DaveTBlake Kodi does try to process the metadata tags from (music) streams, and obviously fails. This leads to the many errors people are seeing and Kodi unable to shut down. I guess for many addons that unofficially modify the database, removing parsing of internet streams would make Kodi more stable when having these addons installed. (I'm assuming you call internet streams direct links instead of .strm files) The PR I sent in was based on a bug I found when trying to circumvent the use of internet streams, by using plugin:// links in .strm files (quite a funny thing that this does work..). These .strm files inserted in the database will be parsed for metadata though and the parser then removes the entries from the library because of the lack of metadata. This can be fixed again by putting the .strm files in a path that is excluded from library scans (set through advancedsettings.xml). The ideal way for the PlexKodiConnect addon to work would be that plugin:// files are accepted from the music library screen and that the music parser does not remove or try to read their metadata. |
Since https://github.com/xbmc/xbmc/pull/11175 has been released in 17.1-RC1 |
I haven't started on testing the implementation on 17.1-RC1 yet. There is also another change I would like to add to circumvent the library from removing the files again. But of course, you could try to see what happens if you apply them locally and if it doesn't work as expected revert to the original. |
@Memesa |
@croneter I tried to rebase this PR into the current pkc version some weeks ago, and noticed you changed quite a lot on the queuing commands. It looks much cleaner now, but I should dive in more to get this PR functional. So feel free to try. Another thing is that in this PR, the way to hide the .strm files from the scraper is by setting the wrong directory. This is not a long lasting method, after playing a music file the directory will be added to the scanned directories and the files removed. A better way to do this is by setting the files correctly with directory and file in the database, and subsequently set the folder in the excluded directories in advancedsettings.xml (http://kodi.wiki/view/advancedsettings.xml#audio). It is also much less hacky. When I'm home I could post the code I've used (though I haven't made it automatically add the dir to as.xml, was part of my to do. |
@Memesa Concerning the last paragraph: |
Directstream Musiclibrary has been requested by several people and listed bugs (#14 and #21) that it kind of breaks kodi now. I had a try at implementing this feature.
When the same method is used as for movies; that is, directing the library path to the corresponding plugin. This doesn't work for the music library as it doesn't allow launching a plugin from the library.
This can be circumvented by using .strm files, these are picked up and can be used to redirect the music entry to the pkc plugin.
The current method is to generate .strm files in addon_data/pkc/musicstreamfiles/dbid.strm with the pkc entry (e.g. plugin://plugin.video.plexkodiconnect.music/?dbid=1&mode=play&id=20182) and start these instead. Some optimizations had to be added to the script to take music files into account.
key features:
For now tested on Windows, Kodi 16.1 using NAS PMS (synology 1.3.2.3112) or Windows PMS (1.3.2.3112).
Some bugs still need to be fixed: