Unmaintained
GNotify was experimental softare and is obsolete due to libnotify. I can't imagine anyone still using it.
GNotify was experimental softare and is obsolete due to libnotify. I can't imagine anyone still using it.
Notification is really nice on random playlists or when you're not really sure what the song is in the first three notes. You can just say, "Skip it" within a second of the song starting. Basically, it's the same idea as having a little display on your Minidisk or MP3 player.
cd ~/.gnome2/muine/plugins
wget http://www.public.asu.edu/~bnickel/GNotifyMuine/GNotifyMuine.cs
mcs -target:library -out:GNotifyMuine.dll GNotifyMuine.cs -pkg:muine-plugin -pkg:gnome-sharp-2.0
[[Restart "muine"]]
// GNotifyMuine.cs - Muine GNotify Plugin
// Copyright (C) 2005 Brian Nickel <kerrick@asu.edu>
// Licensed under GNU GPL V2.
// Requires : Running GNotify Daemon
using System;
using System.IO;
using System.Net.Sockets;
using System.Text;
using Muine.PluginLib;
public class GNotifyMuine : Plugin
{
private IPlayer player;
public override void Initialize(IPlayer player)
{
this.player = player;
player.SongChangedEvent += new SongChangedEventHandler (OnSongChange);
player.StateChangedEvent += new StateChangedEventHandler (OnStateChange);
}
public void OnSongChange(ISong song)
{
if(song == null || player.Playing == false || player.WindowVisible == true)
return;
Notify (song.Artists, song.Album, song.Title, song.CoverImage);
}
public void OnStateChange(bool playing)
{
if(player.PlayingSong == null || playing == false || player.WindowVisible == true)
return;
Notify (player.PlayingSong.Artists, player.PlayingSong.Album, player.PlayingSong.Title,
player.PlayingSong.CoverImage);
}
private void Notify (string [] artists, string album, string song_title, Gdk.Pixbuf cover_image)
{
try {
TcpClient tcp_client = new TcpClient ();
tcp_client.SendTimeout = 50;
tcp_client.Connect ("127.0.0.1", 7206);
NetworkStream network_stream = tcp_client.GetStream ();
if (network_stream.CanWrite)
{
StreamWriter writer = new StreamWriter(network_stream);
StreamReader reader = new StreamReader(network_stream);
char [] buffer = new char[ 8 ];
string merged_artists = "";
for( int i = 0; i < artists.Length; i ++ )
{
if( i != 0 ) merged_artists += ", ";
merged_artists += artists[ i ];
}
DirectoryInfo dinfo = new DirectoryInfo (Path.Combine (Gnome.User.DirGet (), "muine"));
if (!dinfo.Exists)
dinfo.Create ();
string filename = dinfo.FullName + "/gnotify.png";
Gdk.Pixbuf buf;
if (cover_image != null)
buf = cover_image.ScaleSimple( 48, 48, Gdk.InterpType.Bilinear );
else
{
/* Hack to get the GtkStyle .. */
Gtk.Label label = new Gtk.Label ("");
label.EnsureStyle ();
buf = label.RenderIcon ("muine-default-cover", Gtk.IconSize.Dialog, null);
label.Destroy ();
}
if(buf.Savev (filename, "png", null, null) == false)
filename = "/usr/share/pixmaps/muine.png";
writer.Write ("APP:Muine Music Player" );
writer.Flush ();
reader.Read ( buffer, 0, 8 );
writer.Write ("ICON:" + filename);
writer.Flush ();
reader.Read ( buffer, 0, 8 );
writer.Write (String.Format ("MSG:{0}\n{1}", song_title.Replace ("&", "&").Replace
("<", "<"), merged_artists.Replace ("&", "&").Replace ("<", "<")));
writer.Flush ();
}
tcp_client.Close ();
} catch {
return;
}
}
}