Image 01
profile-image

pen2

Martin Höher Dresden, Germany
Amarok 2.x Scripts
System Software
Intelligent Playlist

Amarok 2.x Scripts 19 comments

by pen2
Score 73.1%
Dec 28 2010
Hm... AFAIK the above code should work out-of-the-box (and for me it does; I didn't import packages in Script Console and the example still works flawlessly).

Which version of Amarok do you use? I remember there were some issues with my plugin, too. For me, I once added the "file://" prefix to the rpath. However, in recent versions, Amarok stopped accepting these. I do not really remember, but if your Amarok is a bit older, try adding the "file://" prefix, too.

Finally, I also recommend contacting the Amarok developers (see http://amarok.kde.org/en/contribute). They surely know more about the issue than I do. - Nov 19 2010
Hey,

the following works for me:


var songs = Amarok.Collection.query( "SELECT rpath FROM urls LIMIT 10;" );
for ( var i in songs ) {
var path = songs[ i ];
Amarok.Playlist.addMedia( new QUrl( path ) );
}


That's all. You can use Amarok's built-in Script Console for testing (go to the script manager and check the "Amarok Script Console" entry).

I don't know what you already tried, however: Amarok's database tables are pretty good normalized, i.e. the table tracks contains only some rare data. The url field indeed contains a "pointer" to an entry in the urls table. So you have to use joins to get the data. Consider the following example:

You have the ID of a track you want to add to the playlist. Then your query could look like this:


var id = 321;
var url = Amarok.Collection.query( "SELECT url.rpath FROM tracks AS track INNER JOIN urls AS url ON track.url = url.id WHERE track.id = " + id + ";" );
Amarok.Playlist.addMedia( new QUrl( url[ 0 ] ) );



Okay, I hope this helps so far ;) Feel free to ask if you have further questions.

PS: For a good overview of Amarok's database layout, see here: http://gitweb.kde.org/amarok.git/blob/HEAD:/docs/database/amarok_db_schema.png - Nov 18 2010
Hi
Just released version 0.1.5. This should fix your problem ;) Thanks again for reporting the problem ^^ - Nov 10 2010
Okay, thank you for the information.

Today I installed Ubuntu in a virtual machine for testing and indeed the script is not working there, too. However, I somehow think this is rather a problem with the script bindings than Amarok-related, as e.g. some KDE widgets are no longer working with the old code.

I will review this ASAP, but I cannot say for sure when I'll release a new version (I'm currently a bit short of free time, so fixing the plugin could take a while, sorry for that). - Oct 16 2010
Well, it indeed could be a problem with the configuration files...
Meanwhile I compiled and installed Amarok from Git; however, I do not get the problem - the plugin's working fine here.

For testing you could do the following:
Quit Amarok and open up a terminal window, there, execute the following commands:

First, make a copy of the amarokrc file:
cp .kde/share/config/amarokrc ~

amarokrc is Amaroks main configuration file, where also all plugins' settings are stored. The above command will make a backup copy of it in your Home.

Now edit this file, e.g. with kwrite:
kwrite .kde/share/config/amarokrc

Search for a line reading [Intelligent Playlist]. Delete it and the following lines until the next section.

Then restart Amarok and try whether the plugin works again.

If it does, the problem is indeed related to the configuration. If not, you could copy back the backed up version of the amarokrc file to restore the plugin's settings. In either case, please report back the results of that test. Thank you! - Oct 15 2010
Hey,
thank you for reporting this!

I'm sorry, but I cannot say for sure what the problem might be.

I'm currently using Amarok 2.3.1; I'll update to a newer version, so I hope to find the problem rather soon ;)

In the meantime: How exactly did you upgrade? Did you completely reinstalled your system or did you do an update out of the running system (and thus kept your existing configuration files)? - Oct 13 2010
Thank you for reporting this.

I fixed the problem an uploaded the new version. So, hopefully it works now ;) - Sep 05 2010
No problem. Already extended my packaging scripts, so starting with the next release I'll include all necessary information in the archive file name ;) - Mar 03 2010
Hi
Thank you for pointing this out ;) I made some restructuring recently but somehow omitted testing the second mode ^^'
Already fixed the bug and uploaded a new version, so I hope it now should fully work. - Mar 02 2010
KEmu

System Software 11 comments

by pen2
Score 58.0%
Dec 13 2009
OK, I've just packaged and uploaded the current version from repository.
This should fix this problem (at last I hope so, because my tests suggest that indeed this issue is due to different behavior of Ruby 1.8 <-> 1.9) - Dec 13 2009
Cool, thank you for the info :)

I've already pushed a fix to Gitorious (see http://gitorious.org/kemu/kemu) and will package a new version ASAP. - Dec 13 2009
Glad to hear this ;)

What encoding do you use (AFAIR this is set in /etc/rc.conf via the LOCALE variable in Arch)? I guess you use something else than utf-8?

Nevertheless, I will try fix the issue in the next release (I guess Ruby provides some mechanism to force it to use a given character encoding). - Dec 13 2009
Jep, see above:
The ui_*.rb files must first be generated using the Makefile in the ui directory: Simply run `make ui` there. This is because the "source" package is packaged directly from the repository, and there no generated files are stored.

To be honest, I don't like this either, so hopefully in the next release the generation of the ui/rb files can be done with cmake, too.

@wrong encoding:
Thank you for pointing this out. May I ask you what system (distribution/architecture/Ruby version) you use? For the meantime: Simply replace/remove my name from there - this should fix it for now. - Dec 13 2009
Hi!

First of all: Sorry, I believe the included README needs some review - especially as KEmu experienced some restructuring recently.

To "build" it, do:
cd /path/to/kemu/src/ui
make ui
cd ../..
mkdir build && cd build
cmake ..
make && make install
kbuildsycoca4


Note that you will also need KDE's development packages installed, as KEmu's CMake files currently use some macros defined there.

If you do not want to install these additional packages, you can also use the self-extracting archive, as it requires no further ado. Simply run it in a terminal via
sh ./kemu-0.0.3-Linux.sh

Hope that helps ;) - Dec 13 2009
My style

Wallpaper Other 8 comments

Score 50.0%
Oct 27 2009
You know, it's somehow difficult to really use all your wallpapers ;) You just produce new excellent ones too fast ^^

Nevertheless, keep it up! - Oct 29 2009
KLatexFormula

Utilities
by phfaist

Score 70.0%
Dec 02 2009
My style

Wallpaper Other
by Lemonade

Score 50.0%
Oct 29 2009
Score 84.7%
Oct 22 2009
Oxyglass

Plasma Themes
by Numerus

Score 77.8%
9   Jul 30 2011
KDM Horos (KDE 4.6)

KDM4 Themes
by rezz

Score 80.0%
9   Jun 26 2011
Fedora_on_Metal

Wallpaper Other
by onyxia2005

Score 72.2%
9   May 22 2011
4 seasons

Wallpaper Other
by DmitryNoD

Score 72.2%
9   Oct 17 2010