-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmpc.py
More file actions
32 lines (23 loc) · 795 Bytes
/
mpc.py
File metadata and controls
32 lines (23 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import subprocess
class Mpc:
def mpcCommand(self, cmd):
p = subprocess.Popen(['mpc'] + cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
return p.stdout.read()
def play(self, url):
self.clear()
self.addStation(url)
self.mpcCommand(["play"])
def stop(self):
self.mpcCommand(["stop"])
def clear(self):
self.mpcCommand(["clear"])
def addStation(self, url):
self.mpcCommand(["add", url])
def volumeDecrease(self):
self.mpcCommand(["volume", "-1"])
def volumeIncrease(self):
self.mpcCommand(["volume", "+1"])
def volumeDecreaseFast(self):
self.mpcCommand(["volume", "-15"])
def volumeIncreaseFast(self):
self.mpcCommand(["volume", "+15"])