Growl For Windows Notification 1.4
Growl For Windows Notification 1.4
After getting my Chrome script working, I decided to hack together a script to provide output to Growl for Windows.
The script takes advantage of Growl's command-line "growlnotify" tool to do its dirty work. I know that there are better ways of integrating programs into Growl, but this was just a quick & dirty thing I did for myself, and figured I'd let everybody else in on as well.
The script (which includes growlnotify.exe) can be downloaded from here. Enjoy!
Credit where credit is due dept: Again, this script is pretty much entirely based on trixmoto's NowPlayingFTP script.
What's Changed?
1.0
Initial release
1.1
Removed ImageMagick dependency.
Changed default formatting to show album name and wrap song title in quotes.
1.2
Fixed issue where multiple growlnotify.exe processes would hang around after running (sloppy coding on my part, there).
1.3
Fixed errors when MM is installed to a non-standard path.
1.4
Added notifications when podcasts are downloaded.
Also note that I have a modified version of the script that only runs when you hit a user-defined hotkey: Growl On Demand.
The script takes advantage of Growl's command-line "growlnotify" tool to do its dirty work. I know that there are better ways of integrating programs into Growl, but this was just a quick & dirty thing I did for myself, and figured I'd let everybody else in on as well.
The script (which includes growlnotify.exe) can be downloaded from here. Enjoy!
Credit where credit is due dept: Again, this script is pretty much entirely based on trixmoto's NowPlayingFTP script.
What's Changed?
1.0
Initial release
1.1
Removed ImageMagick dependency.
Changed default formatting to show album name and wrap song title in quotes.
1.2
Fixed issue where multiple growlnotify.exe processes would hang around after running (sloppy coding on my part, there).
1.3
Fixed errors when MM is installed to a non-standard path.
1.4
Added notifications when podcasts are downloaded.
Also note that I have a modified version of the script that only runs when you hit a user-defined hotkey: Growl On Demand.
Last edited by fizzjob on Fri Feb 19, 2010 1:22 pm, edited 5 times in total.
Re: Growl For Windows Notification 1.2
I get an error in line 113 column 7 for Growl.vbs.
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Re: Growl For Windows Notification 1.2
Hmm...is MediaMonkey installed in the default location? The script looks for %PROGRAMFILES%\mediamonkey\scripts\auto\growlnotify.exe - if it's not there, that could be the cause.Lowlander wrote:I get an error in line 113 column 7 for Growl.vbs.
Re: Growl For Windows Notification 1.2
No, MediaMonkey is not installed in the default location.
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Re: Growl For Windows Notification 1.2
Alright, I see what I did wrong - the script has been updated to v1.3, which uses SDB.ApplicationPath instead of hardcoding.Lowlander wrote:No, MediaMonkey is not installed in the default location.
Re: Growl For Windows Notification 1.3
Yeah, hardcoded the correct path and it worked. I will try the new version.
On a side note, do you know how to get notifications from one to another PC?
On a side note, do you know how to get notifications from one to another PC?
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Re: Growl For Windows Notification 1.3
I've never done it, but the GfW folks have documentation about it here.Lowlander wrote:On a side note, do you know how to get notifications from one to another PC?
Re: Growl For Windows Notification 1.3
Could this be updated to add in notifications for when new podcast downloads have been completed? If not I may take a stab at writing a new script for it.
Thanks
Thanks
Re: Growl For Windows Notification 1.3
It looks possible using the OnTrackAdded event. Here's a rough version of the script that seems to be working.
I can't get it to report anything other than the podcast's title, though. I thought I could just do track.Artist or track.Album as well, but that throws up an error.
Feel free to give this a try and see if you have any luck with it.
Code: Select all
'
' MediaMonkey Script
'
' NAME: Growl for Windows Notification v1.4b
'
' AUTHOR: eriqjaffe, although 95% of this script is taken verbatim from "Now Playing FTP" by trixmoto (http://trixmoto.net)
' DATE : 12/01/09
'
Option Explicit
Sub OnStartup
Call Script.RegisterEvent(SDB,"OnPlay","Event_OnPlay")
Call Script.RegisterEvent(SDB,"OnStop","Event_OnStop")
Call Script.RegisterEvent(SDB,"OnShutdown","Event_OnShutdown")
Call Script.RegisterEvent(SDB,"OnPause","Event_OnPause")
Call Script.RegisterEvent(SDB,"OnTrackAdded","PodcastCheck")
End Sub
Sub Event_OnPlay()
Call SendInfo(0)
End Sub
Sub Event_OnStop()
Call SendInfo(1)
End Sub
Sub Event_OnShutdown()
Call SendInfo(2)
End Sub
Sub Event_OnPause()
Call SendInfo(3)
End Sub
' Sub Event_OnTrackAdded()
' Call PodcastCheck()
' End Sub
Sub SendInfo(mode)
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim wsh : Set wsh = CreateObject("WScript.Shell")
If mode = 0 Then
'get current song
Dim cur : Set cur = SDB.Player.CurrentSong
If cur Is Nothing Then
Exit Sub
End If
'get settings
Dim site : site = ""
Dim user : user = ""
Dim pass : pass = ""
Dim path : path = ""
Dim arti : arti = ""
Dim albu : albu = ""
Dim year : year = ""
Dim name : name = ""
Dim secs : secs = ""
Dim genr : genr = ""
Dim dnum : dnum = ""
Dim tnum : tnum = ""
Dim artw : artw = ""
Dim recs : recs = ""
Dim aart : aart = ""
Dim rati : rati = ""
Dim temp : temp = ""
Dim arr
Dim tmp2 : tmp2 = ""
Dim rndm : rndm = ""
Dim cmd : cmd = ""
Dim foo : foo = wsh.ExpandEnvironmentStrings("%TEMP%")&"\cover_growl.jpg"
Dim bar : bar = wsh.ExpandEnvironmentStrings("%TEMP%")&"\cover_growl.png"
Dim loc : loc = SDB.ApplicationPath & "\scripts\auto"
'check songlength
Dim msec : msec = 0
If IsNumeric(secs) Then
msec = secs*1000
End If
If cur.SongLength < msec Then
Exit Sub
End If
'create file
If Not (cur Is Nothing) Then
name = cur.Title
arti = cur.ArtistName
albu = cur.AlbumName
year = cur.Year
genr = cur.Genre
dnum = cur.DiscNumberStr
tnum = cur.TrackOrderStr
aart = cur.AlbumArtistName
rati = cur.Rating
path = cur.Path
artw = GetAlbumArt(cur,0)
If HtmlEncode(Mid(artw,InStrRev(artw,"\")+1)) = "np.jpg" Then
temp = "embedded"
artw = wsh.ExpandEnvironmentStrings("%TEMP%")&"\np.jpg"
Else
arr = Split(path,"\")
temp = "linked"
dim y : y = Ubound(arr) - 1
dim x : for x = 0 to y
tmp2 = tmp2 + arr(x) + "\"
next
artw = tmp2&Mid(artw,InStrRev(artw,"\")+1)
End If
If fso.FileExists(artw) Then
fso.CopyFile artw,wsh.ExpandEnvironmentStrings("%TEMP%")&"\cover_growl.jpg"
bar = wsh.ExpandEnvironmentStrings("%TEMP%")&"\cover_growl.jpg"
'resizeImage foo,100,100,bar
Else
'fso.CopyFile wsh.ExpandEnvironmentStrings("%PROGRAMFILES%")&"\mediamonkey\scripts\auto\mm3.png",bar
fso.CopyFile loc&"\mm3.png",bar
End If
End If
'cmd = chr(34)&wsh.ExpandEnvironmentStrings("%PROGRAMFILES%")&"\mediamonkey\scripts\auto\growlnotify.exe"&chr(34)&" /t:"&chr(34)&"MediaMonkey"&chr(34)&" /i:"&chr(34)&bar&chr(34)&" "&chr(34)&arti&"\n"&"''"&name&"''\n"&albu&chr(34)
cmd = chr(34)&loc&"\growlnotify.exe"&chr(34)&" /t:"&chr(34)&"MediaMonkey"&chr(34)&" /i:"&chr(34)&bar&chr(34)&" "&chr(34)&arti&"\n"&"''"&name&"''\n"&albu&chr(34)
wsh.Run cmd,2,0
set wsh = Nothing
end if
End Sub
Sub PodcastCheck(track)
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim wsh : Set wsh = CreateObject("WScript.Shell")
Dim loc : loc = SDB.ApplicationPath & "\scripts\auto"
Dim cmd : cmd = ""
if InStr(UCase(track.Genre),"PODCAST") > 0 Then
cmd = chr(34)&loc&"\growlnotify.exe"&chr(34)&" /t:"&chr(34)&"MediaMonkey"&chr(34)&" /i:"&chr(34)&loc&"\mm3.png"&chr(34)&" "&chr(34)&track.Title&"\nHas been downloaded"&chr(34)
wsh.Run cmd,2,0
set wsh = Nothing
end if
End Sub
Function GetAlbumArt(track,num)
GetAlbumArt = Replace(Script.ScriptPath,"chromeoutput.vbs","default.jpg")
Dim fso : Set fso = SDB.Tools.FileSystem
Dim wsh : Set wsh = CreateObject("WScript.Shell")
Dim str : str = "\np.jpg"
If num > 0 Then
str = "\np"&num&".jpg"
End If
Dim temp : temp = wsh.ExpandEnvironmentStrings("%TEMP%")&str
Dim pics : Set pics = track.AlbumArt
If Not (pics Is Nothing) Then
Dim i : i = 0
For i = 0 To pics.Count-1
If (pics.Item(i).ItemStorage = 0) Or (num > 0) Then
Dim img : Set img = pics.Item(i).Image
If Not (img Is Nothing) Then
Dim outimg : Set outimg = fso.CreateTextFile(temp,True)
If Not (outimg Is Nothing) Then
Call outimg.WriteData(img.ImageData,img.ImageDataLen)
outimg.Close
GetAlbumArt = temp
Exit Function
End If
End If
Else
GetAlbumArt = pics.Item(i).PicturePath
Exit Function
End If
Next
End If
End Function
Function HtmlEncode(str)
HtmlEncode = SDB.toAscii(str)
HtmlEncode = Replace(HtmlEncode,"&","&")
HtmlEncode = Replace(HtmlEncode,"""",""")
HtmlEncode = Replace(HtmlEncode,"<","<")
HtmlEncode = Replace(HtmlEncode,">",">")
End Function
Feel free to give this a try and see if you have any luck with it.
Re: Growl For Windows Notification 1.3
Cool this looks like it will work just fine for me. Thanks!
Re: Growl For Windows Notification 1.4
Glad to help - I've updated the installer, and the link in the first post is also updated.
Re: Growl For Windows Notification 1.4
Just a recommendation for your next update, you should use the [/a:application] [/r:types] [/n:type] switches with growlnotify so media monkey growl is registered as an application with growl. This will let end users better customize how to handle media monkey notifications. They could sticky a podcast download or use a different display.
Anyways thanks for updating to add the podcast support, appreciate it!
Anyways thanks for updating to add the podcast support, appreciate it!
-
- Posts: 2
- Joined: Sat Dec 05, 2009 12:56 am
- Contact:
Re: Growl For Windows Notification 1.4
I keep getting the following error message
I am using the latest version of Media Monkey
Please Help
does anyone know how to fix thisError #70 MicrosoftVBScript runtime Error
Permission Denied
File: "C:\Program Files\MediaMonkey\scripts\auto\Growl.vbs",Line: 111,column: 12
I am using the latest version of Media Monkey
Please Help