Skip to content
Browse files

Retabbed cmus to use 4 tab spaces

  • Loading branch information...
1 parent b4c4aff commit 45c94bac36007a3ca203a1f076d6806d05af65f1 @joshbenham committed May 31, 2012
Showing with 45 additions and 45 deletions.
  1. +45 −45 cmus-growl
View
90 cmus-growl
@@ -1,54 +1,54 @@
#!/usr/bin/env python
-# vi: sw=2 ts=2
import os
import sys
import gntp.notifier
+
def main(argv):
- # open up log to write to
- f = open('/var/tmp/cmus.log', 'w')
-
- # extract the data
- data = dict(zip(argv[1::2], 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,
- )
+ # open up log to write to
+ f = open('/var/tmp/cmus.log', 'w')
+
+ # extract the data
+ data = dict(zip(argv[1::2], 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.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,
+ )
+
if __name__ == '__main__':
- main(sys.argv)
+ main(sys.argv)

0 comments on commit 45c94ba

Please sign in to comment.
Something went wrong with that request. Please try again.