Creating an m3u Playlist From A Folder of Flac Files

Hi,

I’m completely new to Automator and Applescript and only really started looking into it when I found that there were no good, clean solutions to what I wanted to do…as the title states.

I want to be able to select a folder and have an m3u playlist created with just the FLAC files in the folder.

So far I’ve made a workflow in Automator that does this:

The problem is that the m3u file created contains the file paths and not just the file names.

I’ve also tried writing an applescript to do this, but had even less success with this!

Can anyone suggest a neater way to do it or even just suggest a way to fix my problem?

Thanks

Hi, hamchapman.

As for the path vs. filename problem I only know how to solve it via Applescript. This does the trick:

on run {input, parameters}
	set filenames_list to {} -- this will store the list of filenames
	set text item delimiters to ":" -- to separate each part of a path
	repeat with file_alias in input
		-- the last text item after a colon is the filename
		set end of filenames_list to last text item of (file_alias as text)
	end repeat
	set text item delimiters to "" -- restores default value
	return filenames_list
end run

Once you have all the filenames in a list, there’s no need to use the Clipboard, manipulate text or rename files. Just create a new text file named “playlist.m3u” and save it in the selected folder (the one you stored in a variable). See the workflow here.

Now that was fun :cool: (not like other times :/)

Regards,
Antonio

Model: Macbook Pro 13"
AppleScript: 2.1.2
Browser: Opera/9.80 (Macintosh; Intel Mac OS X; U; es-ES) Presto/2.6.30 Version/10.61
Operating System: Mac OS X (10.6)