Skip to main content

Notice

If you are using a Hotmail or Outlook email address, please change it now, as Microsoft is rejecting all email from our service outright.
Topic: Now Playing notification balloons for foobar on ubuntu+Wine (Read 21095 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #25
Re OS X: a friend suggested maybe launchd - WatchPaths would work? more info here

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #26
Thank you very much, I will check those out...
fb2k on OSX: flac q8 > rockboxed Sansa e280v1: Vorbis q5.0

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #27
Now I'm asking me what renders the balloon, the OS? I mean I'm using Growl for other programs, so Growl does that... and somehow I think it would be possible to trigger some growl event. Well, first I'll wait for you to finish the python version, before abusing this thread with my questions...


As I said previously, the Python version is self-contained except for the 'file-watching' facility.* So, nothing like notify-send or growl is required to generate the pop-ups. They are created with PyGtk code within the script. That was the whole point of switching to Python in the first place: so the pop-ups could be customized.

There are quite a few options currently available in the code for customization (see the screen-shot which contains an image of the config file open in a text editor). You can even change the image from the left-side to the right-side of the pop-up if you desire. The screen-shot only shows color changes, but I promise, everything you see (and even what you can't see) in the config works .


Note:
As ayuyaia pointed out regarding scripting the file-monitoring process (as with the Perl code you found), it is not ideal. If that was the way to go, I could have built that functionality into the Python script easily enough (or even the bash script). Still could. Nah. Hopefully you'll find a suitable alternative for Mac.

Screen-shot:


Now Playing notification balloons for foobar on ubuntu+Wine

Reply #28
I guess lauchnd and growlnotify are the programs I need!
So far I've managed to write the bash script with np_simple which works with growlnotify and to monitor this file with a personal lauchnd deamon. I've also got the cover art working... (screenshot)
Problems: I cannot run the bash script from my deamon (it can only run applications?) and it always openes an annoying terminal window (if startet manually).
But I like what I've got so far
fb2k on OSX: flac q8 > rockboxed Sansa e280v1: Vorbis q5.0

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #29
@callisto: Sounds like you're almost there

Quote
Problems: I cannot run the bash script from my deamon (it can only run applications?) and it always openes an annoying terminal window (if startet manually).


No idea what the problem is of course, but you could try running the application "bash" and passing the script as a command line parameter?

 

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #30
Hell yeah, I've made it!
Maybe there are some MacUser out there, who want to know how. Here we go:

>> Only tested on Mac OS X 10.6.3 <<

Programs needed:
foo_np_simple
growlnotify (mount Growl-1.2.dmg, install Growl if you don't already have, navigate to Extras/growlnotify, install by following containing instructions)
Lingon to easily create the needed launchd deamon for file monitoring.

Steps:
1:
configure foo_np_simple and create npnotify
example:
Code: [Select]
$if(%isplaying%,#!/bin/bash$char(10)/usr/local/bin/growlnotify -m "[%artist%]" --image ''/path/to/your/music/$directory(%path%)/Front.jpg'' "[%title%]"$char(10)exit 0,)
go here for more information on how to use growlnotify
(see first post from ayuyaia for complete setup)

2:
- create nprun (see first post)

3:
- launch Lingon
- add new User Deamon
- name it something like com.foobar2000.npnotify
- on "What" choose your nprun file
- on "When" got to "Run it if this file is modified" and choose your npnotify file
- save! (quit Lingon)

4:
reboot to enable your launchd deamon and you're done!
Now everything should work



Thank you ayuyaia and FooForThought for the initial idea and your help on this!

callisto
fb2k on OSX: flac q8 > rockboxed Sansa e280v1: Vorbis q5.0

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #31
This looks excellent! I was working on my own script a few weeks before you posted this, but I didn't have time to work out the logic for it. I was having trouble getting the popup to act as Rhythmbox does. (e.g. pausing then playing again doesn't display the title again).
I used foo_np_simple to output the details to a txt file, then wrote a simple bash script with while and for loops to determine when and if to display a popup, using libnotify-bin.

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #32
Here you go: (...)


i'm not very good with this so if someone can explain how to get this working... I modified user constants in script, but now what? Where should i save the script? Do i need to follow the same steps like in first post or what?

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #33
@IvoP123: It's probably a good idea to make sure the (simpler) variant from the original post works... at least read it and maybe some of the follow-up posts to understand how it is meant to work. For the version you are talking about, you can put the script (fb2000_notify.sh) anywhere you like (the foobar directory or your home directory are natural choices), the important thing is that the incron table entry points to it (include the complete path there) and that it is executable (use chmod +x).

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #34
@IvoP123: It's probably a good idea to make sure the (simpler) variant from the original post works... at least read it and maybe some of the follow-up posts to understand how it is meant to work. For the version you are talking about, you can put the script (fb2000_notify.sh) anywhere you like (the foobar directory or your home directory are natural choices), the important thing is that the incron table entry points to it (include the complete path there) and that it is executable (use chmod +x).


Thanks! I managed to get it working. Only thing is that there is no image on popup although cover.jpg is in the same folder as playing file. Anyone got any idea?

One question also... when i play some file and after 1 second i play another, notification of the first file will be displayed for 6 seconds and after that the second will be displayed which is pretty annoying... i would like it to be displayed instantly

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #35
Quote
when i play some file and after 1 second i play another, notification of the first file will be displayed for 6 seconds and after that the second will be displayed which is pretty annoying... i would like it to be displayed instantly

The notifications are displayed by the window manager, so if you find a way to tell the window manager to remove the currently displayed notification (if any) you can do this. Not sure if this is possible though.

Quote
Only thing is that there is no image on popup although cover.jpg is in the same folder as playing file.

Try running notify-send from the command line with the option -i .../cover.jpg to check that images are displayed correctly. If that works, investigate the script - probably there is a problem with the directory paths, so it can't find the file at some point... (Btw, if you are using the ubuntu version of gnome, you might want to remove the image resize/dropshadow bit, since the ubuntu notifications have a fixed image size which is quite small.)

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #36
Quote
Try running notify-send from the command line with the option -i .../cover.jpg to check that images are displayed correctly. If that works, investigate the script - probably there is a problem with the directory paths, so it can't find the file at some point... (Btw, if you are using the ubuntu version of gnome, you might want to remove the image resize/dropshadow bit, since the ubuntu notifications have a fixed image size which is quite small.)


I tried but nofify-send -i doesn't seem to work  It says no summary specified. Tried jpg and png images but no luck... I googled but couldn't find the solution. What could be the problem? 

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #37
Odd. Did you try something like
Code: [Select]
notify-send -i "/home/ivop123/foobar2000/coverart/cover.jpg" "Summary" "Body"

(point being to specify the full path)

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #38
Odd. Did you try something like
Code: [Select]
notify-send -i "/home/ivop123/foobar2000/coverart/cover.jpg" "Summary" "Body"

(point being to specify the full path)


that was the problem. I managed to get it working. Thanks!    So, i guess in ubuntu 10.04 cover is small sized and there is nothing i can do about it?

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #39
Quote
So, i guess in ubuntu 10.04 cover is small sized and there is nothing i can do about it?

Not that I know of - it seems to be a limitation of the notify library they are using. See discussion earlier in this thread.
You could ask FooForThought if he could post his python notifications (see above) which were designed to get around this problem...

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #40
is it possible to move the notify-send position to another part of the screen, or make it fade out slow?
thanks for your contribution works great

http://img709.imageshack.us/f/screenshotlmj.png/



Now Playing notification balloons for foobar on ubuntu+Wine

Reply #43
I've now tried out the patched notify-osd and it works great. Many of the size settings seem to be relative to the GONME application font size. It's possible to set larger font sizes (>100%) in the config file (.notify-osd) but not via the GUI.

With the following trick, it's possible to have different notification settings for foobar than for all the other applications using notify-osd (e.g. if you want foobar notifications to have larger images, but other apps not to have huge icons in their notifications): Have incron run as a different user than your usual login (e.g. use root, as suggested in the original post). Then when incron calls the notification script, it will run as that user, who has his own .notify-osd and gnome theme settings of course. So if you change .notify-osd etc only for that user, it won't affect notifications displayed by other applications (e.g. if you use root, .notify-osd goes into the /root directory.)

What does not seem to be possible is centering the text vertically - at least I have not found a way to do this.

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #44
Now I'm asking me what renders the balloon, the OS? I mean I'm using Growl for other programs, so Growl does that... and somehow I think it would be possible to trigger some growl event. Well, first I'll wait for you to finish the python version, before abusing this thread with my questions...


As I said previously, the Python version is self-contained except for the 'file-watching' facility.* So, nothing like notify-send or growl is required to generate the pop-ups. They are created with PyGtk code within the script. That was the whole point of switching to Python in the first place: so the pop-ups could be customized.

There are quite a few options currently available in the code for customization (see the screen-shot which contains an image of the config file open in a text editor). You can even change the image from the left-side to the right-side of the pop-up if you desire. The screen-shot only shows color changes, but I promise, everything you see (and even what you can't see) in the config works .


Note:
As ayuyaia pointed out regarding scripting the file-monitoring process (as with the Perl code you found), it is not ideal. If that was the way to go, I could have built that functionality into the Python script easily enough (or even the bash script). Still could. Nah. Hopefully you'll find a suitable alternative for Mac.

Screen-shot:



where can i get the config script? and how would I get it to work thanks

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #45
Bump from hell to report that the latest wine now supports proper balloon tips, although they're themed Windows 2000 or older style. Better than nothing, I guess.

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #46
Bump from hell to report that the latest wine now supports proper balloon tips, although they're themed Windows 2000 or older style. Better than nothing, I guess.

Great! Though, I can't seem to make the balloon disappear by clicking it...just stays there for a good 10 seconds.

Now Playing notification balloons for foobar on ubuntu+Wine

Reply #47
Thanks for this script! I managed to get balloon tips in Ubuntu 11.10. I had to change some parts to get it working:
  • I had to install xscreensaver:
    Code: [Select]
    sudo apt-get install xscreensaver
  • The command 'who' does not return an user for me. I had to change this to 'whoami'.
  • As the script is added to incron, the user is root. So use that user for $NOTIFUNAME
  • The balloon is only showed if I add the prefix 'sudo -u <user> to the notify-send command
  • My foobar library was added using some prefixed directories. This caused the directorypath to look like /users/<user> instead of /home/<user>. Therefore. I readded my library and this time I browsed to the map using the /home/<user> map.
  • xdpyinfo is not working if it is run by incron. Therefore, I commented out that check
  • To improve the loop to find the album art, I changed the part
    Code: [Select]
    for item in "${cover_dir}/"*; do
    if [ -f "$item" ]; then
    mime=$(file -ib "$item")
    result=$(echo $mime | grep 'image')
    if [ $result ]; then
    imgfile="$item"
    break
    else
    imgfile="$IMGALT"
    fi
    fi
    done;

    to
    Code: [Select]
    imgfile="$IMGALT"
    for item in "${cover_dir}/"*.[jJ][pP][gG] "${cover_dir}/"*.[pP][nN][gG] "${cover_dir}/"*.[jJ][pP][eE][gG]; do
    echo $item
    if [ -f "$item" ]; then
    mime=$(file -ib "$item")
    result=$(echo $mime | grep 'image')
    if [ $result ]; then
    imgfile="$item"
    break
    fi
    fi
    done;

    The loop now only looks to jpg and png files instead of all music files.

I guess this is all I had to change, really great to have foobar showing balloons! Thanks for this thread!



 
SimplePortal 1.0.0 RC1 © 2008-2020