{"id":687,"date":"2014-11-02T06:56:50","date_gmt":"2014-11-02T06:56:50","guid":{"rendered":"http:\/\/zensonic.dk\/?p=687"},"modified":"2017-04-09T10:02:27","modified_gmt":"2017-04-09T10:02:27","slug":"about-fixing-bluesound-playlists-after-cifs-migration","status":"publish","type":"post","link":"https:\/\/zensonic.dk\/?p=687","title":{"rendered":"About fixing Bluesound playlists after CIFS migration"},"content":{"rendered":"<p>I recently wiped TomatoUSB and installed OpenWRT Barrier Breaker on my Linksys E3000 based router. In that process I also migrated our FLAC collection from my x86 based server edison\u00c2\u00a0 to the OpenWRT router. Life was good&#8230;.. until my wife complained that the her Bluesound playlists had stopped working.<\/p>\n<p>Luckily I have root access to my Bluesound and can fix stuff like this. Heres the issue and the fix.<\/p>\n<p>After the switch to OpenWRT the world look like this as seen from the Bluesound:<\/p>\n<p>[code]<br \/>\nroot@Stue \/tmp\/var\/data$ df<br \/>\nFilesystem\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 1K-blocks\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Used Available Use% Mounted on<br \/>\n\/dev\/root\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 903080\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 342168\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 515040\u00c2\u00a0 40% \/<br \/>\ntmpfs\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 127488\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 48\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 127440\u00c2\u00a0\u00c2\u00a0 0% \/tmp<br \/>\ntmpfs\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 127488\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 36\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 127452\u00c2\u00a0\u00c2\u00a0 0% \/dev<br \/>\n\/dev\/mmcblk0p3\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 2778768\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 86668\u00c2\u00a0\u00c2\u00a0 2550944\u00c2\u00a0\u00c2\u00a0 3% \/tmp\/var\/data<br \/>\nshm\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 127488\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 127488\u00c2\u00a0\u00c2\u00a0 0% \/dev\/shm<br \/>\n\/\/192.168.1.254\/flac 153703308\u00c2\u00a0 74379356\u00c2\u00a0 79323952\u00c2\u00a0 48% \/tmp\/var\/mnt\/OPENWRT-flac<br \/>\n[\/code]<\/p>\n<p>But a peek inside the playlist.db on the Bluesound shows the following<\/p>\n<p>[code]<br \/>\n&#8216;StoredPlaylist::files&#8217; =&gt; &#8216;\/var\/mnt\/EDISON-flac\/Arvo Part &#8211; Alina\/01-Spiegel im Spiegel (Version fur Violine und Klavier).flac<br \/>\n\/var\/mnt\/EDISON-flac\/Arvo Part &#8211; Alina\/02-Fur Alina (fur Klavier).flac<br \/>\n\/var\/mnt\/EDISON-flac\/Arvo Part &#8211; Alina\/03-Spiegel im Spiegel (Version fur Violoncello und Klavier).flac<br \/>\n\/var\/mnt\/EDISON-flac\/Arvo Part &#8211; Alina\/04-Fur Alina (fur Klavier).flac<br \/>\n\/var\/mnt\/EDISON-flac\/Arvo Part &#8211; Alina\/05-Spiegel im Spiegel (Version fur Violine und Klavier).flac<br \/>\n\/var\/mnt\/EDISON-flac\/Arvo Part &#8211; Alina\/03-Spiegel im Spiegel (Version fur Violoncello und Klavier).flac&#8217;<br \/>\n[\/code]<\/p>\n<p>Notice how the name of the CIFS server is part of the playlist entry. After figuring out the format of the playlist.db, it was trivially easy to write a little perl program to convert them. I did have to take care of some latin1 to utf8 as well, but that was also easy. For anyone who cares:<\/p>\n<p>[code]<br \/>\n#!\/usr\/bin\/perl -w<br \/>\n#<br \/>\n# convert_playlist.pl &#8211; version 1.0 gamma. Project hours: 1<br \/>\n#<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n# &#8220;THE WISHLIST LICENSE&#8221; (Revision 42):<br \/>\n# &lt;zensonic@zensonic.dk&gt; wrote this file.\u00c2\u00a0 As long as you retain this notice you<br \/>\n# can do whatever you want with this stuff.<br \/>\n#<br \/>\n# If you feel it saved your world a gift from <a title=\"http:\/\/amzn.com\/w\/2Y27QA7V5FUGU\" href=\"http:\/\/amzn.com\/w\/2Y27QA7V5FUGU\" target=\"_blank\">http:\/\/amzn.com\/w\/2Y27QA7V5FUGU<\/a><br \/>\n# is highly appriciated<br \/>\n# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n#<br \/>\n# Copyright 2014.11.01 by Thomas S. Iversen (zensonic@zensonic.dk)<\/p>\n<p>use strict;<br \/>\nuse Storable qw(nstore retrieve);<\/p>\n<p>die &#8220;$0 &lt;path_to_playlist&gt; &lt;regexp_match&gt; &lt;regexp_replace&gt;&#8221; if(!($#ARGV+1 == 3));<br \/>\nmy $filename = $ARGV[0];<br \/>\nmy $regexp_match = $ARGV[1];<br \/>\nmy $regexp_replace = $ARGV[2];<br \/>\nmy $storable;<\/p>\n<p>die &#8220;$filename does not exist\\n&#8221; if(! -f $filename);<br \/>\n$storable = retrieve($filename);<br \/>\nforeach my $playlist (@$storable) {<br \/>\nmy $name=$playlist-&gt;{&#8216;StoredPlaylist::name&#8217;};<br \/>\nprint &#8220;Converting playlist &#8216;$name&#8217;\\n&#8221;;<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/$regexp_match\/$regexp_replace\/g;<\/p>\n<p># capital danish<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xc5\/\\xc3\\x85\/g;<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xc6\/\\xc3\\x86\/g;<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xd8\/\\xc3\\x98\/g;<\/p>\n<p># lower danish<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xe5\/\\xc3\\xA5\/g;<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xe6\/\\xc3\\xA6\/g;<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xf8\/\\xc3\\xB8\/g;<\/p>\n<p># lower swedish<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xe4\/\\xc3\\xA4\/g;<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xf6\/\\xc3\\xB6\/g;<\/p>\n<p># capital swedish<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xc4\/\\xc3\\x84\/g;<br \/>\n$playlist-&gt;{&#8216;StoredPlaylist::files&#8217;}=~s\/\\xd6\/\\xc3\\x96\/g;<br \/>\n}<\/p>\n<p>my $filename_new=$filename . &#8220;.new&#8221;;<br \/>\nprint &#8220;Saving playlist as $filename_new\\n&#8221;;<br \/>\nnstore($storable, $filename_new);<br \/>\n[\/code]<\/p>\n<p>Which I then ran as<\/p>\n<p>[code]<br \/>\nroot@Stue \/tmp\/var\/data$ .\/convert_playlist.pl stored_playlists.db EDISON OPENWRT<br \/>\nConverting playlist &#8216;Svensk jul&#8217;<br \/>\nConverting playlist &#8216;Hvid januar&#8217;<br \/>\nConverting playlist &#8216;Lektier&#8217;<br \/>\nConverting playlist &#8216;Moderne salmer&#8217;<br \/>\nConverting playlist &#8216;Total afslapning&#8217;<br \/>\nConverting playlist &#8216;P\u00ef\u00bf\u00bdske&#8217;<br \/>\nSaving playlist as stored_playlists.db.new<br \/>\n[\/code]<\/p>\n<p>And then the last part<\/p>\n<p>[code]<br \/>\nmv playlist as stored_playlists.db.new playlist as stored_playlists.db<br \/>\nreboot<br \/>\n[\/code]<\/p>\n<p>And restart the Bluesound app on the phone (it caches). Happy wife \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently wiped TomatoUSB and installed OpenWRT Barrier Breaker on my Linksys E3000 based router. In that process I also migrated our FLAC collection from my x86 based server edison\u00c2\u00a0 to the OpenWRT router. Life was good&#8230;.. until my wife complained that the her Bluesound playlists had stopped working. Luckily I have root access to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,4,32,33],"tags":[],"class_list":["post-687","post","type-post","status-publish","format-standard","hentry","category-fun-projects","category-hardware","category-sound","category-upgrade"],"_links":{"self":[{"href":"https:\/\/zensonic.dk\/index.php?rest_route=\/wp\/v2\/posts\/687"}],"collection":[{"href":"https:\/\/zensonic.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zensonic.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zensonic.dk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zensonic.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=687"}],"version-history":[{"count":0,"href":"https:\/\/zensonic.dk\/index.php?rest_route=\/wp\/v2\/posts\/687\/revisions"}],"wp:attachment":[{"href":"https:\/\/zensonic.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zensonic.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zensonic.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}