Random Album

Amarok 2.x Scripts

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

6
6.4
Description:

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
Last changelog:

9 years ago

* 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.3:
. Add new action to enable / disable the playlist monitor.


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


* Version 0.1:
Initial version. What works:
. loading and enqueueing a random album.

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.

C

mvanzin

11 years ago

I stared at the script API for a while and couldn't see a way to detect that "stop after track" is enabled... so I guess the only way to stop the script currently is to go to the script manager and stop it there.

I'll look at adding an easier way to stop the script.

Report

jajaxor

11 years ago

ok thanks ;)

Report

skiron

11 years ago

Hi!
First of all, thank you for updating the old amaroK 1.4 script to amaroK 2.
I really like this feature, and in my opinion, it should be built in amaroK.

And I'm sorry to come with bad news... But once installed and enabled, when the last title in the playlist is finished, amaroK goes crazy: it loads a new album and in the milliseconds after it erases the playlist and loads another album an so on for 20 to 40 seconds. It changes album so fast that the "current played title" info (in the middle panel) has no time to refresh to every new title. At the end, one title is finally played, but the playlist is empty (there is even no the current played title).

I really love to have this script working, so if you need any test, don't hesitate to ask !!
I'm running on Kubuntu 9.04 - amaroK 2.0.1

(I've got a log of the execution, but it's quite big, so I won't post it here, but if you need it, just ask ;-) )

Report

C

mvanzin

11 years ago

Thanks for the comments. I'm using Amarok 2.0.2, so there's a chance that something may have changed that makes the script work on that release...

In any case, you can send the output to my e-mail (it's at the top of the script's main.js) so I can see if someone interesting pops up.

One thing you can try is to increase the delay between detecting the end of the playlist and replacing it; on line 199 of main.js, change:

timer.start(10);

To:

timer.start(200);

(Or some other value.) Without this timer Amarok got really confused when the script ran, so maybe something similar is happening in your case.

Report

skiron

11 years ago

So, I tried to change the value you told me. The only change it made is that a title was played the amount of time written before the playlist was refreshed... :-(

So I simply updgraded to amarok 2.0.2, and now it works just as it should !!!

Thanks for your answer!!

I would like now to ask for an improvement:
it would be wonderful if one can choose the type of the new album loaded. For example, I would like that the new album has the same genre (style) that the one just played. But it could be the same artist or the same year...

Report

9 years ago

* 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.3:
. Add new action to enable / disable the playlist monitor.


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


* Version 0.1:
Initial version. What works:
. loading and enqueueing a random album.

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.

12345678910
36
product-maker KarenK May 16 2012 9 excellent
product-maker arch0njw Jun 10 2011 9 excellent
product-maker Aiwendil Jan 18 2011 3 bad
product-maker ZLv Jan 18 2011 9 excellent
product-maker i4dnf Jan 06 2011 3 bad
product-maker i4dnf_double Jan 06 2011 3 bad
product-maker PingusPepan Nov 29 2010 9 excellent
product-maker lunacymaze Nov 08 2010 9 excellent
product-maker WillS Oct 04 2010 9 excellent
Be the first to comment
agt499
Jan 15 2013
maroach
Jan 20 2011
lunacymaze
Nov 08 2010
sxe
Sep 12 2010
WillS
Jul 16 2010
jajaxor
Jun 09 2009
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
1.0
updated Mar 02 2011
added May 09 2009
downloads 24h
0
mediaviews 24h 0
pageviews 24h 1
System Tags addon