Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 8 of 8
  1. #1
    Senior Member
    Join Date
    Jan 2011
    Posts
    291

    Export playlist of music files to USB pen drive

    Is there a plugin/add-on that will let me export/copy a playlist of music files (the actual flac files) from LMS to a USB pen drive?
    I can copy files to my android devices using orange squeeze but the wife doesn't like using her phone to play music in the car and wants to use a USB pen drive.
    I can drag and drop music to it using file explorer but it's a bit of a pita.
    It would be great if I could create a playlist of the music she wants in the car and copy those files directly to a USB stick.
    Anyone know of any way of achieving this?
    Thanks in advance.

    Sent from my Nexus 6P using Tapatalk
    Logitech Media Server Version: 7.8.0 - 1395395852 @ Fri Apr 18 13:29:51 EDT 2014
    Operating system: Vortexbox 2.3 (Fedora20 Heisenbug)
    Squeezebox Touch: Firmware: 7.7.1-r9561
    Squeezeplay 7.5.3 - r0
    Squeezeslave
    2 x RPI3 piCorePlayer 3.01

  2. #2
    Senior Member w3wilkes's Avatar
    Join Date
    Jan 2009
    Location
    Utah, USA
    Posts
    1,146
    Can't speak to a plugin, but you might have a look at Amok Playlist copy.
    http://www.amok.am/en/freeware/amok_playlist_copy/
    Main system - Rock Solid with LMS 7.9.1 Official on WHS 2011 - 2 Duets and Squeeseslave
    Cabin system - Rock solid with LMS 7.9.1 Official on Win10 Pro - 1 RPi 3 Model B/Hifiberry DAC+ Pro/PiCorePlayer and Squeezeslave

  3. #3
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    740
    Quote Originally Posted by cliver View Post
    Is there a plugin/add-on that will let me export/copy a playlist of music files (the actual flac files) from LMS to a USB pen drive?
    It would be great if I could create a playlist of the music she wants in the car and copy those files directly to a USB stick.
    I've written a perl script which copies files referenced by a playlist to a destination directory if they do not exist there.
    It's original purpose was to copy music to my phone, but I've used it for sd cards for my car as well.
    I can post this script if you are interested.

  4. #4
    Senior Member
    Join Date
    Jan 2011
    Posts
    291
    Quote Originally Posted by w3wilkes View Post
    Can't speak to a plugin, but you might have a look at Amok Playlist copy.
    http://www.amok.am/en/freeware/amok_playlist_copy/
    Thanks, I'll take a look.

    Sent from my Nexus 6P using Tapatalk
    Logitech Media Server Version: 7.8.0 - 1395395852 @ Fri Apr 18 13:29:51 EDT 2014
    Operating system: Vortexbox 2.3 (Fedora20 Heisenbug)
    Squeezebox Touch: Firmware: 7.7.1-r9561
    Squeezeplay 7.5.3 - r0
    Squeezeslave
    2 x RPI3 piCorePlayer 3.01

  5. #5
    Senior Member
    Join Date
    Jan 2011
    Posts
    291
    Quote Originally Posted by Roland0 View Post
    I've written a perl script which copies files referenced by a playlist to a destination directory if they do not exist there.
    It's original purpose was to copy music to my phone, but I've used it for sd cards for my car as well.
    I can post this script if you are interested.
    Thanks Roland0, sound like exactly what I'm after. I'd appreciate if you would post it please.

    Sent from my Nexus 6P using Tapatalk
    Logitech Media Server Version: 7.8.0 - 1395395852 @ Fri Apr 18 13:29:51 EDT 2014
    Operating system: Vortexbox 2.3 (Fedora20 Heisenbug)
    Squeezebox Touch: Firmware: 7.7.1-r9561
    Squeezeplay 7.5.3 - r0
    Squeezeslave
    2 x RPI3 piCorePlayer 3.01

  6. #6
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    740
    Quote Originally Posted by cliver View Post
    Thanks Roland0, sound like exactly what I'm after. I'd appreciate if you would post it please.
    Code:
    #!/usr/bin/perl
    
    use File::Path qw(make_path);
    use File::Basename;
    use File::Spec;
    use File::Copy;
    
    my $target = "/mnt/usbstick";
    my $cf = 0;
    my $sim = 1;
    
    while( <> ) {
    	/^#.*/ && next;
    	chomp;
    	($volume,$directories,$file) = File::Spec->splitpath( $_ );
    	my @dirs = File::Spec->splitdir( $directories );
    	my $adir = $dirs[$#dirs-1];
    	my $dpath = File::Spec->catdir( ($target, $adir) );
    	$dpath =~ s/[:'"?!]//g;
    	if ( $dpath =~ /.* $/) {
    		chop( $dpath);
        }
    	my $dfile = File::Spec->catfile($dpath , $file);
    	if( $sim == 1)  {
    		print "dpath: $dpath dfile: $dfile";
    		if (! -f "$dfile" ) { 
    			print " [copy]\n";
    		} else {
    			print " [no copy]\n";
    		}
    		continue;
    	}
    
    	( -d "$dpath" ) || make_path( "$dpath");
    	( -f "$dpath/cover.jpg" ) || copy("$directories/cover.jpg","$dpath");
    	( -f "$dpath/cover.png" ) || copy("$directories/cover.png","$dpath");
    	if( $file  =~ /\.flac$/) {
    		$file =~ s/\.flac$/.mp3/;
    		if( -f File::Spec->catfile($dpath , $file) ) {
    			print "[skip] $_ (mp3 exists at destination)\n";
    			next;
    		}
    	}
    	if (! -f "$dfile" ) { 
    		print "[copy] $_  to $dpath\n";
    		copy( "$_", "$dpath");
    		$cf++;
    	}
    }
    print "copied $cf files\n";
    copy code into a file (e.g. m3ucopy.pl)
    make file executable
    adjust path in $target
    test ($sim = 1 means simulate, change to $sim = 0 to actually copy)
    run ./m3ucopy.pl < /path/to/playlist.m3u
    script preserves one directory level (e.g. "Artist - Album"/track.mp3)
    doesn't copy flac if mp3 of same base name exists

  7. #7
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    3,028
    Quote Originally Posted by Roland0 View Post
    Code:
    #!/usr/bin/perl
    
    use File::Path qw(make_path);
    use File::Basename;
    use File::Spec;
    use File::Copy;
    
    my $target = "/mnt/usbstick";
    my $cf = 0;
    my $sim = 1;
    
    while( <> ) {
    	/^#.*/ && next;
    	chomp;
    	($volume,$directories,$file) = File::Spec->splitpath( $_ );
    	my @dirs = File::Spec->splitdir( $directories );
    	my $adir = $dirs[$#dirs-1];
    	my $dpath = File::Spec->catdir( ($target, $adir) );
    	$dpath =~ s/[:'"?!]//g;
    	if ( $dpath =~ /.* $/) {
    		chop( $dpath);
        }
    	my $dfile = File::Spec->catfile($dpath , $file);
    	if( $sim == 1)  {
    		print "dpath: $dpath dfile: $dfile";
    		if (! -f "$dfile" ) { 
    			print " [copy]\n";
    		} else {
    			print " [no copy]\n";
    		}
    		continue;
    	}
    
    	( -d "$dpath" ) || make_path( "$dpath");
    	( -f "$dpath/cover.jpg" ) || copy("$directories/cover.jpg","$dpath");
    	( -f "$dpath/cover.png" ) || copy("$directories/cover.png","$dpath");
    	if( $file  =~ /\.flac$/) {
    		$file =~ s/\.flac$/.mp3/;
    		if( -f File::Spec->catfile($dpath , $file) ) {
    			print "[skip] $_ (mp3 exists at destination)\n";
    			next;
    		}
    	}
    	if (! -f "$dfile" ) { 
    		print "[copy] $_  to $dpath\n";
    		copy( "$_", "$dpath");
    		$cf++;
    	}
    }
    print "copied $cf files\n";
    copy code into a file (e.g. m3ucopy.pl)
    make file executable
    adjust path in $target
    test ($sim = 1 means simulate, change to $sim = 0 to actually copy)
    run ./m3ucopy.pl < /path/to/playlist.m3u
    script preserves one directory level (e.g. "Artist - Album"/track.mp3)
    doesn't copy flac if mp3 of same base name exists
    That looks very interesting !

    2 questions

    1) Does the script copy the .m3u file(s) itself to the usbstick ?
    2) If it does, how do you deal with a .flac file referenced within an m3u which has been left out in preference for an .mp3 ?
    VB2.4 storage QNAP TS419p (NFS)
    Living Room - Joggler & SB3 -> Onkyo TS606 -> Celestion F20s
    Office - Pi3+Sreen -> Sony TAFE320 -> Celestion F10s / Pi2+DAC & SB3 -> Onkyo CRN755 -> Wharfedale Modus Cubes
    Dining Room -> SB Boom
    Kitchen -> UE Radio (upgraded to SB Radio)
    Bedroom (Bedside) - Pi2+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) - SB Touch ->Sherwood AVR ->Mordaunt Short M10s
    Everything controlled by iPeng

  8. #8
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    740
    Quote Originally Posted by d6jg View Post
    That looks very interesting !
    2 questions
    1) Does the script copy the .m3u file(s) itself to the usbstick ?
    No, it doesn't - this is really just a quick hack.
    I'll probably rewrite it with some additional features (e.g. automatically covert files to mp3 etc.), if there's interest, I can post the new version as soon as it's usable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •