
Moodbar Generator [DEPRECATED]
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
Amarok2 script.
DEPRECATED: please use this one - http://kde-apps.org/content/show.php?action=content&content=135625&PHPSESSID=69aa9cc0c1c0dd1cb15cbe6a1047a00d
Automatically generates moodbar files for currently playing song.
devenv
10 years ago
http://kde-apps.org/content/show.php?action=content&content=135625&PHPSESSID=69aa9cc0c1c0dd1cb15cbe6a1047a00d
Report
janet
10 years ago
Report
HessiJames
10 years ago
since the script is really short, i guess the bug lies within amarok, but you should be careful as long as this bug exists.
https://bugs.kde.org/show_bug.cgi?id=238584
Report
devenv
10 years ago
The only files related stuff is checking for file existence and running moodbar...
So I guess it's either in the amarok or in moodbar...
Do you have the latest dev. ver. of moodbar too?
Report
HessiJames
10 years ago
path.replace(/^(.*)\/(.*?)\.(.*?)$/, "$1\/.$2.mood");
just returns the original path causing moodbar to overwrite/delete the input file.
so why am i the only one this is happening to?
Report
krohlas
10 years ago
Report
HessiJames
10 years ago
Report
devenv
10 years ago
Not sure why regex doesn't work for you there.
Can you add this line:
Amarok.alert(mood);
after the line with regex and check what it shows?
Report
devenv
10 years ago
What amarok expects is the mood file for 'filename.ext' as '.filename.mood'.
So what that line does is return the mood filename.
This regex can't return the same filename as it always appends the original filename with 'mood' and prepends with '.', even if it doesn't parse the filename right for some reason.
For reference on greedy and lazy '*' take a look here:
http://www.regular-expressions.info/reference.html
search for 'lazy star', one before it is the greedy star.
It's not a bug, it's a part of regex, and I really don't think QT removed support for it :)
Report
HessiJames
10 years ago
your regex reads like you want to also catch files without extensions, but that would be ^(.*)\/(.*)(\.(.*))?$
i might be wrong, but i think that *? is simply invalid and that newer qt versions can handle this error while older versions can't.
an alert in moodbar generator is unnecessary, i catched all parameters by a wrapper script to moodbar, this is how i figured out, that the regex replace failed.
it works fine with the regex, i wrote in the last post. and if you can explain what you wanted to do with the ? we should be able to add this, too.
Report
devenv
10 years ago
I don't think it's qt version issue.
Can you post the filename that is being deleted, I think it might be something escaping related... Hard to believe though.
Report
HessiJames
10 years ago
/home/daniel/Musik/Sammlung/Trance/Verschiedene Interpreten/Bravo Hits Zima 2007/1 - 07 - Starting Rock - Don't Go.mp3
/home/daniel/Musik/Neu/Amy MacDonald - This Is The Life/09 A Wish for Something More.mp3
i had a closer look at the regex and the use of a * followed by a ? doesn't make sense to me, i tested the regex with kwrite (if it also couldn't handle it) and here the replace buttons are grayed out as long as *? is in the search field.
^(.*)\/(.*)\.(.*)$
does the job.
Report
HessiJames
10 years ago
Report
krohlas
10 years ago
I tried hard to reproduce the bug, but I was not able to. So I have no idea what is causing this or if it's an false alarm.
Two other things:
1. That script implements functionality which most users want to see in Amarok. You should really move it to Amarok Git. I would then also help to add a "create all .mood files for the collection" tool.
2. It fails if the file name contains more than one dot. The regexp to determine the name of the mood file cuts the path at the very first dot.
Report
devenv
10 years ago
I don't think it's good enough solution to move it to amarok src, it's more like a hack. The mood files should be in .kde4 dir somewhere in my taste, and mood files generation shouldn't happen when a track starts to play but on collection update. So there is some work to do...
Report
krohlas
10 years ago
Apart from that: your script is already as good as Amarok 1.4 was in the area of creating .mood files. And it is definitely an improvement of the current situation in Amarok 2.
If it was in git I would help to create a "calculate moods for all files in collection" tool with it. ^^
Report
devenv
10 years ago
http://gitorious.org/~devenv/amarok/devenvs-moodbar_generator_script
Added you as collaborator, I guessed it's the same username...
Report
devenv
10 years ago
Report
maurinux
10 years ago
i had change a little bit your code, in this way if a .mood file exists the script doesn't recreate it.
here is the code:
if (!QFile.exists(mood)) {
args = ["-o", mood, path];
QProcess.startDetached("moodbar",args);
}
Report
devenv
10 years ago
Any idea how to make it update mood files before the next track? I don't think it always works for new tracks.
Report