Vous n’êtes pas connecté.
![]() |
Code source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# Copyright (c) 2001-2005 Jochen Kupperschmidt <webmaster@homework.nwsnet.de> # Released under the terms of the GNU General Public License import glob import os.path # Find direct subdirectories. dirs = [] for entry in os.listdir(os.getcwd()): if os.path.isdir(entry): dirs.append(entry) # Add files in subdirectories to list. fnames = [] for dir in dirs: fnames += glob.glob(os.path.join(dir, '*.mp3')) # Generate playlist from track list. num = 0 f = open('playlist.pls', 'w') f.write('[playlist]\n') for fname in fnames: num += 1 f.write('File%d=%s\n' % (num, fname)) f.write('Title%d=%s\n' % (num, '.'.join(os.path.basename(fname).split('.')[:-1]))) f.write('Length%d=-1\n' % (num)) f.write('NumberOfEntries=%d\n' % num) f.write('Version=2\n') f.close() |
Ce message a été modifié 1 fois. Dernière modification effectuée par "Y0Gi" (22 janvier 2013, 04:13)
-