|
22 | 22 | # Imports |
23 | 23 | try: |
24 | 24 | import weechat |
25 | | - |
| 25 | + IMPORT_OK = True |
26 | 26 | except ImportError: |
27 | | - import sys |
28 | | - |
29 | | - print '\nError: Script must be run under Weechat.\n' |
30 | | - |
31 | | - sys.exit(2) |
| 27 | + print('Error: Script must be run under Weechat.') |
| 28 | + IMPORT_OK = False |
32 | 29 |
|
33 | 30 | import dbus |
34 | 31 |
|
35 | 32 |
|
36 | | -weechat.register('clemy', "Your mommy's boyfriend", '0.1.1', 'GPLv3', 'Control yo Clementine like boom-blaka!', '', '') |
37 | | - |
38 | | -err_message = '\nSomething silly just happend. Make sure Clementine is running mah dude.' |
| 33 | +err_message = '\nSomething silly just happend. Make sure Clementine is running mah dude.' |
39 | 34 |
|
40 | 35 |
|
41 | 36 | def help(): |
@@ -187,9 +182,11 @@ def weechat_np(data, buffer, args): |
187 | 182 | return weechat.WEECHAT_RC_OK |
188 | 183 |
|
189 | 184 |
|
190 | | -weechat.hook_command('clemynp', 'Get/output now playing info', '', '', '', 'weechat_np', '') |
191 | | -weechat.hook_command('clemy', 'Control Clementine', "[play] | [pause] | [next] | [prev] | [stop] | [vol+] | [vol-] | [vol+by <n>] | [vol-by <n>] | [playtrack <n>] | [help]", |
192 | | -""" |
| 185 | +if __name__ == "__main__" and IMPORT_OK: |
| 186 | + weechat.register('clemy', "Your mommy's boyfriend", '0.1.2', 'GPLv3', 'Control yo Clementine like boom-blaka!', '', '') |
| 187 | + weechat.hook_command('clemynp', 'Get/output now playing info', '', '', '', 'weechat_np', '') |
| 188 | + weechat.hook_command('clemy', 'Control Clementine', "[play] | [pause] | [next] | [prev] | [stop] | [vol+] | [vol-] | [vol+by <n>] | [vol-by <n>] | [playtrack <n>] | [help]", |
| 189 | + """ |
193 | 190 | play: Play song. |
194 | 191 | pause: Pause song. |
195 | 192 | next: Play next song. |
|
0 commit comments