From b528c10e9de6bb9e837526b446c6c229ed90cc43 Mon Sep 17 00:00:00 2001 From: yomguy Date: Sat, 29 Dec 2007 15:04:00 +0000 Subject: [PATCH] add pyfapg git-svn-id: http://svn.parisson.org/svn/tools/trunk@23 457c0346-1240-4656-8a5a-9edca8063506 --- pyfapg.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 pyfapg.py diff --git a/pyfapg.py b/pyfapg.py new file mode 100755 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+'"') + -- 2.39.5