Skip to content

Commit c92a480

Browse files
committed
cmus.py 1.1: make script compatible with Python 3, drop Python 2 support
1 parent 2f8c068 commit c92a480

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

python/cmus.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
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
2020
import weechat
2121
import 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

2626
def 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

4343
def 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

Comments
 (0)