From 91af8264b9e86ac548e9f562ce7a4cbc6c2f5c49 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 20 Jan 2016 01:18:25 +0100 Subject: [PATCH] externalize the header --- header.tpl | 37 +++++++++++++++++++++++++++++++++++++ html/style.css | 2 +- mp3tohtml.py | 22 ++++++---------------- 3 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 header.tpl diff --git a/header.tpl b/header.tpl new file mode 100644 index 0000000..5e2ad21 --- /dev/null +++ b/header.tpl @@ -0,0 +1,37 @@ + + + All songs + + + + + + + + + + + + + + + +
+ + diff --git a/html/style.css b/html/style.css index e393467..5549c44 100644 --- a/html/style.css +++ b/html/style.css @@ -41,7 +41,7 @@ nav ul li, footer ul li { } -nav a, footer a { +nav a, footer a, nav li { color: #eee; text-decoration: none; } diff --git a/mp3tohtml.py b/mp3tohtml.py index 7a030ac..9cdfab5 100755 --- a/mp3tohtml.py +++ b/mp3tohtml.py @@ -13,28 +13,18 @@ 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 "
ArtistAlbumTitleComments
" -print "" for f in files: tag = eyeD3.Tag() -- 2.7.4
ArtistAlbumTitleComments