IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

2 Pages V   1 2 >  
Reply to this topicStart new topic
Now Playing notification balloons for foobar on ubuntu+Wine
ayuyaia
post Apr 11 2010, 21:46
Post #1





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



While foobar2000 1.01 runs pretty much flawlessly under Wine on ubuntu (just install as portable using Wine 1.1.42 on karmic, or check the corresponding forum posts), the tray notification balloons displaying the current track info do not work. I'd like to share a fairly easy way to provide these notifications for gnome, using gnome's built-in notification system.

The basic idea is as follows:
1) Use the np_simple plugin to write the "now playing" info to a bash script which, when executed, calls the gnome notification daemon.
2) Use the built-in linux kernel inotify system to automatically run this script whenever it changes, via incron. The advantage of this is a very low overhead compared to constantly polling a file for changes or such.

I'm sure the following setup could be extended and/or made more elegant, but it works nicely, at least for me wink.gif
In the following, substitute your full foobar2000 directory path wherever you see $FBPATH.

First, install the foo_np_simple plugin (aka Now Playing Simple). Then, use synaptic to install the incron package. If you do not already have the required package for the "notify-send" command, install that as well (run "notify-send --help" from the command line to check).

Run foobar and, in the Now Playing Simple section of the preferences, set:
- the filename to $FBPATH/npnotify (use the Wine (Windows) version of the path of course)
- the encoding to UTF-8 *without* header
- the events you would like to have a notification on
- the formatting string to contain the script:
CODE
#!/bin/bash$char(10)
notify-send -u normal -t 6000 $if(%ispaused%,
"[%artist% - ][%title%]" "[%album%$char(10)][%playback_time%/][%length%]",
"[%artist% - ][%title%]" "[%album%$char(10)]
$ifequal(%playback_time_seconds%,0,[%length%],[%playback_time%/][%length%])")$char(10)

This is just an example of course - you can modify the script to change the now playing notification. The "-t 6000" sets the length of time the notification balloon is shown in milliseconds. Note the gnome notifications allow for line breaks in the second argument only.

Now play a track to generate the npnotify file. Go to the $FBPATH directory and use "chmod +x npnotify" to make it executable. You can give it a trial run with "./npnotify".

Call up your favourite editor and make a second script file "nprun" in $FBPATH containing
CODE
#!/bin/bash
$FBPATH/npnotify

"chmod +x nprun" to make it executable. This detour is necessary because for some reason incron doesn't seem to like both watching npnotify for changes and executing it.

Now to set up the incron task. Make sure root can run incron tasks by checking that /etc/incron.allow contains a line "root". Then, enter the command "sudo incrontab -e". This will bring up an editor; add the line
CODE
$FBPATH/npnotify IN_CLOSE_WRITE $FBPATH/nprun

exit and save.

Everything should now work fine! If not, try restarting the incron daemon: "sudo incrond -k" followed by "sudo incrond"

It would be great if someone were to further improve this setup. In particular, the "notify-send" command has an "-i" option which allows an image to be displayed in the notification balloon. It would be nice to have the correct album art displayed along with the track info...

This post has been edited by ayuyaia: Apr 11 2010, 22:01
Go to the top of the page
+Quote Post
demonAfro
post Apr 13 2010, 23:35
Post #2





Group: Members
Posts: 8
Joined: 29-August 05
Member No.: 24177



Nice post, thanks; had always wondered about doing something like this.

Ran into a small problem (running kde4.4 on gentoo if that matters) where the popup was not showing, but fixed it tongue.gif

CODE
DISPLAY=:0.0 notify-send ...


or getting the DISPLAY somewhere into the environment works.

Also ran "incrontab -e" as the user (the man page doesn't say you need to be in any groups). The root notifications looked a little bit odd too.

Cheers! cool.gif
Go to the top of the page
+Quote Post
ayuyaia
post Apr 14 2010, 11:18
Post #3





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



Glad you liked it! Yes, incron tasks can of course be set for any user - I chose root because I read somewhere that this was recommended, not sure why. Whether it looks any different probably depends on the details of one's configuration, as it doesn't for me.

This post has been edited by ayuyaia: Apr 14 2010, 11:19
Go to the top of the page
+Quote Post
Mar2zz
post Apr 14 2010, 11:49
Post #4





Group: Members
Posts: 669
Joined: 5-September 07
From: Netherlands
Member No.: 46810



nice thx. will look into it.


--------------------
http://www.youtube.com/watch?v=whoj6BOSfE4 (foob.fm)
Go to the top of the page
+Quote Post
Anas
post Apr 14 2010, 19:06
Post #5





Group: Members
Posts: 466
Joined: 9-May 05
From: Deutschland
Member No.: 21968



Thanks I was looking for a something like this some time now. Had a few attempts myself, but never got anything to work. Unfortunately this doesn't work for me either. Did everything exactly as detailed. icrond is running, but it doesn't seem to detect any changes.
Go to the top of the page
+Quote Post
ayuyaia
post Apr 14 2010, 19:42
Post #6





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



You can check to see what incron is actually doing by looking at /var/log/syslog. There will be a line for each time a task is triggered, and/or any error messages. Also, have you tried restarting the daemon, as I mentioned in my original post?
Go to the top of the page
+Quote Post
FooForThought
post Apr 16 2010, 04:17
Post #7





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



QUOTE (ayuyaia @ Apr 11 2010, 16:46) *
It would be great if someone were to further improve this setup. In particular, the "notify-send" command has an "-i" option which allows an image to be displayed in the notification balloon. It would be nice to have the correct album art displayed along with the track info...


Here you go:
CODE
#!/bin/bash

# Author : Anonymous
# Version : 1.0
# License : n/a
# Date : 2010 04/15
# Requires : foobar2000, foo_np_simple, notify-send
# Script Name : fb2000_notify.sh
# Description : Script to display Now Playing' info via 'foo_np_simple'
# component and 'notify-send'.
#
# Notes : n/a
#
# Acknowledge : thanks to original authors
# Resources : n/a
#==============

# -- User Constants - User can specify these variables as necessary -----------
# Location (full path) of 'foo_np_simple' file:
NPFILE='/home/user_name/.wine/drive_c/Program Files/Foobar2000/now_playing/np.txt'
# -
# Directory where you will store cover art thumbnail image used by notify-send.
# Note: using the same directory where the 'foo_np_simple' file is kept might
# be a good place for the thunmail.
IMGDIR='/home/user_name/.wine/drive_c/Program Files/Foobar2000_02/now_playing'
#-
# Full path to alternate image (if no cover art exists).
IMGALT='/home/user_name/.wine/drive_c/Program Files/Foobar2000_02/default.jpg'
#-
# Specify replacement string for '&' character in message body. See function,
# 'f_fix_notify_bug', notes below.
AMPALT='And'
#-
# Strings to add to image thumbnail file. For example, if original image file
# name 'cover' (excluding extension), then new file will become
# 'cover_thumbnail', assumimg default values are used.
SEP_NAME='_'
IMGFILE_XTRA_NAME='thumbnail'
#-
# Size in pixels of thumbnail image used in 'notify-send' pop-up. This values
# is the height dimension and will automatically generate the width to maintain
# aspect ratio.
THUMB_SIZE=96
#-
# User name for controlling xhost, etc.
NOTIFUNAME='user_name'

# Also see the 'f_convert_image' function to modify image boder, filter,
# unsharp mask, etc. Make a backup copy and play around.


# -- Other Constants - DO NOT CHANGE ------------------------------------------
# Separator between file name and extension
SEP_EXT='.'
# Path separator
SEP_PATH='/'
# Extension for thumbnail image. This must be 'png' as it supports
# transparency necessary for proper display of image in notify-send pop-up.
IMGFILE_CONVERT_EXT='png'

# -- Functions ----------------------------------------------------------------
function f_get_npinfo {
# Get 'Now Playing' info from user-specified file and set some variables
# required by the script. The variables are assigned values based on
# specific lines from the file:
# Line 1 - used for 'notify-send' message summary
# Line 2 to Line n-2 - used for 'notify-send' message body
# Line n-1 - used as the directory to search for 'Now Playing' cover art

count=0
while read -r line; do
line_array[$count]="$line\n"
let count=$count+1
done < "$NPFILE"

msg_line_summary=0
let msg_lines_body=${#line_array[@]}-2
let msg_line_dir=${#line_array[@]}-1

msg_summary=$(echo -e "${line_array[$msg_line_summary]}")
msg_body=$(echo -e "${line_array[@]:1:$msg_lines_body}")
cover_dir=$(echo -n "${line_array[$msg_line_dir]}")

}

function f_fix_notify_bug {
# Notify send fails to print the message body if it contains an ampersand
# (&). It is possible there are other characters that introduce odd
# behavior, but no others have been noted yet. Also, the same behavior did
# not seem to apply to the message summary.

# Remove '&'s from message body and replace with user-specified
# alternative.
msg_body=$(echo "$msg_body" | sed "s/&/${AMPALT}/g")

}

function f_get_image {
# Search directory of currently playing audio file for image file. Image
# file in this directory is assumed to be the cover art image. The image
# will be used to create the thumbnail for the 'notify-send' pop-up.

IFS=$''

cover_dir=$(echo $cover_dir | sed -e 's/[a-zA-Z]://' -e 's/\\n//g' -e 's/\\/\//g')

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;

unset IFS

}

function f_convert_image {
# Convert cover art:
# Step 1: create thumbnail
# Step 2: apply drop shadow

if [ -n "$imgfile" ]; then
# Resize image
convert -depth 24 \
-background transparent \
-thumbnail x${THUMB_SIZE} \
-quality 100 \
-bordercolor '#000000' \
-border 2x2 \
-filter Lanczos \
-unsharp 0x1.5+1+0 \
"$imgfile" \
"$imgfile_resized"

# Create drop shadow
convert "$imgfile_resized" \
\( +clone -background black -shadow 60x5+10+10 \) \
+swap \
-background transparent \
-layers merge \
+repage \
"$imgfile_resized"
fi

}

function f_notify {
# Create the 'notify-send' pop-up.

# Set some vars
notifuname="$NOTIFUNAME"
namecheck=$(who | grep -E "\b${notifuname}\b")
#notificon="user-info"
notificon="$imgfile_resized"

# Set X display (needed when terminal app launches GUI app)
export DISPLAY=:0.0

# Test whether specified user is logged in
if [ -n "$namecheck" ]; then
# Test whether X is running
isx=$(xdpyinfo | head -20 | grep "X.Org")
# Test whether screen has been blanked by xscreensaver
if [ -n "$isx" ]; then

# Add user to xhost (will be removed before script exits)
# otherwise xscreensaver-command will not work properly.
# http://www.leidinger.net/X/xhost.html
xhost +nis:${notifuname}@ > /dev/null

is_scrblank=$(xscreensaver-command -time 2> /dev/null| grep "screen non-blanked")

# Above command issues an error message ('no saver status on
# root window.') if screensaver has not been invoked since daemon
# was started. Therefore, if error status (1), it means the screen
# is not blanked and notifier should be issued to desktop.
is_err=$?

# Debug
# echo $is_scrblank
# echo $is_err

if [ -n "$is_scrblank" ] || [ !"$is_err" ]; then
# Send desktop notification
notify-send \
--icon="$notificon" \
--expire-time=6000 \
--urgency=normal \
"${msg_summary}" "${msg_body}"
fi
fi
fi

# Remove user from xhost
xhost -nis:${notifuname}@ > /dev/null

}

# -- Main ---------------------------------------------------------------------
# Call functions and assign values to additional variables.

f_get_npinfo
f_fix_notify_bug
f_get_image

imgfile_base=$( basename "$imgfile" )
imgfile_base_noext="${imgfile_base%.*}"
imgfile_thumbnail="${imgfile_base_noext}${SEP_NAME}${IMGFILE_XTRA_NAME}${SEP_EXT}${IMGFILE_CONVERT_EXT}"
imgfile_resized="${IMGDIR}${SEP_PATH}${imgfile_thumbnail}"

f_convert_image
f_notify

exit


The above code has a section at the beginning (User Constants) that needs some attention before the script can be used. I don't ordinarily like putting user configuration in scripts, but this was quickly put together (relatively speaking). I definitely should have done it in Perl or Python.

Here is the foo_np_simple code I inserted in foobar2000:
CODE
$if(%isplaying%,
$if(%TITLE%,%TITLE%,%filename_ext%)
$char(10)
$char(10)
Artist: [%album artist%]
$char(10)
Album: [%album%]
$char(10)
Genre: [%genre%]
$char(10)
Sub-Genre: [%sub-genre%]
$char(10)
$char(10)
%codec% ● %bitrate%kbps ● %samplerate%Hz ● %channels%
$char(10)
$directory_path(%path%)
$char(10),)


Notice a couple of things:

1) the bash script is not part of the text that foo_np_simple sends to its file. The 'now playing' info and the script are kept separate. The script reads in the file data. As such, the incron table entry (I used my regular user account for the table rather than root) looks like this:

CODE
/some/path\ with\ spaces/now_playing.txt IN_CLOSE_WRITE fb2000_notify.sh


2) The notify-send message takes this form:
CODE
message summary
message body


The above example formatting text takes the same form but with one added piece of output: the directory where the currently playing audio file is located (it's assumed the cover art is in that directory).

So, a couple of things need to be considered if / when modifying the example I provided:

a. the first entry that creates output to the np_simple file needs to be your desired notify-send summary (conditional functions, etc. that don't produce output to the file don't count ... notice the actual first line of the formatting string is the conditional, %isplaying%). In the above example the first item that produces output (and which will be the notify-send summary) is:
CODE
($if(%TITLE%,%TITLE%,%filename_ext%)


The entry could be [%genre%] if you like, but I doubt many people would choose that. Bottom line, this entry will be BOLD and set apart above the message body in the notify-send message.

b. A really critical issue is that the last output item MUST be the directory where the album art is located ALWAYS followed by a blank line.
This is taken care of in the example above by the following:
CODE
$directory_path(%path%)
$char(10)


The reason it is critical is that the directory is required to retrieve the related album art. You should not change this unless you recode the related portions of the script.

Anything that is placed between your desired summary entry and the directory entry (essentially, these items in between are the body of the notify-send message) can be whatever you like with spacing to suit you.

You might want to use my example formatting first to make sure things are working before you venture into modifications.

I think that's it for now.

PS
Unsharp mask on the thumbnail cover art image created by the script is not optimal ... it looks decent, but I wanted it to be visible initially to let you know it was there. Feel free to tweak the settings.

PSS
I don't have any real issues with pretty_pop, and the standard info balloons work for me on mousing-over the tray icon, so I really don't know if this is something I'll continue to use. Coding it was mostly an exercise to see how it could be done.

-- Screen-shot attached:


This post has been edited by Frank Bicking: May 24 2010, 17:19
Reason for edit: Code boxed.
Go to the top of the page
+Quote Post
FooForThought
post Apr 16 2010, 13:01
Post #8





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



I just noticed the header information of the script I posted is a little messed up. I have templates I use for various scripts (one for bash, perl python etc.), and I didn't clean this one up before posting. It should have read:

CODE
# Author      : Anonymous
# Version     : 1.0
# License     : n/a
# Date        : 2010 04/15
# Requires    : foobar2000, foo_np_simple, notify-send, incron
# Script Name : fb2000_notify
# Description : Script to display Now Playing' info via 'foo_np_simple'
#               component, 'incron', and 'notify-send'.
#
# Notes       : n/a
#
# Acknowledge : Thanks to HydrogenAudio.com member, ayuyaia, for the inspiration:
#               http://www.hydrogenaudio.org/forums/index.php?showtopic=80221
#
# Resources   : The following resources may be useful for understanding
#               and using this script:
#               http://inotify.aiken.cz/?section=incron&page=about&lang=en
#               http://www.digipedia.pl/man/doc/view/notify-send.1/
#               http://www.galago-project.org/specs/notification/0.9/index.html#introduction
#               http://www.imagemagick.org/
#               http://redskiesatnight.com/2005/04/06/sharpening-using-image-magick/
#               http://www.dylanbeattie.net/magick/filters/result.html
#==============


Also, just an FYI: I had to add my user to group 'incron' to get incron to work properly on Arch. Could be necessary on other systems as well.
Go to the top of the page
+Quote Post
ayuyaia
post Apr 16 2010, 15:59
Post #9





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



Wow, thanks FooForThought, nice extension! Looking forward to trying it out...

Btw I used to use foo_popupplus under Windows, but that doen't seem to work with Wine.
Anyway, one advantage of going the notify-sign route is that the notifications are automatically themed to fit in with one's desktop.

This post has been edited by ayuyaia: Apr 16 2010, 16:07
Go to the top of the page
+Quote Post
FooForThought
post Apr 16 2010, 16:35
Post #10





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



QUOTE (ayuyaia @ Apr 16 2010, 10:59) *
Wow, thanks FooForThought, nice extension! Looking forward to trying it out...

Btw I used to use foo_popupplus under Windows, but that doen't seem to work with Wine.
Anyway, one advantage of going the notify-sign route is that the notifications are automatically themed to fit in with one's desktop.


You're welcome.

I use foo_prettypop which requires .Net, and .Net version 2.0 has worked well enough so far with Wine for the purpose of that component. Pretty Popup is very customizable, but it does have a few annoyances on Linux / Wine, especially related to the preferences page in Foobar2000.

Yes, libnotify auto-themes to the user's environment, but it takes its cues from parts of the theme that aren't necessarily what a user would want for pop-ups. I would prefer to be able to set solid colors instead of the two-toned scheme it uses and especially, I would like to be able to change the geometry. The pop-ups scale okay in the vertical dimension automatically according to content, but the width is immutable.

------
By the way, does this forum automatically close editing of posts after a given amount of time (this is really going to make organization of the info difficult)? I thought I had seen many posts here where the authors changed / updated content over long periods of time, but my posts here can no longer be edited. Maybe the only long-term editable content is the first post in a thread?

Anyway, I can't edit my previous posts, and I forgot to include in the 'Requires' section of the script that 'imagemagick' is necessary. It's an important one to have left out, but I did supply a link to the website, so maybe that (or the fact that the script would fail) was a good enough clue to install it. smile.gif
Go to the top of the page
+Quote Post
ayuyaia
post Apr 16 2010, 17:15
Post #11





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



QUOTE
I use foo_prettypop which requires .Net

Well, it's good to have a couple of different ways to go, depending on one's preferences. Personally, I prefer to avoid having to install .NET.

QUOTE
Yes, libnotify auto-themes to the user's environment, but it takes its cues from parts of the theme that aren't necessarily what a user would want for pop-ups. I would prefer to be able to set solid colors instead of the two-toned scheme it uses and especially, I would like to be able to change the geometry.

I suspect this depends on the window manager you are using. With gnome on ubuntu and the standard theme, the notifications are solid coloured single-tone with rounded edges, which I quite like. This suggests to me the details must be customizeable somewhere.

QUOTE
By the way, does this forum automatically close editing of posts after a given amount of time (this is really going to make organization of the info difficult)?

I encountered the same annoying problem. Maybe there is a workaround?

This post has been edited by ayuyaia: Apr 16 2010, 17:19
Go to the top of the page
+Quote Post
demonAfro
post Apr 16 2010, 17:49
Post #12





Group: Members
Posts: 8
Joined: 29-August 05
Member No.: 24177



QUOTE (ayuyaia @ Apr 16 2010, 16:15) *
I suspect this depends on the window manager you are using. With gnome on ubuntu and the standard theme, the notifications are solid coloured single-tone with rounded edges, which I quite like. This suggests to me the details must be customizeable somewhere.

I quite like the KDE popup; they are themed the same as the rest of my desktop tongue.gif

But as you say not very customisable; the image gets plonked as an icon and everything breaks if the lines are too long. I know other apps can put larger pictures and progress bars, but I think that is well beyond the scope of a simple notify-send.

Also, if you want to bind a keystroke to pop up you could set the action to "touch" your file so incron picks it up.
Go to the top of the page
+Quote Post
FooForThought
post Apr 16 2010, 18:53
Post #13





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



QUOTE (ayuyaia @ Apr 16 2010, 12:15) *
QUOTE
I use foo_prettypop which requires .Net

Well, it's good to have a couple of different ways to go, depending on one's preferences. Personally, I prefer to avoid having to install .NET.

QUOTE
Yes, libnotify auto-themes to the user's environment, but it takes its cues from parts of the theme that aren't necessarily what a user would want for pop-ups. I would prefer to be able to set solid colors instead of the two-toned scheme it uses and especially, I would like to be able to change the geometry.

I suspect this depends on the window manager you are using. With gnome on ubuntu and the standard theme, the notifications are solid coloured single-tone with rounded edges, which I quite like. This suggests to me the details must be customizeable somewhere.


Yep. Definitely nice to have a few options, especially since all the methods I utilize are dependent on other developers continuing to maintain their software. If one fails due to incompatibilities, I can switch to another. The issue of maintenance is very apparent in this thread as foo_np_simple, foo_prettypop, incron, and Wine .Net support are pretty stale. The only reason I was able to write this script is because I had previously used foo_np_simple with dzen to place the 'now playing' information on the desktop (hey, yet another method smile.gif ) and had a copy of 'foo_np_simpe' on my hard-drive. I was otherwise unable to find a copy online, and the developer's site is down.

In regard, to libnotify's pop-up, I can change the two-tone scheme to solid colors, but that puts a severe crimp in my theme's appearance and usability. The vertical strip of color on the left-side of the pop-up is controlled by the Gnome-theme's 'Selected Items' color, and the remainder of the pop-up's color is dependent on the Gnome-theme's 'Input Boxes' color. It's an either or thing, when it could easily be independently configurable. If your pop-ups on Ubuntu are not tied to the Gnome theme n the same way, it is definitely Canonical hacking the source code. The rounded corners I'm not sure about .. may be a hack as well. I have Ubuntu installed, but I haven't upgraded to the latest version, so I'm disinclined to check against an older install.

I'm certainly keeping an open mind about the solution under discussion, however. It's in use right now while I'm listening and typing. Let me know how it works out for you. I'm already formulating responses to stumbling blocks I think you may encounter, but hopefully things go smoothly. smile.gif
Go to the top of the page
+Quote Post
FooForThought
post Apr 16 2010, 18:57
Post #14





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



QUOTE (demonAfro @ Apr 16 2010, 12:49) *
<snip>
Also, if you want to bind a keystroke to pop up you could set the action to "touch" your file so incron picks it up.


Those KDE screen-shots look nice, but they almost buried the best part of your post. Excellent suggestion. smile.gif

Go to the top of the page
+Quote Post
ayuyaia
post Apr 16 2010, 19:36
Post #15





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



QUOTE
I was otherwise unable to find a copy [of foo_np_simple] online

Here is a link to the foo_np_simple plugin which currently works. (I wish I could edit the original post to add it there!)

Regarding future support, I thought that was one of the advantages of going this route, since it only depends on foo_np_simple which I don't think is likely to break because it is so, well, simple (but, famous last words, etc). Incron and libnotify seem unlikely to disappear and do the brunt of the work. The main drawback, as you point out, is the flipside of this: customizing the popup (beyond changing its contents) is totally dependent on what the window manager/libnotify will let you do. (e.g. I quite like the KDE look as well, but it is very different from what I get under gnome on ubuntu 9.10.)

This is the latest info I could find on libnotify under gnome, maybe it is useful to you if you wish to further investigate customizeability? Unfortunately I couldn't find some more straightforward documentation. I'm rather surprised at this actually, you'd think it would be part of putting together a theme.

Since I was aiming for a rather minimalistic notification popup, and I am very happy with the way it looks on my system already, the method works well for me (at the moment at least - and if things begin to fail I can hope for your pre-formulated responses wink.gif ).

This post has been edited by ayuyaia: Apr 16 2010, 19:57
Go to the top of the page
+Quote Post
FooForThought
post Apr 16 2010, 20:00
Post #16





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



QUOTE (ayuyaia @ Apr 16 2010, 14:36) *
QUOTE
I was otherwise unable to find a copy [of foo_np_simple] online

Here is a link to the foo_np_simple plugin which currently works. (I wish I could edit the original post to add it there!)


Hmm. Since I began this project day-before-yesterday, http://skipyrich.com/ was unreachable. I originally tried to download the file from the link in the Foobar2000 Wiki section on components at various times. I thought at first maybe just that page had been removed, but the whole domain was unreachable. I had given it up for dead, but it's working now.

Thanks for correcting me on that.
Go to the top of the page
+Quote Post
ayuyaia
post Apr 17 2010, 00:23
Post #17





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



Just to add, FYI: Some rooting around reveals that Canonical uses notify-osd as its notification daemon (screenshots at that link). Customizing this package seems possible but requires recompiling to change some options. The current state of play regarding linux notification daemons does not seem entirely optimal wink.gif
Go to the top of the page
+Quote Post
ayuyaia
post Apr 17 2010, 14:01
Post #18





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



For those adding cover art to their notifications: Embedded mp3 (id3v2) album art can easily be extracted via the command line tool eyeD3 using the -i option. (Btw, on ubuntu, eyeD3 is available via synaptic.)

This post has been edited by ayuyaia: Apr 17 2010, 14:03
Go to the top of the page
+Quote Post
FooForThought
post Apr 18 2010, 01:25
Post #19





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



QUOTE (ayuyaia @ Apr 17 2010, 09:01) *
For those adding cover art to their notifications: Embedded mp3 (id3v2) album art can easily be extracted via the command line tool eyeD3 using the -i option. (Btw, on ubuntu, eyeD3 is available via synaptic.)


I began a python / pygtk re-write today just so I could use a config file for my pop-up preferences (color, size, geometry, etc.) instead of relying on notify-send. I'm about 90% complete, not including adding the ability to extract embedded art. The latter seems like a good feature to have, but I don't personally use it, so I'll have to put some thought into how to implement it in such a way that makes sense to the majority of those who might use it.

I'm headed out now, and tomorrow's 'yard-work' day smile.gif, so it may be Monday or so before I get back here with the script.

This post has been edited by FooForThought: Apr 18 2010, 01:36
Go to the top of the page
+Quote Post
ayuyaia
post Apr 18 2010, 01:54
Post #20





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



QUOTE
I began a python / pygtk re-write today...

Nice one!

Btw eyeD3 is a python module, the command line tool is just a wrapper/demo.

This post has been edited by ayuyaia: Apr 18 2010, 02:01
Go to the top of the page
+Quote Post
callisto
post Apr 18 2010, 13:14
Post #21





Group: Members
Posts: 362
Joined: 2-September 06
From: Berlin, Germany
Member No.: 34723



Nice work!
With my limited linux / scripting knowledge for me the question comes up, if this is also possible for OS X... since I'm using fb2k on a Mac. If it's possible, this would be super duper awesome smile.gif
Please let me know...


--------------------
fb2k on OSX: flac q8 > rockboxed Sansa e280v1: Vorbis q5.0
Go to the top of the page
+Quote Post
ayuyaia
post Apr 19 2010, 13:21
Post #22





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



Thought I'd add a screenshot of the gnome/ubuntu notifications with albumart. (Btw, as mentioned above, it seems the image size is fixed for the notify-osd version of notify-sign.)


This post has been edited by ayuyaia: Apr 19 2010, 14:02
Go to the top of the page
+Quote Post
FooForThought
post Apr 21 2010, 14:59
Post #23





Group: Members
Posts: 45
Joined: 21-January 04
Member No.: 11431



QUOTE (callisto @ Apr 18 2010, 08:14) *
Nice work!
With my limited linux / scripting knowledge for me the question comes up, if this is also possible for OS X... since I'm using fb2k on a Mac. If it's possible, this would be super duper awesome smile.gif
Please let me know...


Since the python version doesn't rely on external (OS-specific) processes (it's pure python), the only thing you would have to worry about is whether you have an application that can monitor file changes. On Linux we're using 'incron', at least that is the consensus in this thread. I don't know what's available for Mac.

----

Speaking of the python version: I said I would post a version Monday or so. Obviously that's changed since it's now Wednesday. When I said the script was 90% complete, it was. I was looking at some refactoring and adding the 'extract image from file' code. Well, I decided to add some additional functionality that isn't that difficult to code, but definitely added to the schedule which is now competing with other obligations. It's also become a little tedious since the 'big bang' of seeing the pop-up work occurred days ago and now it's just refactoring, exception handling, documentation, etc.

I'll get the script posted as soon as I can (I'm not talking months ... just a matter of days). I'll probably post screen-shots first just to let you see what it looks like in the meantime.
Go to the top of the page
+Quote Post
callisto
post Apr 22 2010, 13:23
Post #24





Group: Members
Posts: 362
Joined: 2-September 06
From: Berlin, Germany
Member No.: 34723



QUOTE (FooForThought @ Apr 21 2010, 15:59) *
Since the python version doesn't rely on external (OS-specific) processes (it's pure python), the only thing you would have to worry about is whether you have an application that can monitor file changes. On Linux we're using 'incron', at least that is the consensus in this thread. I don't know what's available for Mac.

I tried looking a little bit around for that kind of program. If I understand this perl script right, it does the monitoring you say I would need! (website)

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...


--------------------
fb2k on OSX: flac q8 > rockboxed Sansa e280v1: Vorbis q5.0
Go to the top of the page
+Quote Post
ayuyaia
post Apr 22 2010, 14:23
Post #25





Group: Members
Posts: 32
Joined: 28-January 09
Member No.: 66328



I have no experience with OS X, but that perl script you posted (while it might work) would not be ideal, since it has to be running continuously in the background. The idea behind incron is that the kernel of your operating system can trigger actions, e.g. whenever a file is modified. I am not sure what the OS X equivalent is - maybe kqueue or FSEvents? (of which I know nothing but the names...)

To render the ballon in the way described in my original post, you need something equivalent to the notify-sign command. Yes, when notify-sign is executed, the operating system (more precisely, its appropriate library) renders the balloon. In fact (doing a quick google) Growl looks like what you need! In particular, growlnotify which even has a similar syntax to notify-sign.

Whether you have the file watching component (whatever approach you use) call a script that runs growlnotify, or call FooForThought's upcoming python program, basically depends on what you want your notification balloons to look like. In the first case it will be determined to some extent by Growl.

Hope this helps!

This post has been edited by ayuyaia: Apr 22 2010, 14:40
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 2nd September 2014 - 06:36