From 974601b5acfe90049cde855d50715719a04d061d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 27 Jan 2016 01:44:18 +0100 Subject: [PATCH] fixed correctly the way to retrieve all mp3s --- mp3tohtml.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mp3tohtml.py b/mp3tohtml.py index 9aa51ac..a683c88 100755 --- a/mp3tohtml.py +++ b/mp3tohtml.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # Generate an HTML page containing information about MP3s in a # directory. @@ -12,7 +12,9 @@ import argparse; import eyeD3 +import fnmatch import glob +import os import os.path import re import sys @@ -46,14 +48,17 @@ def copy_header(path): for line in header: sys.stdout.write(line) -parser = argparse.ArgumentParser(description='Generate an HTLM containing information about the MP3 files.') +parser = argparse.ArgumentParser(description='Generate an HTML containing information about the MP3 files.') parser.add_argument('dir', help='The directory containing the MP3 files') args = parser.parse_args() copy_header(sys.argv[0]) -files = glob.iglob(args.dir + "/**/*mp3") +files = [] +for root, dirnames, filenames in os.walk(args.dir): + for filename in fnmatch.filter(filenames, '*.mp3'): + files.append(os.path.join(root, filename)) for f in files: tag = eyeD3.Tag() -- 2.7.4