X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=mp3tohtml.py;h=5f8ca2da13f94de1d309495caa067e5d2a9d1ac8;hb=c616ba66ecb7cb2cbe6e17e9083dc8cabe789190;hp=3ba95f621f6344c25dd4e76835486f3b86531537;hpb=cc2433717d67bdb813e6a7c4cb8c3f8239a0869f;p=radio.git diff --git a/mp3tohtml.py b/mp3tohtml.py index 3ba95f6..5f8ca2d 100755 --- a/mp3tohtml.py +++ b/mp3tohtml.py @@ -1,39 +1,30 @@ #!/usr/bin/python -# Generate an HTML page containing information about -# MP3s in a directory. +# Generate an HTML page containing information about MP3s in a +# directory. # # Usage: mp3tohtml.py # -# Last version of this tool can be get from the GIT repository http://git.wpitchoune.net/radio.git +# Last version of this tool can be get from the GIT repository: +# http://git.wpitchoune.net/radio.git # # (c) 2015 Jean-Philippe Orsini import glob import sys import eyeD3 +import os.path if len(sys.argv) != 2: exit(1) -files = glob.glob(sys.argv[1] + "/**/*mp3") - -print "" -print "" -print "All songs" +header_path = os.path.dirname(sys.argv[0]) + "/header.tpl" +header = open(header_path, "r") +for line in header: + sys.stdout.write(line) -print " " -print "" -print " " -print "" -print "" - -print "

List of songs

" +files = glob.glob(sys.argv[1] + "/**/*mp3") -print "" -print "" for f in files: tag = eyeD3.Tag() @@ -60,7 +51,7 @@ for f in files: print "\t\t" print "\t"
ArtistAlbumTitleComments
" comments = tag.getComments() for c in comments: - print comments[0].comment + print c.comment print "\t\t