aboutsummaryrefslogtreecommitdiffstats
path: root/player_vlc.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2021-12-21 19:32:11 +0100
committerEddy Pedroni <eddy@0xf7.com>2021-12-21 19:32:11 +0100
commitae8f0a04190c3d13292ad68548f5275507e5812e (patch)
tree1bc207715280e6e9a1b99a84f9435e98d15bda1b /player_vlc.py
parent9ee7ee992d468b4f354ac16c34747e0c31d7b656 (diff)
Added some integration tests, refactored playlist, updated diagram
Diffstat (limited to 'player_vlc.py')
-rw-r--r--player_vlc.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/player_vlc.py b/player_vlc.py
new file mode 100644
index 0000000..9c8362a
--- /dev/null
+++ b/player_vlc.py
@@ -0,0 +1,36 @@
+import vlc
+
+class Player:
+ def __init__(self):
+ self.player = vlc.MediaPlayer()
+
+ def play(self):
+ self.player.play()
+
+ def stop(self):
+ self.player.stop()
+
+ def pause(self):
+ self.player.pause()
+
+ def setPlaybackRate(self, rate):
+ self.player.set_rate(rate)
+
+ def getPlaybackRate(self):
+ return self.player.get_rate()
+
+ def setPlaybackPosition(self, position):
+ self.player.set_position(position)
+
+ def getPlaybackPosition(self):
+ return self.player.get_position()
+
+ def setPlaybackVolume(self, volume):
+ self.player.audio_set_volume(int(volume * 100))
+
+ def getPlaybackVolume(self):
+ return self.player.audio_get_volume() / 100.0
+
+ def setCurrentSong(self, path):
+ media = vlc.Media(path)
+ self.player.set_media(media)