Permalink
Browse files

Wrap in a main() method

The include guard is pretty pointless if it can't be called as a module.

Seperate concerns for the module's argv and the invocation argv
  • Loading branch information...
1 parent d003624 commit e634698cbf05e05cfd3c88e1c0e151dba058b3cb Rich Healey committed May 31, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 cmus-growl
View
@@ -5,13 +5,12 @@ import os
import sys
import gntp.notifier
-if __name__ == '__main__':
-
+def main(argv):
# 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]))
+ data = dict(zip(argv[1::2], argv[2::2]))
# set a default artwork image
artwork = "http://example.org"
@@ -50,3 +49,6 @@ if __name__ == '__main__':
sticky = False,
priority = 1,
)
+
+if __name__ == '__main__':
+ main(sys.argv)

0 comments on commit e634698

Please sign in to comment.