
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
For a long time I wanted to play a random "album" in Amarok. I could not find how to do it with what existed, so I got around to write my own (first) amarok script.
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.
14 years ago
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
14 years ago
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
maroach
11 years ago
Ubuntu 9.04
Amarok 1.4.10 with SQLite Database
Report
monguin61
11 years ago
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?
Report
theillien
12 years ago
Has anyone else experienced this and know how to stop it from happening?
Report
theillien
12 years ago
Cheers!
Mathew
Report
theillien
12 years ago
Report
frawau
14 years ago
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 :)
Report
frawau
14 years ago
I'll use my script after all, I feel it behaves more like a dynamic playlist.
Report
Superstoned
14 years ago
Report
camico
14 years ago
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...
Report
frawau
14 years ago
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
Report