
Random Album
Source (link to git-repo or to original if based on someone elses unmodified work):
It should be a playlist really, but I don't know yet how to do that. The script behaves quite like a dynamic playlist.
So here it is. It will play a random album from your collection. Upon reaching the last song, it will load a new one in the playlist.
Alternatively, you can select to play a random artist (see the configuration)
The script access the database. I've only tried with MySQL. I think that the "album" mode will work with SQLite, but not the "Artist" mode.
Version 0.3 2006 10.09
For amarok 1.4.3 and above(?) ONLY! For ealier versions use 0.2
Changed script to work with Amarol 1.4.3
The "tags" table in the database now contains the path of a file below
a given "device" (defined in table "devices"). The script now handles
that correctly using KURL.
The "album path" filter filters according to the path below the "device"
path. The device path is not taken into account
BUG
No attempt is made to check that the files do exists... This may be
problem.... There seem to be no such a method with KURL and the
"unicode" function refuse to take a QString (PyQt says it should)
so I can't convert things to use os.path.isfile()
Version 0.2 Aug 12 2006
Fixed a few bugs
The script will now terminates
Files with '?', '#',... should
now be handled correctly.Now
Pink Floyd's The Wall will play
the first track too.
Commented out the debug lines.
Some string encoding problemwould
sometime crash the script.
Change.
When dealing with multiple albums
with a common name, they will be
played in sequence rather than be
intertwined
New feature
You can specify where the albums
you want to play must be located
When using the "artist" mode, the
artist must be found in the
specified subtree, but the songs
will be selected from the whole
collection
Ratings & Comments
10 Comments
When getting to the last song playlist is cleared like it should be, but for some reason script does not load new album to playlist. Same behavior in both Album and Artist mode. Any suggestions what's wrong? Ubuntu 9.04 Amarok 1.4.10 with SQLite Database
When I try to run this script I get a dialog box telling me "dcopext module is required for this script" and then an error message: The script 'randomalbum.py' exited with error code: 1 Traceback (most recent call last): File "/home/alan/.kde/share/apps/amarok/scripts/random-album/randomalbum.py", line 30, in <module> import dcopext ImportError: No module named dcopext I tried sudo apt-get install python-dcop and that didn't seem to help. Can anyone give me some help getting this to work?
Whenever a new album is loaded it places the songs themselves in a random order. Amarok itself isn't playing them randomly though. They are played sequentially in the order they are loaded. I checked the configuration options but this isn't an option. Has anyone else experienced this and know how to stop it from happening?
I'm also wondering why a Random Album dynamic playlist isn't included. While it is one more step to go to the script manager and run it manually it is worth it for the function I'm looking for. Good job and thanks much. Cheers! Mathew
A suggestion: Allow user to determine if only one album should be played, how many successive albums are to be played or leave it at the default which is its current behaviour (it continues to reload the playlist with a new album until told to stop).
Alright.... I always thought I would find it in one of the "dynamic playlist". In any case, the "random artist" feature is still "new" and it could be easily extended to offer other tags (e.g. year, genre, ....) Anyway, I learned how to write a script for amaok.... Not a total loss.. for me :)
On second thought...I tried the "Random -> Album" mode... And it did not behave the way I liked. I'll use my script after all, I feel it behaves more like a dynamic playlist.
sorry, but album random play has been in amarok for a long long time. it's just one of the options you have for random playing: normal, random, album random.
this requires putting your whole collection into the playlist, so this script indeed does something that Amarok can't do. However I would expect a Random Album script to load complete albums only. Of course it can't know which albums are complete. Except by making the file path user-definable (this is not a feature request :) because... Another idea to approximate the desired behavior is a smart playlist like: - match my complete albums path - match track no. 1 - random order - some limit Start playing and when you want to listen to the entire album just load it from the context browser...
Thank you for your comment. Adding the "full album path" filter should not be complicated. Currently the "album" info is extracted from the database.. and that leads to a bug I recently found when 2 albums have the same title... With the "full album" path, the script would simply randomly select an "album" from the DB and check if it is in the right place. If not it would select another one. Using the tracks "path" is also an easy way to solve the bug I mentioned above. Naturally this means that the music collection is more than a directory full of files :) Cheers