Amend playlists recursively


#1

Hi
I have many albums in both FLAC and MP3. Each album is stored in its own folder under Artist/Album.
Within each album folder are all the tracks for the album, cover art and an M3U playlist.

Recently I have had to rename all my track filenames to make them shorter due to reaching a limit on my Sonos. I previosuly used a convention of "artist - album - trackno - trackname" for all the tracks. I have now changed them to just "trackno - trackname" I did all this in MP3Tag. However all the existing playlists still refer to the old longer filenames.

Is there a way in MP3Tag to change all these to the correct new shorter filenames by searching all the folders for the playlists, loading them and saving them

Thanks
G


#2

I doubt that this is possible straight away.
THe playlists contain references to filenames but as files with the specified name do not exist any more you would need some kind of guessing mechanism.

But as the playlists are usually plain text, you can easily edit them with a text editor and shorten the entries.

(Probably rewriting the lists would be easier)

So next time you want to rename the files I would suggest to load the playlist and the referenced files first, then rename the files and - as the selected files are now loaded into mp3tag - then create a new playlist from the now renamed files.


#3

Since the old file names followed a well defined pattern, you could rename them all back to the old names, and then follow Ohrenkino's instructions. Afterward, change the remaining file names to the shorter version again.

I haven't worked much with playlists in Mp3tag, but I think you'd have to do one playlist at a time. If you have a lot of playlist, this could be tedious, but it's probably easier than manually editing the files.

I'd probably write a script to go through the playlists and change the file references, verifying that each file exists before rewriting the reference. You could parse the filenames (everything after the last \ or /) into tracknumber and title, but dashes in artists, albums and titles could make things a little tricky.


#4

I've managed to create an Export and put it inside an Action. I am testing this on one album at the moment and it seems to produce the playlist I want apart from one thing relating to the filename. Depending on where I enter MP3Tag from is where it saves the file. Also it doesnt always appear to create the name in the format I want

I want the format to be artistname - albumname and the output to be saved in the same folder as the tracks are

The code is below.

$filename(%artist% - %album%.m3u)#EXTM3U
#EXTART %artist%
#EXTALB %album%
$loop(%track%)$loop(%_filename_ext%)#EXTINF:%_length_seconds%,%artist% - %title%
%_filename_ext%
$loopend()$loopend()

How do I achieve this