Posts Tagged ‘ QtScript

Amarok: Recently added ablums

You probably noticed the "Recently added Albums" in the album-applet (to be more specific: the current-view) of the context view while Amarok stops playing. I always thought that this is the only way to track down which albums were recently added to the collection. The problem is, that this applet only shows the last 5 added albums. So I always wait a couple of minutes/seconds and copy the next five albums to the collection-folder, to add these to my daily playlist.

Today I was really upset of this behavior and decided to write my own amarok-script for this purpose. So I cloned the amarok trunk and took a look in the amarok scripting engine. After querying the lastest albums with the Amarok script console (see code-snippet), I asked on #amarok for some information about interacting with the context-view. I also find a wishlist entry on bug.kde.org concerning this topic: https://bugs.kde.org/show_bug.cgi?id=181660.

Amarok.Collection.query("SELECT artist.name, album.name FROM tracks AS track LEFT JOIN artists AS artist ON track.artist=artist.id LEFT JOIN albums AS album ON track.album=album.id GROUP BY album.id ORDER BY track.createdate DESC LIMIT 10")

The solution was easy ... this feature already exists: just use the collection filtering:

  • "added:today" show the tracks/albums added today
  • "added:<2w" in the last 2 weeks
  • "added:<1m" in the last month
  • "added:<2m2w" in the last 2 month and 2 weeks

amarok_filtering

Afterwards I found out that the feature was released in Amarok 2.1 Beta (see changelog) - so .. I really should read the changelogs. ;)

Amarok Scripting: