1616# Made as a port of cmus_xchat-v2.0, also made by Isaac Ross. Due to the nature of weechat's plugin/scripting API,
1717# this was mostly made using find/replace in a text editor
1818
19- import commands
19+ import subprocess
2020import weechat
2121import os
2222
23- weechat .register ("cmus" , "Isaac Ross" , "1.02 " , "GPL2" , "Adds ability to control cmus and post the currently playing song in a channel" , "" , "" )
23+ weechat .register ("cmus" , "Isaac Ross" , "1.1 " , "GPL2" , "Adds ability to control cmus and post the currently playing song in a channel" , "" , "" )
2424
2525
2626def help ():
@@ -41,7 +41,7 @@ def help():
4141 weechat .prnt ('' , "Keep in mind that most problems will probably be related to cmus-remote, not this script" )
4242
4343def np ():
44- cmus = commands .getoutput ('cmus-remote -Q' )
44+ cmus = subprocess .getoutput ('cmus-remote -Q' )
4545 lines = cmus .split ('\n ' )
4646
4747 #some redundant loops later, but streamline as needed
@@ -89,14 +89,14 @@ def control(data, buffer, args):
8989 os .system ('cmus-remote -S' )
9090 weechat .prnt ('' , 'Toggled shuffle on/off.' )
9191 elif args [0 ].lower () == 'status' :
92- status = commands .getoutput ('cmus-remote -Q' )
92+ status = subprocess .getoutput ('cmus-remote -Q' )
9393 status = status .split ('\n ' )
9494 for line in status :
9595 weechat .prnt ('' , " -- " + line )
9696 elif args [0 ].lower () == 'help' :
9797 help ()
9898 elif args [0 ].lower () == 'file' :
99- filename = commands .getoutput ('cmus-remote -Q' )
99+ filename = subprocess .getoutput ('cmus-remote -Q' )
100100 filename = filename .split ('\n ' )
101101 newname = filename [1 ]
102102 newname = newname .replace ('file' , '' , 1 )
0 commit comments