]> git.parisson.com Git - yomguy-tools.git/commitdiff
add pyfapg
authoryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Sat, 29 Dec 2007 15:04:00 +0000 (15:04 +0000)
committeryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Sat, 29 Dec 2007 15:04:00 +0000 (15:04 +0000)
git-svn-id: http://svn.parisson.org/svn/tools/trunk@23 457c0346-1240-4656-8a5a-9edca8063506

pyfapg.py [new file with mode: 0755]

diff --git a/pyfapg.py b/pyfapg.py
new file mode 100755 (executable)
index 0000000..4ade468
--- /dev/null
+++ b/pyfapg.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+# 1 mp3 to m3u
+# depends: fapg
+
+import os, sys, string
+
+host = 'audio.pre-barreau.com'
+root_dir = '/home/pro-barreau/www/audio'
+web_dir = '/'
+types = ['mp3','ogg','flac']
+
+#s.chdir(root_dir)
+
+for root, dirs, files in os.walk(root_dir+web_dir):
+    #print root
+    for file in files:
+        file_split = file.split('.')
+        filename = file_split[len(file_split)-2]
+        #print filename
+        if not os.path.exists(root+os.sep+filename+'.m3u'):
+            fileext = file_split[len(file_split)-1]
+            if fileext in types :
+                os.chdir(root_dir)
+                prefix = 'http://'+host+'/'
+                dest_dir = string.replace(root,'/home/pro-barreau/www/audio/','')
+                file_new = string.replace(file,' ','_')
+                filename_new = string.replace(filename,' ','_')
+                if file_new != file: 
+                    os.system('mv "'+dest_dir+os.sep+file+'" "'+dest_dir+os.sep+file_new+'"')
+                os.system('fapg -f m3u -p '+prefix+' -o "'+root+os.sep+filename_new+'.m3u" "'+dest_dir+os.sep+file_new+'"')
+