Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Wrap in a main() method
Browse files Browse the repository at this point in the history
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
Rich Healey committed May 31, 2012
1 parent d003624 commit e634698
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmus-growl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import os
import sys import sys
import gntp.notifier import gntp.notifier


if __name__ == '__main__': def main(argv):

# open up log to write to # open up log to write to
f = open('/var/tmp/cmus.log', 'w') f = open('/var/tmp/cmus.log', 'w')


# extract the data # 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 # set a default artwork image
artwork = "http://example.org" artwork = "http://example.org"
Expand Down Expand Up @@ -50,3 +49,6 @@ if __name__ == '__main__':
sticky = False, sticky = False,
priority = 1, priority = 1,
) )

if __name__ == '__main__':
main(sys.argv)

0 comments on commit e634698

Please sign in to comment.