3 # Generate an HTML page containing information about
6 # Usage: mp3tohtml.py <mp3_dir>
8 # Last version of this tool can be get from the GIT repository http://git.wpitchoune.net/radio.git
10 # (c) 2015 Jean-Philippe Orsini <jeanfi@gmail.com>
16 if len(sys.argv) != 2:
19 files = glob.glob(sys.argv[1] + "/**/*mp3")
23 print "<title>All songs</title>"
25 print " <link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css\">"
26 print "<script type=\"text/javascript\" language=\"javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js\">"
28 print " <script type=\"text/javascript\" language=\"javascript\" src=\"https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js\">"
30 print "<script>$(document).ready(function() { $('#songs').DataTable(); } );</script>"
33 print "<body><h1>List of songs</h1>"
35 print "<table id='songs' class='display compact' width='100%'>"
36 print "<thead><tr><th>Artist</th><th>Album</th><th>Title</th><th>Comments</th></tr></thead>"
45 artist = tag.getArtist()
46 print "\t\t<td>" + artist + "</td>"
47 except UnicodeEncodeError:
51 print "\t\t<td>" + tag.getAlbum() + "</td>"
52 except UnicodeEncodeError:
56 print "\t\t<td>" + tag.getTitle() + "</td>"
57 except UnicodeEncodeError:
61 comments = tag.getComments()
63 print comments[0].comment
71 print " <li><a href=\"mailto:proxyradio@wpitchoune.net\">Contact</a></li>"
74 print "</body></html>"