any way to use mp3tag to create a copy list from m3u

hi

Just new to having a portable music player (pmp), so I was thinking how good it would be to be able to take an mp3tag generated playlist (m3u) that I'm playing on the home system and turn it into a copy mechanism that would copy the m3u music files folder by folder onto a connected pmp, so that I can listen to the same playlist at home or on the move.

Does such a utility exist (have searched but no luck) or how would one go about deriving one?

cheers

You might be able to do that with a batch file. Step through the playlist file one line at a time and copy the files to the destination. If the m3u doesn't use absolute file paths then you'll probably need to prepend a full path to the source file for the copy command.

Probably read there ...
Create Batch-Files using the export feature
Backup tags ?

http://www.microsoft.com/en-us/download/de...s.aspx?id=15155

DD.20140726.0953.CEST

My apologies - I was composing my reply and missed yours DetlevD - will go off and have a look now,

Here's the start of an mp3tag generated m3u file:

#EXTM3U
#EXTINF:879,artist1 - track1
\\NAS\A\S\artist\artist1 - track1\04-track1.mp3

and lines 2 and 3 are repeated for each track until the end.

So that looks promising - after the first header line the lines are in pairs with the first to be ignored and the second to be processed to become something like:

copy or xcopy? 2nd line F:\PMP\music

So knowing nothing about batch files my starting point for a batch file to just read and display lines in the test file is:

FOR /F "tokens=1 delims=@" %%G IN ('"sample m3u.m3u"') DO echo %%G
pause

but all this does is to display the whole text file. I was actually trying to just read each line from the text file and display it...

ok cracked the first bit:

FOR /F "tokens=*" %%A in (samplem3u.txt) DO echo %%A
pause

this will now read each line and echo it. Now need to work out how to ignore line 1 and then every other line... then generate copy or xcopy commands.

the next bit is straighforward using eol syntax to ignore lines starting with #

so:

FOR /F "tokens=* eol=#" %%A in (samplem3u.txt) DO echo %%A
pause

now outputs just the full NAS music file names...

So this now works in test:

SET TARGET=C:\Users\xxxx\Desktop\MUSICTARGET\
FOR /F "tokens=* eol=#" %%A in (C:\Users\xxxx\Desktop\samplem3u.txt) DO (copy "%%A" %TARGET%)
pause

So ready to carry out a test with the music player attached.

Using copy rather than xcopy for now because it just works.

Thanks for the inspiration.

I assume your portable player mounts as a local drive in Windows? Mine all do. If you don't have to modify any of the paths, it might be as simple as:

@echo off
setlocal
set m3ufile=C:\temp\sample.m3u
set playerdir=E:\Music
for /f "eol=# tokens=*" %%a in (%m3ufile%) do (
  copy "%%a" "%playerdir%"
)

Thanks for that JJ. I bet you just wrote that out in one go! As opposed to my taking about 12 edits and a lot of head scratching. You're right about the music player attaching as a local drive.

I'm listening to my copy of JJ Johnson's The Eminent JJ Johnson from 1953-55 right now with Clifford Brown, Hank Mobley, Jimmy Heath, Wynton Kelly et al. Sounds great.

One slight wrinkle to try to solve, because it will be easier to manage the PMP directory if the music is in some sort of artist-album structure.

At the moment all files are copied to the destination without any folder structure being mirrored. I don't think copy has any options to do this, and I've looked at xcopy and tried out a few likely options like /S and /I but no luck.

So the other options I can think of are to

  1. parse the m3u lines into several parts and then construct the output directory with artist album folders.
  2. extract the artist and album details to allow substitution.

Well it isn't pretty but it works - it would be nice to have the code work regardless of how many levels are in the directory structure. Is there a way to get the artist-album info from the first line of each pair (the one starting with # that's currently ignored)?

The Directory structure under the target destination folder are now ARTIST-ALBUM folders:

SET TARGET=C:\Users\xxx\Desktop\MUSICTARGET\
SET playlist=C:\Users\xxx\Desktop\samplem3u.txt
FOR /F "tokens=1-6 delims=\ eol=#" %%A in (%playlist%) DO (xcopy "\\%%A\\%%B\\%%C\\%%D\\%%E\\%%F" "%TARGET%%%E\")
pause

Used xcopy because I experimented with various options but in the end they're not needed.

Just one mini glitchette to sort out now. The real m3u files have spaces in them so I tried single quotes and double quotes on the SET statement but then the %playlist% substitution doesn't work because it's treated as a literal rather than a filename...

I think the usebackq option might be the one.

SET TARGET=C:\Users\xxx\Desktop\MUSICTARGET\
REM SET playlist=C:\Users\xxx\Desktop\samplem3u.txt
SET playlist="\\\\NAS\s2\Playlists\[TEST].m3u"
FOR /F "usebackq tokens=1-6 delims=\ eol=#" %%A in (%playlist%) DO (xcopy "\\%%A\\%%B\\%%C\\%%D\\%%E\\%%F" "%TARGET%%%E\")
pause

This just tested fine for a small number of real music files in an extract from a real m3u file. It would be nice to solve the number of directory levels question so that parsing on the \character would result in a different number of variables depending on how deep the dir structure is.

But for me this works.

Another option could be ...
opening the "filelist.m3u8" load all the media files into Mp3tag, ...
from there let run an export script, ...
which creates a command script, ...
which uses "MD %folderpath%" and "COPY %path%" commands to create the folder structure on the target medium and copy the files to the right folders.

See also:
Dateien löschen

DD.20140726.1958.CEST

Here's the latest version with a couple of tweaks. I use the XCopy D option without a date to only copy the music over if it isn't already there, to save time, and allow me to just add to a playlist. I also found a crude way to copy the folder.jpg file over in the same code block so it copies it the first time in each album.

I've been using this for a few days and it seems to work fine. It would be easy to adapt it to anyone's system if albums are stored to the same directory depth.

I have set myself the challenge of seeing if I can achieve the same effect using windows powershell.... So far dos scripts are winning!

REM target must have trailing back slash
REM SET TARGET=c:\Users\xxx\Desktop\TARGET\
SET TARGET=F:\
REM SET playlist=C:\Users\xxx\Desktop\samplem3u.txt
SET playlist="\\\\NAS\s2\Playlists\[DX50].m3u"
REM D OPTION WITHOUT DATE SHOULD MEAN NO FILE COPIED IF IT ALREADY EXISTS
REM
FOR /F "usebackq tokens=1-6 delims=\ eol=#" %%A in (%playlist%) DO (
xcopy "\\%%A\\%%B\\%%C\\%%D\\%%E\\%%F" "%TARGET%%%E\" /D
xcopy "\\%%A\\%%B\\%%C\\%%D\\%%E\folder.jpg" "%TARGET%%%E\" /D
)
pause