LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-28-2004, 12:06 PM   #1
Mikessu
Member
 
Registered: Sep 2003
Distribution: Gentoo, FreeBSD 5.1
Posts: 122

Rep: Reputation: 15
Program to create playlists of directories


Is there a program for Linux that can make playlist automatically from many directories at the same time? Or maybe a console program for that so I could write a script / execute it recursively to create playlists?

I want to make playlists for directories seperately not only one huge playlist containing all my music files.

Last edited by Mikessu; 06-28-2004 at 12:07 PM.
 
Old 06-28-2004, 01:36 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,000
Blog Entries: 11

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
http://www.catb.org/~esr/faqs/smart-questions.html

Which player are they meant to be for?




Cheers,
Tink
 
Old 06-28-2004, 08:17 PM   #3
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 77
This should do the trick. Pretty much any media player can deal with .m3u playlists. You just need to edit a few things.
Code:
#!/usr/bin/python

import os, string

def create_m3u_playlist(music_dir, name):
    song_list = os.listdir(music_dir)
    song_list.sort()
    # change "/home/music/" to where you want the .m3u files to be created
    f = open("/home/music/" + name + ".m3u" , "w")
    for i in song_list:
        f.write(music_dir + "/" + i + "\n")
    f.close()

# change "a","b" etc... to the directory names where you keep your music files.
directory = ["a","b","c"]
for name in directory :
    # change "/home/music/" to the path to your music directories ie: "music_dir + name"
    # should represent the full path to your directories.
    music_dir = "/home/music/" + name
    create_m3u_playlist(music_dir, name)
I edited this from a python script I wrote that indexes all of my music files into html pages and m3u playlists. Unfortunately my script is hardwired with file paths specific to my music directory structure, but anyone with a little python knowledge could hack it to work for them.

Last edited by bulliver; 06-28-2004 at 08:27 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to create directories satimis Linux From Scratch 8 07-02-2005 05:48 AM
Do we need to create the log and db directories by ourselves Niceman2005 Linux - Software 0 11-17-2004 10:08 PM
Can't create directories in /proc keripukki Linux - Software 3 09-03-2004 02:26 PM
Create several directories? AutOPSY Linux - Newbie 3 03-30-2004 08:51 PM
Need to sort mp3's and create playlists based on genre cav Linux - General 11 07-06-2003 11:04 PM


All times are GMT -5. The time now is 06:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration