An amarok script that monitors the playlist, and, when it's finished, repopulates it with a random album from the collection. Differently from amarok's built-in "random album" mode, you don't need to keep the whole collection in the playlist; so when you add new stuff to the collection the script will automatically pick it up, and it's easy to manually enqueue songs into the current playlist without the "random mode" triggering whenever the current album finishes playing.

This script is inspired and very loosely based on the randomalbum.py script for amarok 1.4, available at the following URL:

http://www.kde-apps.org/content/show.php?content=42764

Changelog:

* Version 1.0:
. some tweaking to the monitoring code to make the script behave better in amarok 2.4.

* Version 0.9:
. monitor track changes, so that skipping the last track on a playlist will also make the script load a new album. Suggested by kronos003 (irc.freenode.net).

* Version 0.8:
. add support for genre filtering (contributed by Ghislain Mary)

* Version 0.7:
. minor update to work around an issue where playback wouldn't start when loading a new album. Delay the start of the playback a little to let amarok's UI properly refresh.

* Version 0.6:
. persist the list of played albums so that the same album isn't played after restarting amarok.
. if running in amarok 2.3.1, respect the "stop playing after current track" setting.

* Version 0.5:
. fix an issue with path filtering not doing what it was supposed to do in some cases
. remove some code that caused the script to freak out when stopping playback when the last track of a playlist was active.

* Version 0.4:
. Reworked the SQL queries; they should work better on databases that did not look like mine.
. Added option to filter the albums being loaded according to a string (matched against the album path).

* Version 0.2:
. Updated to work with amarok 2.1. Hasn't been tested with 2.0.2...

Known issues:
. the playlist sometimes doesn't repaint correctly after an update. Clicking somewhere on the playlist fixes it (looks like an Amarok problem).
. only tested on my setup, so I don't know how it will work with collections spanning different devices, etc.

Tracks added don't belong to the right collection

This is a nit-pick because I like my "play count" to be updated properly.

I am running Kubuntu 12.04 and Amarok 2.5.0. When I use this script, it is now adding tracks with a "Collection" value of "None" on the "Summary" tab. This means the play could isn't being updated correctly for the tracks which are technically in my "Local Collection".

I hope this is simple to fix. This script is awesome!

Any sufficiently advanced technology is indistinguishable from magicReply to this

Same-named Albums

Hi -awesome script for a function that should really be mandatory everywhere.
Just had the first-i-have-ever-noticed experience where two albums by different artists got randomly selected due to the same Album Name, and playt Track 1 Artist 1,Track 1 Artist 2,Track 2 Artist 1,Track 2 Artist 2.
Not sure if this is the script or Amarok (which I'm certain used to discern separate albums with the same name?)

Thanks for the cool script!

Re: Same-named Albums

Thanks!

As for the problem, it's funny because I have code to work around exactly that situation... if you know how to do it, it would be nice if you were able to manually run the queries used by the getAlbum() function (in main.js) on your database, for the offending album.

Right at the start of function getAlbum, I hard-coded aid=1290, and that returned that artists.length=1.

If I sort my collection by Album I get the same result -one album with tracks intermingled, so it looks like the schema has regressed to the old 1.4 behavior you reference in the code comments, except that the your just-in-case is no longer working.

If I get more real work done tomorrow I may look to open a bug on Amarok (Version 2.5.0 here).

How do you like Plasma 5? The best KDE Desktop ever. Definitely a nice improvement. Not decided yet. Haven't tried it yet. I do not like some of the changes. KDE is taking the wrong way. I am still sticking with KDE 3.5. I have no opinion, but wanted to vote anyway.

Copyright 2003-2015 KDE-Apps.org Team All rights reserved. KDE-Apps.org is not liable for any content or goods on this site.All contributors are responsible for the lawfulness of their uploads.KDE and K Desktop Environment are trademarks of KDE e.V.