Bug 16188 - scanner effectively removes custom protocol URLs from scanned playlists
: scanner effectively removes custom protocol URLs from scanned playlists
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Scanner
: 7.5.x
: All All
: P3 normal with 4 votes (vote)
: 7.6.0
Assigned To: Andy Grundman
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-06 20:43 UTC by Peter Watkins
Modified: 2011-01-24 11:51 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
simple fix -- main app writes CSV file with all registered handlers that scanner references (2.67 KB, patch)
2010-05-07 16:09 UTC, Peter Watkins
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Watkins 2010-05-06 20:43:47 UTC
I created a plugin that provides two new protocols. The protocols work fine with the Tune In URL feature in the web interface, and can be saved to playlists from within the SBS Web interface.

But if you request a full rescan, the scanner process does not recognize the custom protocols and ignores the lines in the M3U playlist that refer to those URLs. The end result is that after the playlist is rescanned, the custom URLs are effectively dropped from the playlist.

This is better than what's described in bug 6721 but still a huge problem for anyone trying to implement a new protocol that a user might wish to embed in a playlist.

I think the key problem here is that the scanner runs in a separate process, so it has no access to the list of protocol handlers registered with the main server. There needs to be some sort of interprocess communications to let the scanner know what the valid protocols are rather than hard-coding 6 specific protocols in scanner.pl

Probably scanner.pl should make JSON/Comet requests of the main process to populate the @handlers array that's currently hard-coded, though other approaches could work (the main process could maintain information in the database or a file in the cache directory).
Comment 1 Peter Watkins 2010-05-06 20:51:40 UTC
To make this more clear, with the SBS web UI I can build a playlist like

/music/someartist/somealbum/track1.mp3
/music/someartist/somealbum/track2.mp3
squeezecli:p0=mixer&p1=volume&p2=%2B20&title=Turn%20the%20volume%20up
/music/anotherartist/anotheralbum/track0.mp3

and it plays & saves fine. I can even use the songinfo.html pane to view metadata about the squeezecli: URL. But after a full rescan, all I see in the web UI is

/music/someartist/somealbum/track1.mp3
/music/someartist/somealbum/track2.mp3
/music/anotherartist/anotheralbum/track0.mp3

because the scanner didn't recognize the squeezecli: URL. And if I play the playlist after a rescan, the squeezecli: URL is not played, even though the line *is* present inthe M3U and *is* a protocol recoognized by SBS.
Comment 2 spedlists 2010-05-07 06:58:01 UTC
I'm pretty sure this must be the same issue as 16141 ( Napster playlists empty after library rescan  )
Comment 3 Peter Watkins 2010-05-07 16:09:36 UTC
Created attachment 6824 [details]
simple fix -- main app writes CSV file with all registered handlers that scanner references

This fixes bug 16188 for me, and I expect it will also fix bug 16141.

With this patch:
 - the main SBS maintains a file called "handlers.txt" in the cache dir listing all registered protocols except http, file, playlist, and db. This file is updated every time a protocol is registered. Typically it looks like

source,napster,classical,lfm,sirius,icy,mediafly,loop,randomplay,live
365,deezer,queen,spdr,rhapd,pandora,slacker,rtsp,linein,mms

 - the scanner process loads the list of protocols from handlers.txt instead of using a hard-coded list

As a result, all registered protocols -- including newer protocols from core SBS code like napster and 3rd-party protocols -- are recognized by the scanner and their lines left intact when scanning playlists.
Comment 4 Alan Young 2010-05-14 02:17:52 UTC
*** Bug 16218 has been marked as a duplicate of this bug. ***
Comment 5 Peter Watkins 2010-07-13 20:02:28 UTC
Andy, if you would like me to take a different approach in fixing this bug, please let me know. I know this patch is pretty simplistic, but fewer lines of code means lower probability of regressions, right? :-)
Comment 6 spedlists 2010-08-16 12:07:53 UTC
I think there could be a two-phase fix on this one.  A very low-risk fix would be to simply add a few of the "known" protocols to the code (especially Napster for me!).  Then somewhere down the line Peter's more elegant fix could be incorporated?
Comment 7 Philip Meyer 2010-08-30 12:35:07 UTC
I think this is a duplicate of a bug report I made over 2 years ago:

https://bugs-archive.lyrion.org/show_bug.cgi?id=8874
Comment 8 SVN Bot 2010-09-05 07:41:43 UTC
 == Auto-comment from SVN commit #31287 to the slim repo by adrian ==
 == http://svn.slimdevices.com/slim?view=revision&revision=31287 ==

Bug: 16188
Description: ensure the scanner knows about all remote protocols which are handled by protocol handlers in the main server, but not loaded in the scanner process, check urls when scanning M3u playlists so that remote tracks in stored playlists are retained
Comment 9 Peter Watkins 2010-09-08 18:43:22 UTC
Adrian, my initial testing looks good. I'm getting some weird little scan errors (and some database is locked errors) in the log file, but I'm pretty sure they're due to problems with my ProtocolHandler implementation and unrelated code issues. Still, I'm leaving status as NEW for now, since I'm not certain.

The important thing is that SBS 7.6 with your patch *is* retaining my custom protocol URLs and the napster: URLs mentioned in bug 16141.

Thanks, Adrian, for the commit, and Andy for blessing it.
Comment 10 Alan Young 2011-01-24 00:21:37 UTC
Andy, this is fixed now, right?
Comment 11 Andy Grundman 2011-01-24 11:51:12 UTC
Yep, thanks everyone.