Playlists generation for AudioGalaxy

I use audio galaxy and thought it would be nice to create M3U playlists for all my music folders. The result is this simple Python script:

import os
import string

AUDIOGALAXY_PLAYLIST_DIR = r"C:UsersyanMusicAudiogalaxy Playlists"

class Playlist:
    def __init__(self, dir):
        self.__name = string.replace(string.split(dir, MUSIC_ROOT_FOLDER, -1)[1], os.path.sep, "_")
        if not self.__name:
            self.__name = "Songs in root"
        self.__songs = []
        for file in [file for file in os.listdir(dir) if not file in [".", ".."]
                     and os.path.splitext(file)[1] in MUSIC_EXTENSIONS]:
            fullname = os.path.join(dir, file)
            if not os.path.isdir(fullname):

    def printme(self):
        print "%s - %d songs" % (self.__name, self.countSongs())
        #for song in self.__songs:
        #    print "t%s" % (song,)

    def countSongs(self):
        return len(self.__songs)    

    def save(self, dir):
        if 0 == self.countSongs():
        file = open(os.path.join(dir, self.__name + PLAYLIST_EXT), "w")
        for song in self.__songs:
            file.write(song + "n")

def handle_dir(target_dir, dirname, fnames):
    p = Playlist(dirname)

def main():

if __name__ == '__main__':

Just set MUSIC_ROOT_FOLDER to your music files location and AUDIOGALAXY_PLAYLIST_DIR accordingly and run the script.

3 thoughts on “Playlists generation for AudioGalaxy

  1. Runs fine. I think audiogalaxy is broken when it comes to importing playlists though. No matter what I do the new playlist doesn’t show up. The only true way to create a playlist is manually drag and drop using the audiogalaxy web ui.

  2. It seems that sometimes it takes time for the playlist to be updated with the songs in the directory. And it also seems to depend on the mp3 format. Some MP3s I have weren’t recognized by Audio Galaxy and were not added to the playlist.

Leave a Reply

Your email address will not be published. Required fields are marked *