
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
AmarokScreenSaver
Displays information about the currently playing song as a screensaver
I often use my computer to play music when I am having visitors or when I am just not in front of the monitor. I wanted some way to still be able to see what song was playing. As my TV is connected to the computer I decided to make a screensaver that would do just this. (you don't need to even own a TV to use this script, but my TV is in my living room and my computer is not...)
This script creates an image based on the currently playing song in Amarok, then changes your screensaver to KSlideshow and tells it to display this particular image. It restores your original screensaver settings when you stop the script or exit Amarok.
The script has some basic settings configurable via a dialog:
Party / safe - mode:
The script can be configured to lock the screensaver, you will need your password to return to the desktop. This is great if you are having a party and don't want everybody to use the computer for surfing or changing track every other minute.
DPMS:
I use display power management to turn off my monitor after a given period of time. This did not work well with my idea. Therefore I created an option to turn off DPMS, and turning it back on when the script is exited or Amarok is shut down.
Rotate image placement:
To prevent damage to the screen the images can be placed at random position, or fixed.
Screen width:
Enter the width of your screen in pixels
Screen height:
Enter the height of your screen in pixels
Cover factor:
Size of the cover relative to the size of your screen (in percent).
Requirements:
- Amarok (duh...)
- KDE, not sure if it will work with anything else, at least KScreensaver and KSlideshow is needed
- ImageMagick
- PyQt (Only to configure the script, this can also be done manually by editing a textfile)
12 years ago
Version 0.5.0:
- Works with KDE4 (>= 4.0.5)
- Does not start the screensaver if computer is in use (KDE4 only)
Version 0.4.1:
- Restores your original screensaver settings when you stop or pause playback (as well as when you exit Amarok).
Version 0.4.0:
- More config options
- Added reflection
- xwininfo and bc no longer needed
- Settings not lost when you reconfigure
- Tracknumber not shown when there is none
Version 0.3.1:
- Fixed bug where screensaver did not find any images after being active for a while
Version 0.3:
- Takes care of Kopete status. No longer changes status on each trackchange.
- The screensaver stays active on trackchange. Amarok is no longer shown
- Changed the name from KoverSS to AmarokScreenSaver
Version 0.2.1:
- Regression fix, images have better quality again!
Version 0.2:
- Better configuredialog
- More screen-friendly. Creates more than one image with the text and cover art in different places.
- Various fixes and speed improvements
Version 0.1.2:
- Works even if user has no screensaver set (Thanks to David Hugas Germí )
Version 0.1.1:
- Cover image now has better quality
Version 0.1:
Here we go!
12 years ago
Version 0.5.0:
- Works with KDE4 (>= 4.0.5)
- Does not start the screensaver if computer is in use (KDE4 only)
Version 0.4.1:
- Restores your original screensaver settings when you stop or pause playback (as well as when you exit Amarok).
Version 0.4.0:
- More config options
- Added reflection
- xwininfo and bc no longer needed
- Settings not lost when you reconfigure
- Tracknumber not shown when there is none
Version 0.3.1:
- Fixed bug where screensaver did not find any images after being active for a while
Version 0.3:
- Takes care of Kopete status. No longer changes status on each trackchange.
- The screensaver stays active on trackchange. Amarok is no longer shown
- Changed the name from KoverSS to AmarokScreenSaver
Version 0.2.1:
- Regression fix, images have better quality again!
Version 0.2:
- Better configuredialog
- More screen-friendly. Creates more than one image with the text and cover art in different places.
- Various fixes and speed improvements
Version 0.1.2:
- Works even if user has no screensaver set (Thanks to David Hugas Germí )
Version 0.1.1:
- Cover image now has better quality
Version 0.1:
Here we go!
bhing
12 years ago
Report
nebbus
12 years ago
I have songs with æøå in the names and ID3 tags as well (I live in Norway). They show up fine. How does Amarok show the names? Could you try to execute:
dcop amarok player title
dcop amarok player artist
when you are playing a song with this problem? Post the output here.
Report
bhing
12 years ago
Amarok displays the names correctly with ALL the correct characters, regardless of language and letter type.
dcop amarok player title
dcop amarok player artist
Gives me exactly the same CORRECT output in terminal, as in Amarok.
I just inserted a Norwegian song to show you the difference. (Lousy song by the way ;) ) The top of the image is the print screen from the Amarok playlist, the bottom part is from the screen saver image final.png:
http://img78.imageshack.us/img78/2875/amarokandscreenij4.png
Any help is highly appreciated.
Again, thanx for a beautiful script.
Report
nebbus
12 years ago
convert -size 500x120 xc:black track.png
artist="`dcop amarok player artist`"
album="`dcop amarok player album`"
mogrify -quality 100 -fill white -pointsize 20 -draw -draw "text 100,50 \"$artist\"" -draw "text 100,80 \"$album\"" track.png
It should create an image (track.png) in your working directory. Check if you have the same problem.
Then:
convert -size 500x120 xc:black track.png
artist="æøåÆØÅ"
album="æøåÆØÅ"
mogrify -quality 100 -fill white -pointsize 20 -draw -draw "text 100,50 \"$artist\"" -draw "text 100,80 \"$album\"" track.png
And see if the same problem is still there.
What version of KDe and Amarok are you using?
Report
bhing
12 years ago
convert -size 500x120 xc:black track.png
artist="`dcop amarok player artist`"
album="`dcop amarok player album`"
mogrify -quality 100 -fill white -pointsize 20 -draw -draw "text 100,50 \"$artist\"" -draw "text 100,80 \"$album\"" track.png
track.png still displays the exact same problem with letters. (had to remove one "-draw" to display both artist and album in track.png ;) )
Quote:Then:
convert -size 500x120 xc:black track.png
artist="æøåÆØÅ"
album="æøåÆØÅ"
mogrify -quality 100 -fill white -pointsize 20 -draw -draw "text 100,50 \"$artist\"" -draw "text 100,80 \"$album\"" track.png
And see if the same problem is still there.
Still the same problem, æøåÆØÅ turning out really crazy. So the problem does not seem to be with dcop...
Quote:What version of KDe and Amarok are you using?
Kubuntu 8.04.1
KDE 3.5.10
QT 3.3.8b
Amarok 1.4.9.1
On a side note; I tried a similar script using a theme in Superkaramba and that displayed everything correctly using dcop.
Don't know if that helps at all, but thanks for staying with me...
Report
nebbus
12 years ago
convert -size 500x120 xc:black track.png
mogrify -quality 100 -fill white -pointsize 20 -draw "text 100,50 \"${dcop amarok player artist}\"" -draw "text 100,80 \"${dcop amarok player album}\"" track.png
Report
nebbus
12 years ago
I don't think I should use absolute paths in the script, but this will help others having a similar problem.
Report
bhing
12 years ago
The listing of fonts only gives you the names and not the path to them. I tried it earlier, but it didn't work.
But I got it to work now anyway, and it seems the bug I mentioned was the problem:
https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/69531
type.xml points to type-ghostscript.xml which in turn points to the wrong search path for all fonts. The only thing I was left with, was a very basic default font. Looking through
/usr/lib/ImageMagick-6.3.7/config/type-ghostscript.xml
I found the correct paths to all fonts and used one of them like this:
convert -size 500x120 xc:black track.png
mogrify -quality 100 -fill white -pointsize 20 -font /usr/share/fonts/type1/gsfonts/n021003l.pfb -draw "text 100,80 \"$(dcop amarok player album)\"" track.png
I replaced line number 161 in AmarokScreenSaver.sh with the last part and everything works perfectly! I see every letter there is to see.
Again, magnificent script! I will continue to use it daily. And thanks a lot for helping out! Very much appreciated.
Report
nebbus
12 years ago
mogrify -list font
to see fonts that imagemagick tries to use,
then
convert -size 500x120 xc:black track.png
mogrify -quality 100 -fill white -pointsize 20 -font SomeFont.ttf -draw "text 100,80 \"$(dcop amarok player album)\"" track.png
Remember to replace SomeFont.ttf with your font name.
Also have a look here for more info on imagemagick and fonts:
http://imagemagick.org/script/command-line-options.php#font
Hope it helps!
Report
bhing
12 years ago
It most likely seems to be a font issue. The result:
convert -size 500x120 xc:black track.png
mogrify -quality 100 -fill white -pointsize 20 -draw "text 100,80 \"$(dcop amarok player album)\"" track.png
mogrify: unable to read font `/usr/local/lib/ImageMagick-6.4.3/config//usr/share/ghostscript/fonts/n019003l.pfb'.
mogrify: unable to read font `/usr/local/lib/ImageMagick-6.4.3/config//usr/share/ghostscript/fonts/n019003l.pfb'.
TWICE... for some reason. Now, I only need to change the font. Any input there? I'm not really good at this. Just putting in -font Blablabla doesn't seem to do it.
the file:
/usr/lib/ImageMagick-6.3.7/config/type-ghostscript.xml
tells me that n019003l.pfb is Helvetica, and that it is located here:
/usr/share/fonts/type1/gsfonts/n019003l.pfb
and not where it is looking.
I just found a bug report here:
https://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/69531
Do you know a way to change the font (or the search path of the script) without replacing type.xml
Looks like I'm headed in the right direction!
Again THANKS!
Report
nebbus
12 years ago
convert -size 500x120 xc:black track.png
mogrify -quality 100 -fill white -pointsize 20 -draw "text 100,80 \"$(dcop amarok player album)\"" track.png
while amarok is playing.
If it doesn't work I have no idea what is wrong. It might be the encoding of your filesystem (though I don't think so), or it might be imagemagick. Imagemagick might be using a font without support for these letters.
Sorry I could not help you any more :)
Report
bhing
12 years ago
The actual input/output is supposed to be like this:
bla@bla-desktop:~$ convert -size 500x120 xc:black track.png
mogrify -quality 100 -fill white -pointsize 20 -draw "text 100,50 \"${dcop amarok player artist}\"" -draw "text 100,80 \"${dcop amarok player album}\"" track.png
bash: text 100,50 "${dcop amarok player artist}": bad substitution
still the same result.
Report
bhing
12 years ago
Result:
~$ mogrify -quality 100 -fill white -pointsize 20 -draw "text 100,50 \"${dcop amarok player artist}\"" -draw "text 100,80 \"${dcop amarok player album}\"" track.png
bash: text 100,50 "${dcop amarok player artist}": bad substitution
The \ is there as far as I see it, and track.png is all empty black.
Quote:
Could you also post the output of
echo $LANG
and
locale
en_US.UTF-8
and
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Report
nebbus
12 years ago
echo $LANG
and
locale
Report
nebbus
12 years ago
Report
bhing
12 years ago
The script 'AmarokScreenSaver' exited with error code: 1
AmarokScreenSaver/AmarokScreenSaver.sh: line 149: text 100,50 "${dcop amarok player artist}": bad substitution
call failed
Report
nebbus
12 years ago
I also use Kubuntu 8.04 and the same version of KDE and Amarok.
Could you give me a link to that Superkaramba theme?
Report
bhing
12 years ago
http://www.kde-look.org/content/show.php/Sigma+System+Monitor?content=80170
The Amarok part looks like this:
Quote:
# Track informations
#
text x=80 y=22 value="Artist :"
text x=115 y=22 sensor=program program="dcop amarok player artist" interval=1000
text x=80 y=34 value="Title :"
text x=115 y=34 sensor=program program="dcop amarok player title" interval=1000
text x=80 y=46 value="Time :"
text x=115 y=46 sensor=program program="dcop amarok player currentTime" interval=1000
text x=145 y=46 value="/"
text x=155 y=46 sensor=program program="dcop amarok player totalTime" interval=1000
And it turns out like this:
http://img134.imageshack.us/img134/1213/sigmaqx5.png
Looks like it does roughly the same settings as your script, although it doesn't turn text into an image. But I can't see how that would matter.
I tried running your script and Superkaramba, both separate, and at the same time to see if that was messing with something. No difference at all.
Any other suggestions will be very welcome.
Thanks again
Report
wamwam
12 years ago
So on my screen it's only written no pictures found when the screensaver starts.
I've installed everything in the list.
I'm using gentoo with kde 3.5.9
I'd really like it to worked, can someone help me?
Anyway this script is a really good idea ^^
Report
nebbus
12 years ago
/home/<username>/.kde/share/apps/amarok/scripts-data/AmarokScreenSaver/final
and see if there are any images there?
Also run these commands while Amarok is playing:
1. dcop amarok player artist
2. convert -size 60x60 gradient:none-black gradient: -channel A -fx v.R "gradient.png"
3. convert -quality 100 -resize 100x20%! "gradient.png" "shadow.png"
4. dcop kdesktop KScreensaverIface save
5. xset -q
Two of those commands should create images in your workdir.
Report
wamwam
12 years ago
dcop amarok player artist
Marilyn Manson
convert -size 60x60 gradient:none-black gradient: -channel A -fx v.R "gradient.png"
convert: no encode delegate for this image format `gradient.png'.
So I guess my problem come from the image format. What could I do?
Thank you for your answer
Report
wamwam
12 years ago
So now it's working fine, thanks a lot, this script is really great, good job ;)
Report
nebbus
12 years ago
And thanks for solving the problem!
Report
reggler
12 years ago
I'm glad to see that AmarokScreenSaver is running smoothly in KDE 4.1 but there still is an issue. When moving the mouse the screen saver doesn't stop immediately - it takes a few seconds to 1 Minute until the screen saver stops and i get my desktop back.
After the first mouse move I'm able to control Amarok with no problems. I mean the shorcuts all seem to respond immediately and properly while i'm waitting to get my screen back.
Any clues?
Report
nebbus
12 years ago
The script doesn't handle the stopping of the screensaver, it only starts it. Therefore I believe this is not a problem with the script, but rather a bug in the screensaver it is using.
I am only testing with KDE4.0.5 at the moment and I don't see this behaviour. Could you see if this is the same when yuo use the slideshow screensaver in KDE?
Report