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