Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Basic requirements

Script to add growl notifications to cmus
  • Loading branch information...
commit c0b3f88ec8f6f4743a27b6314bdd2212c4454b82 1 parent b4316aa
@joshbenham authored
Showing with 53 additions and 0 deletions.
  1. +51 −0 cmus-growl
  2. +2 −0  requirements.txt
View
51 cmus-growl
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import gntp.notifier
+
+if __name__ == '__main__':
+
+ # open up log to write to
+ f = open('/var/tmp/cmus.log', 'w')
+
+ # extract the data
+ data = dict(zip(sys.argv[1::2], sys.argv[2::2]))
+
+ # set a default artwork image
+ artwork = "http://example.org"
+
+ # create the title/description
+ title = "%(artist)s" % data
+ description = "%(album)s / %(tracknumber)s / %(date)s \n%(title)s" % data
+
+ # try to see if folder.jpg exists
+ try:
+ folder = os.path.dirname(data['file'])
+ if os.path.exists(folder+"/folder.jpg"):
+ artwork = file(folder+"/folder.jpg", 'r').read()
+ except TypeError as e:
+ f.write("Type Error: %s\n" % e)
+ except:
+ f.write("%s\n" % sys.exc_info()[0])
+
+ #f.write("%s\n" % artwork)
+ f.close()
+
+ # create/register the growl notifier
+ growl = gntp.notifier.GrowlNotifier(
+ applicationName = "cmus",
+ notifications = ["New Song"],
+ defaultNotifications = ["New Song"],
+ )
+ growl.register()
+
+ # notify the key press
+ growl.notify(
+ noteType = "New Song",
+ title = title,
+ description = description,
+ icon = artwork,
+ sticky = False,
+ priority = 1,
+ )
View
2  requirements.txt
@@ -0,0 +1,2 @@
+gntp==0.7
+wsgiref==0.1.2
Please sign in to comment.
Something went wrong with that request. Please try again.