Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

1
Become a Fan
5.0

Description:
Score2Rating is a script that converts the scores of your tracks in Amarok to ratings using some
pretty accurate intervals. (In the future, the intervals might become changeable).
This is mostly usable to give you a starting point for using the new rating system in Amarok 1.4.
Tracks that already have a rating will only be updated if the calculated rating is higher.
If you have kdialog installed, a nice progressbar will be displayed showing how the script progresses.
It is recommended that you back up your database (the statistics table at least) before
running this script. It should do no harm, but you can never be too safe...

Requirements:
Amarok 1.4-beta3 or newer
Ruby 1.8 (not sure about the version, 1.6 _might_ work, I didn't test it.)

====================================
WARNING! READ THIS BEFORE UPGRADING FROM v2.0!
v2.0 had a packaging bug that will remove all other scripts when you uninstall it.
This can be fixed by (instead of uninstalling) manually removing the files "README" and "score2rating.rb" from your ~/.kde/share/apps/amarok/scripts folder and then restarting Amarok.
YOU HAVE BEEN WARNED!
====================================
Last changelog:

2006-07-27 (v3.0)
I'm an idiot. I made the script WAY to advanced from the beginning.
I can't believe I didn't come to think about this earlier.
Anyhow. instead of running 4 dcop calls per track (and some more), this version runs a grand total of 9 dcop calls (one per rating) to Amarok and 10 to update and close the optional progress bar KDialog. It doesn't even care about the problemous file names. On my computer with my ~1000 track music collection, this is more than 500 times faster, seriously. It's all about SQL Magic!

(This new version is tested successfully with both MySQL and SQLite, but not PostgreSQL. If you've run it successfully with PgSQL, pop me a note, preferably via email.)


2006-07-26 (v2.5)
This should REALLY fix the problems some people are having by escaping all (?) special characters that confuse the dcop query commands (', " and `). The most common problem seems to have been files with "double quotes" in their file names. (I was able to reproduce the error).
This version also adds better error handling so the script can finish cleanly even if it encounters an error.

2006-07-16 (v2.2)
Sorry about this version mess, but I found a bug with the conversion (tracks with score 100 wouldn't get any rating).

2006-07-16 (v2.1)
This release should fix the errors some people get by also escaping backticks. (It works for me now, and I could reproduce it before the fix.)
It also fixes a packaging bug from 2.0, which would make uninstalling the script remove all other installed scripts.

2006-07-12 (v2.0)
Finally the script works again, much because of a patch I got from Elliot Pahl (halcyonCorsair).
The script now also updates ratings of tracks that already have a rating (but only if the new rating is higher).
Additionaly, a KDialog progressbar was added.

2005-12-20 (v1.2)
Removed the unneeded .svn dir from the package file...


Ratings & Comments

16 Comments

5er

Where can I get those stars ratings? I have amarok 1.4.8, but the ratings are not there.

htownallstar555

Your scrip works but I have one problem. Do you know of a script that will automatically score the song or can you tell me how to create one

TOD

Hi I have downloaded 2.2 and this error is shown on 25%: /home/manuel/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:46:in `Float': invalid value for Float(): "" (ArgumentError) from /home/manuel/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:46 from /home/manuel/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:40:in `each' from /home/manuel/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:40 from /home/manuel/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:24:in `loop' from /home/manuel/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:24 THX for Help TOD

Firetech

This SHOULD be fixed in v2.5, at least you will be given an error report to send to me (if it doesn't work).

TOD

Hi I get the folow error on 25%: /home/manuel/.kde/share/apps/amarok/scripts/score2rating.rb:46:in `Float': invalid value for Float(): "" (ArgumentError) from /home/manuel/.kde/share/apps/amarok/scripts/score2rating.rb:46 from /home/manuel/.kde/share/apps/amarok/scripts/score2rating.rb:40:in `each' from /home/manuel/.kde/share/apps/amarok/scripts/score2rating.rb:40 from /home/manuel/.kde/share/apps/amarok/scripts/score2rating.rb:24:in `loop' from /home/manuel/.kde/share/apps/amarok/scripts/score2rating.rb:24 THX for Help TOD

cannajunk

got error code around 18% / 19% sh: -c: line 0: unexpected EOF while looking for matching ``' sh: -c: line 1: syntax error: unexpected end of file /home/vincent/.kde/share/apps/amarok/scripts/score2rating.rb:46:in `Float': invalid value for Float(): "" (ArgumentError) from /home/vincent/.kde/share/apps/amarok/scripts/score2rating.rb:46 from /home/vincent/.kde/share/apps/amarok/scripts/score2rating.rb:40:in `each' from /home/vincent/.kde/share/apps/amarok/scripts/score2rating.rb:40 from /home/vincent/.kde/share/apps/amarok/scripts/score2rating.rb:24:in `loop' from /home/vincent/.kde/share/apps/amarok/scripts/score2rating.rb:24 Any help is welcome ;-)

Firetech

Must be a problem with the filenames in your collection. Probably one of them contains a ` (backtick), which makes the script confused. I'll look into it.

Firetech

This should be fixed in v2.2 (and v2.1, 2.2 just fixes a conversion bug), I tried it and got it to work successfully.

bitcrazy

Hi, sorry but the error is still here: /home/ds/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:46:in `Float': invalid value for Float(): "" (ArgumentError) from /home/ds/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:46 from /home/ds/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:40 from /home/ds/.kde/share/apps/amarok/scripts/score2rating/score2rating.rb:24 Greetings m0nk

amarok

Jocke, it's a good idea to use exception handling to catch such runtime errors. --Mark

dangle

I'm getting ruby errors with 1.4-svn (build date March 21) - has something changed with the script manager? /home/dangle/.kde3.5/share/apps/amarok/scripts/score2rating/score2rating.rb:34:in `Float': invalid value for Float(): "" (ArgumentError) from /home/dangle/.kde3.5/share/apps/amarok/scripts/score2rating/score2rating.rb:34 from /home/dangle/.kde3.5/share/apps/amarok/scripts/score2rating/score2rating.rb:32 from /home/dangle/.kde3.5/share/apps/amarok/scripts/score2rating/score2rating.rb:21 Regards, Christie

dangle

apparently the script isn't tested on recent versions and isn't being supported... I'll see if I can find out what's going on and post a fix later, if anyone's interested.

stifi

I don't know if you have found a solution. Anyway changing line 33 into sqlurl = url.gsub( /'/, '\'\'' ) solved the problem for me.

MikeM

Hello, As I have version 1.3.6 (which doesn't contain the field 'rating' in the 'statistics' table from the database) I didn't make use of your script but I looked at the source and I have a little question. When you do case foo when 0...5 (...) when 5...10 (...) isn't the 5 ambigious ? Tahnk you :) PS: I noticed that your tarball contains the .svn directory (5Ko~)

Firetech

I had to wrap the intervals, else some ratings would stay nil (I don't really get why). As I'm comparing a float with integers, it's kind of logical. (Although, I got the same behaviour when I converted the score to an integer too...) Thanks for noticing the .svn dir, I'll remove it as soon as I get home... (I'm in school now, and I don't really want to publish a WinRAR-created bz2 file here... ;) ) I panicked for a while when I thought that the password was saved there, but it wasn't... phew.

Qerub

Actually, no. 5...10 is the range [5,10[. 5..10 is [5,10] though.

Pling
0 Affiliates
Details
license
version 3.0
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

More Amarok 1.x Scripts from Firetech:

G15-Simple
Firetech
last update date: 16 years ago

Score 5.0

Other Amarok 1.x Scripts:

Gnome Play Video in Totem
mwheatland
last update date: 19 years ago

Score 5.0

editLyrics-gnome
ZeeD
last update date: 19 years ago

Score 5.0

amarok Alarm
aroth
last update date: 16 years ago

Score 5.0

amaroK Web Collection V xmms
pti-jean
last update date: 16 years ago

Score 5.0

SongLogger
lucatnt
last update date: 17 years ago

Score 5.0

amaroK Web Collection
pti-jean
last update date: 16 years ago

Score 5.0



System Tags