Skip to content

Instantly share code, notes, and snippets.

@danielpclark
Created September 1, 2012 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielpclark/3569964 to your computer and use it in GitHub Desktop.
Save danielpclark/3569964 to your computer and use it in GitHub Desktop.
Play all mp3 files in the directory.
#!/usr/bin/env python
##################################################
# Progran: ALL MP3s #
# Version: 0.1 #
# Company: 6ft Dan(TM) #
# Author : Daniel P. Clark #
# Date : <= 2005 #
# E-mail : #
# ABOUT : Plays all mp3s's in current #
# directory #
##################################################
import sys, os, string
Mpg123 = "/usr/bin/env mpg123" # creates variable for mpg123 program
mylist = []
def menu():
global mylist
directory="." # for now, the current directory
mylist = os.listdir(directory) # get list of files in current directory
for x in range(len(mylist)):
if string.lower(mylist[x][-3:]) != "mp3":
continue
else:
mpFile = os.path.join(directory, mylist[x])
os.system(Mpg123 + " \"" + mpFile + "\"")
sys.exit()
if __name__ == '__main__':
while 1:
menu() # Run the program!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment