Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
You know how when you've been working on a problem for a long time, going down one rabbit hole after another, until you reach a point there in the weeds where you decide to just clean up, simplify, and start over? That's where I was this morning. I started out researching the 'extended m3u' (https://en.wikipedia.org/wiki/M3U#Extended_M3U) format which is what LMS uses to help me understand how it works. I also had LMS clear and rescan the whole library, and changed the foobar2000 library url from the server IP address to the server NAME which is the way LMS seems to prefer it - so now they're identical. When you save a playlist in foobar2000, you have the option of .m3u or .m3u8, the latter encoded with UTF-8. When I initially saved a playlist as .m3u, foobar warned that it may not play correctly in some players. In the beginning, I tested both formats and the non-ASCII character issue occurred in both. That was then. That's no longer the case. After the clean-up above, LMS seems to like the .m3u version just fine. I created a "Remasters.m3u" playlist and LMS found and loaded all 10,539 tracks without a hitch - a playlist replete with foreign albums and non-ASCII characters. I'm not sure what the exact problem was, but it appears to be gone. So I'm feeling kinda sheepish now wasting everyone's time on this. At least I learned a coupla things about playlists and python - plus I have a nice new interface to play with (extGUI4LMS). Thanks everyone, and please accept my apologies for your trouble. eCo's Profile: http://forums.slimdevices.com/member.php?userid=4408 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
eCo wrote: > If I use the LMS advanced search tool, I can build the playlist within > LMS in a reasonable time entering the terms mentioned above > one-at-a-time. But then I end up with a large number of duplicate > entries since there's considerable overlap between the searches. Not sure if this will work, and not sure how slow it would be as I've never created such a large playlist, but MaterialSkin can remove duplicates from playlists. This is done by using the track's title - so if you have multiple tracks with the same title, this would fail. Might be worth a try. To use: navigate into your list of playlists, and select "Remove duplicates" from the specific playlist's context menu (use the three dotted button the the right of each item). *Material debug:* 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here. cpd73's Profile: http://forums.slimdevices.com/member.php?userid=66686 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
As promised, here's my old script which still works perfectly to prepare a playlist for LMS. It reads a full directory of m3u files and modifies/copies all of them into a directory MODDED so the originals are untouched. I keep all my files for tagging purposes on a Win 10 machine. My LMS is on a Ubuntu machine with an external HD so the file paths are modded by this script from Win to Linux as a bonus - you may not need this kind of thing. The main thing is the call to *uri_escape_utf8($line, "\x00-\x1f\x7f-\xff");* which escapes all control chars and hi-bit chars. I'm not sure if my BOM character << print OUT ""; #BOM >> will survive being posted on the forum but there is a BOM marker in there that displays correctly in VS Code. Code: #!/bin/perl # Modifies a playlist to URI-escape control and hi-bit characters for LMS # (c) philchillbill 2012 use URI::Escape; use locale; my $c = 0; my @files = glob "*.m3u"; my $p = scalar(@files); mkdir('MODDED'); # my $original = "D:\\My Music\\"; my $target = "file:///seagate/music/"; foreach my $file (@files) { open(IN, $file); @lines = ; chomp(@lines); close(IN); my @processed = (); foreach my $line (@lines) { $line =~ s/^\Q$original\E//; $line=~s|\\|/|g; if ($line =~ /^#/) { $line =~ s/(#EXTINF:\d+,)/\1 /; } else { $c++; my $modified = uri_escape_utf8($line, "\x00-\x1f\x7f-\xff"); $line = $target.$modified; } push(@processed, $line); } my $mfile = '.\\MODDED\\'.$file; open(OUT, '>', $mfile); binmode(OUT, ":utf8"); print OUT ""; #BOM print OUT "#CURTRACK 0\n"; foreach my $line (@processed) { print OUT "$line\n" }; close(OUT); } print "\nFinished. Processed $c songs in $p playlists\n"; sleep 2; philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
eCo wrote: > if added fewer at a time, it wouldn't save the final playlist showing > "error saving playlist LP_Rips "error"". Perhaps it's a resource > limitation. > Unfortunately, this seems to be the case. LMS doesn't accept such requests: "Failed to load resource: the server responded with a status of 414 (Request-URI Too Large)" > > I also noticed it was throwing in albums in the search results that > seemingly had nothing related to the search terms. Finally, the search > term strings ignored spaces and case. I use RM as an abbreviation for > remastered, so in foobar2000 I can search for the string " RM " with > high specificity. But this editor would ignore the spaces and case > sensitivity to match album titles with "rm" anywhere in the string > pulling in many unwanted titles. > LMSplaylistEditor uses LMS' search, so the plugin can't really change this behaviour. > > I had high hopes for the python script, but after I figured out the > syntax, it would only respond "Invalid playlist format (First line: > ...". That's irritating since the format is what I want it to fix. > That's a bit strange. Check the first line of your m3u file - it should be #EXTM3U anyway, you can change the script to accept any encoding by changing line 394 from: Code: elif args.subparser_name == 'fixm3u': tracks = parsem3u( args.infile, check_files = True) to Code: elif args.subparser_name == 'fixm3u': tracks = parsem3u( args.infile, check_files = True, file_encoding="utf-8") where file_encoding can have any value listed 'here' (https://docs.python.org/3/library/codecs.html#standard-encodings) 'Various SW' (https://www.nexus0.net/pub/sw/): Web Interface | TUI | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | DB Optimizer | Image Enhancer | Chiptunes | LMSlib2go | ... 'Various HowTos' (https://www.nexus0.net/pub/documents/LMS/): build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ... Roland0's Profile: http://forums.slimdevices.com/member.php?userid=56808 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
eCo wrote: > I could see when comparing files that that's what needs to be done, but > I have little coding experience and none of it's in Perl. I'll post my script tomorrow. It's very simple but you would need to have that URI::Encode module installed - maybe it's part of the standard LMS install. Are there any other languages you are familiar with or at least already have installed? A Python3 version should also be pretty easy: >>> from urllib.parse import quote >>> quote('/test') '/test' >>> quote('/test', safe='') '%2Ftest' >>> quote('/El Niño/') '/El%20Ni%C3%B1o/' philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
philchillbill wrote: > I just used the *uri_escape_utf8( $string )* function from the Perl > URI::Escape module in my little script. Normally URI escaping is > associated with the likes of converting spaces to %20 and such, but you > can also escape e.g. umlauts using this function. > > For example, Tiësto becomes Ti%C3%ABsto which is a pure ASCII > representation that may better survive moving from one OS/platform to > another. I could see when comparing files that that's what needs to be done, but I have little coding experience and none of it's in Perl. eCo's Profile: http://forums.slimdevices.com/member.php?userid=4408 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
Roland0 wrote: > You can try using the 'LMS Playlist Editor' > (https://www.nexus0.net/pub/sw/lmsplaylisteditor/), which will remove > existing tracks from the playlist if they are added again. > The 'm3u_tool' (https://www.nexus0.net/pub/sw/misc/m3u_tool.py) Python > script has a "fixm3u" operation which you could try on your playlist > before importing it I gave both of these approaches a shot, but alas, no joy. I did like your GUI mod and playlist editor, but they both had issues in my case. I suspect it's a matter of scale as I'm dealing with lots of albums. The problems I encountered in the LMSplaylistEditor were: 1) It wouldn't add a large number of albums to a playlist at a time; and, 2) if added fewer at a time, it wouldn't save the final playlist showing "error saving playlist LP_Rips "error"". Perhaps it's a resource limitation. I also noticed it was throwing in albums in the search results that seemingly had nothing related to the search terms. Finally, the search term strings ignored spaces and case. I use RM as an abbreviation for remastered, so in foobar2000 I can search for the string " RM " with high specificity. But this editor would ignore the spaces and case sensitivity to match album titles with "rm" anywhere in the string pulling in many unwanted titles. I had high hopes for the python script, but after I figured out the syntax, it would only respond "Invalid playlist format (First line: ...". That's irritating since the format is what I want it to fix. I played with BOM and encoding in the foobar playlist file to no avail. Anywho, thanks for the suggestions. I'll keep playing with the editor to see if I can come up with something in time. I'll also see if I can find a plugin for foobar2000 for different export formats. Perhaps that will appease either LMS or the m3u_tool. eCo's Profile: http://forums.slimdevices.com/member.php?userid=4408 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
eCo wrote: > Foobar2000 saves the playlist as DOS/Windows & UTF-8. I've used > Notepad++ to convert this file to 'UNIX' with BOM, as this is what LSM > creates, but it didn't solve the issue. Perhaps it's not formatted > correctly? I can up a small example file tomorrow if that would be > helpful. I just used the *uri_escape_utf8( $string )* function from the Perl URI::Escape module in my little script. Normally URI escaping is associated with the likes of converting spaces to %20 and such, but you can also escape the likes of umlauts using this function. philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
eCo wrote: > > Saving a playlist with these same sources works fine when created within > LSM. If I use the LMS advanced search tool, I can build the playlist > within LMS in a reasonable time entering the terms mentioned above > one-at-a-time. But then I end up with a large number of duplicate > entries since there's considerable overlap between the searches. This > makes the playlist unnecessarily large, and the duplicated albums > (sometimes three & four times) would be played back too frequently. > You can try using the 'LMS Playlist Editor' (https://www.nexus0.net/pub/sw/lmsplaylisteditor/), which will remove existing tracks from the playlist if they are added again. The 'm3u_tool' (https://www.nexus0.net/pub/sw/misc/m3u_tool.py) Python script has a "fixm3u" operation which you could try on your playlist before importing it 'Various SW' (https://www.nexus0.net/pub/sw/): Web Interface | TUI | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | DB Optimizer | Image Enhancer | Chiptunes | LMSlib2go | ... 'Various HowTos' (https://www.nexus0.net/pub/documents/LMS/): build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ... Roland0's Profile: http://forums.slimdevices.com/member.php?userid=56808 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
Foobar2000 saves the playlist as DOS/Windows & UTF-8. I've used Notepad++ to convert this file to 'UNIX' with BOM, as this is what LSM creates, but it didn't solve the issue. Perhaps it's not formatted correctly? I can up a small example file tomorrow if that would be helpful. eCo's Profile: http://forums.slimdevices.com/member.php?userid=4408 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
Re: [SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
Whats the text encoding on the m3u? Does the file have a BOM at the start? I had issues with non-ASCII years ago and solved it by URL encoding the paths. I wrote a small Perl script to read the m3u exported from mp3tag and rewrite it with mods. That approach can handle a really large file to boot. philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter
[SlimDevices: SqueezeCenter] Playlist Creation & non-ASCII characters
Hi All, I'm trying to create a playlist from a very large audio catalogue that captures my best (audiophile) recordings. In foobar2000, this is straightforward as I can create a boolean expression with all terms I typically include in the albums' titles, such as "Remaster", "180g LP Rip", "SACD", "MFSL", and so on; and importantly, there are no duplicates. Unfortunately, when I try to import the Foobar playlist into LSM, all the entries with special characters (non-ASCII 128 thru 255) are missing - either individual songs or entire albums from, for example, the artist Amon Düül II. Saving a playlist with these same sources works fine when created within LSM. If I use the LMS advanced search tool, I can build the playlist within LMS in a reasonable time entering the terms mentioned above one-at-a-time. But then I end up with a large number of duplicate entries since there's considerable overlap between the searches. This makes the playlist unnecessarily large, and the duplicated albums (sometimes three & four times) would be played back too frequently. The "Audiophile.m3u" playlist I built within LMS including duplicates is > 9 MB with about 84,300 lines. I've tried to find & delete duplicates using two word processing tricks I've found and both failed - presumably because the file is too large (regex in Notepad++, and an MSWord VB macro). I've been working on this issue off and on for weeks and am still stymied as to how to get a nice, clean file that can be easily updated as I continue to grow my collection. Any new ideas would be most welcome eCo eCo's Profile: http://forums.slimdevices.com/member.php?userid=4408 View this thread: http://forums.slimdevices.com/showthread.php?t=114635 ___ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter