This script will create a html page containing your mp3 collection ordered by Artist and Album. No customizations are available at this time with the execption of the ouput file selection at runtime. Heavily based on playlist2html from André Kelpe (fs111 at web dot de).
Requeriments: Python 2.3 KDE 3.x (for dialog window)
Known problems:
* If the album title is NULL then the script will skip it. This is a constraint due to an unsolved dcop bug wich causes null fields to be skipped on an sql query output. * The author doesn't knows nothing about Python.
Author: Marcelo Bovo mdbovo at gmail dot comLast changelog:
0.1 Initial release 0.1.1 Minor typo fixes Converted album length to HH:MM:SS format. 0.1.2 Fixed issue with albums with the same name and compilations. 0.1.3 Fixed sql query error on some systems (thanks sputnik73!)
To work with mySQL, line 103 must be replaced by:
doc = os.popen('dcop amarok collection query \'select artist.name AS Artist, album.name AS Album,sum(length) AS Length,count(track) AS Tracknr,year.name AS Year from tags, album, artist, year where tags.album = album.id and tags.artist = artist.id and tags.year = year.id and album.name <> "" and tags.sampler = 0 group by tags.artist, tags.album, tags.year union select "Various Artists", album.name,sum(length),count(tags.track),year.name from tags, album, year where tags.album = album.id and tags.year = year.id and album.name <> "" and tags.sampler = 1 group by tags.album, tags. year\'').readlines()
Reason:
1) Subquery must be named, but is obsolete anyway
2) "Name" fields must be named unique
[code]File "/home/gerardo/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks
value = doc.pop()
IndexError: pop from empty list[/code]
Am I supposed to do anything before running it?
Thanks
jayenell: It should work with both mysql and sql-lite. All database querys are made through amarok dcop interface so wich database is on the backend is transparent to my script.
gerardolm: It seems as if your music collection were empty (no records were returned from your query). Could you send me more information about the error?.
Regards,
Marcelo
Same here. I'm using mySql
This is the error message:
Traceback (most recent call last):
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in ?
main()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main
collect = Collection()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__
self._buildDoc()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc
self._extractTracks()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks
value = doc.pop()
IndexError: pop from empty list
Traceback (most recent call last):
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in ?
main()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main
collect = Collection()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__
self._buildDoc()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc
self._extractTracks()
File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks
value = doc.pop()
IndexError: pop from empty list
I also have this problem. I paste the error log:
Traceback (most recent call last):
File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in <module>
main()
File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main
collect = Collection()
File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__
self._buildDoc()
File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc
self._extractTracks()
File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks
value = doc.pop()
IndexError: pop from empty list
Seems like the same problem that I ran into with PostgreSQL:
Traceback (most recent call last):
File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in <module>
main()
File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main
collect = Collection()
File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__
self._buildDoc()
File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc
self._extractTracks()
File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks
value = doc.pop()
IndexError: pop from empty list
The query
select artist.name, album.name,sum(length),count(track),year.name from tags, album, artist, year where tags.album = album.id and tags.artist = artist.id and tags.year = year.id and album.name <> "" and tags.sampler = 0 group by tags.artist, tags.album, tags.year union select "Various Artists", album.name,sum(length),count(tags.track),year.name from tags, album, year where tags.album = album.id and tags.year = year.id and album.name <> "" and tags.sampler = 1 group by tags.album, tags. year
doesn't return anything. But I don't know much about the SQL language, so I don't understand what it is supposed to do...
I just tried out your amarok script and it works GREAT! This is very useful for parties and DJ events. You can just leave the list up for people to make requests.
Thank you very much.
Thanks! I'm glad you've found it useful.
I've detected some problems with albums with the same name ("The Best of" for example). I'm releasing a new version before the end of the weeks.
Regards
drnoone
Ratings & Comments
11 Comments
To work with mySQL, line 103 must be replaced by: doc = os.popen('dcop amarok collection query \'select artist.name AS Artist, album.name AS Album,sum(length) AS Length,count(track) AS Tracknr,year.name AS Year from tags, album, artist, year where tags.album = album.id and tags.artist = artist.id and tags.year = year.id and album.name <> "" and tags.sampler = 0 group by tags.artist, tags.album, tags.year union select "Various Artists", album.name,sum(length),count(tags.track),year.name from tags, album, year where tags.album = album.id and tags.year = year.id and album.name <> "" and tags.sampler = 1 group by tags.album, tags. year\'').readlines() Reason: 1) Subquery must be named, but is obsolete anyway 2) "Name" fields must be named unique
[code]File "/home/gerardo/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks value = doc.pop() IndexError: pop from empty list[/code] Am I supposed to do anything before running it? Thanks
Same for me or does it only work with sqllite and not with mysql?
jayenell: It should work with both mysql and sql-lite. All database querys are made through amarok dcop interface so wich database is on the backend is transparent to my script. gerardolm: It seems as if your music collection were empty (no records were returned from your query). Could you send me more information about the error?. Regards, Marcelo
Same here. I'm using mySql This is the error message: Traceback (most recent call last): File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in ? main() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main collect = Collection() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__ self._buildDoc() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc self._extractTracks() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks value = doc.pop() IndexError: pop from empty list Traceback (most recent call last): File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in ? main() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main collect = Collection() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__ self._buildDoc() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc self._extractTracks() File "/home/gmhafiz/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks value = doc.pop() IndexError: pop from empty list
I have just converted my amarok database from SQLite to MySQL, and collection2html also fails with the same error backtrace as was previously shown.
I also have this problem. I paste the error log: Traceback (most recent call last): File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in <module> main() File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main collect = Collection() File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__ self._buildDoc() File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc self._extractTracks() File "/home/javi/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks value = doc.pop() IndexError: pop from empty list
Seems like the same problem that I ran into with PostgreSQL: Traceback (most recent call last): File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 25, in <module> main() File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/collection2html.py", line 12, in main collect = Collection() File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 73, in __init__ self._buildDoc() File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 95, in _buildDoc self._extractTracks() File "/home/JohnNy64/.kde/share/apps/amarok/scripts/collection2html/Collection.py", line 111, in _extractTracks value = doc.pop() IndexError: pop from empty list The query select artist.name, album.name,sum(length),count(track),year.name from tags, album, artist, year where tags.album = album.id and tags.artist = artist.id and tags.year = year.id and album.name <> "" and tags.sampler = 0 group by tags.artist, tags.album, tags.year union select "Various Artists", album.name,sum(length),count(tags.track),year.name from tags, album, year where tags.album = album.id and tags.year = year.id and album.name <> "" and tags.sampler = 1 group by tags.album, tags. year doesn't return anything. But I don't know much about the SQL language, so I don't understand what it is supposed to do...
I just tried out your amarok script and it works GREAT! This is very useful for parties and DJ events. You can just leave the list up for people to make requests. Thank you very much.
Thanks! I'm glad you've found it useful. I've detected some problems with albums with the same name ("The Best of" for example). I'm releasing a new version before the end of the weeks. Regards drnoone
Thanks, its greatly appreciated.