Added checks when using player_function
This commit is contained in:
parent
9003d3c738
commit
5a36db2366
@ -849,13 +849,16 @@ class Controller(object):
|
|||||||
self.search("me_audio").play_all()
|
self.search("me_audio").play_all()
|
||||||
|
|
||||||
def menu_volume_down(self, *args, **kwargs):
|
def menu_volume_down(self, *args, **kwargs):
|
||||||
player.player.volume = player.player.volume-2
|
if player.player != None:
|
||||||
|
player.player.volume = player.player.volume-2
|
||||||
|
|
||||||
def menu_volume_up(self, *args, **kwargs):
|
def menu_volume_up(self, *args, **kwargs):
|
||||||
player.player.volume = player.player.volume+2
|
if player.player != None:
|
||||||
|
player.player.volume = player.player.volume+2
|
||||||
|
|
||||||
def menu_mute(self, *args, **kwargs):
|
def menu_mute(self, *args, **kwargs):
|
||||||
player.player.volume = 0
|
if player.player != None:
|
||||||
|
player.player.volume = 0
|
||||||
|
|
||||||
def seek_left(self, *args, **kwargs):
|
def seek_left(self, *args, **kwargs):
|
||||||
pub.sendMessage("seek", ms=-500000)
|
pub.sendMessage("seek", ms=-500000)
|
||||||
|
@ -198,7 +198,7 @@ class audioPlayer(object):
|
|||||||
""" Check if the stream has reached the end of the file so it will play the next song. """
|
""" Check if the stream has reached the end of the file so it will play the next song. """
|
||||||
if self.message != None and self.message.is_playing == False and len(self.message) == self.message.position:
|
if self.message != None and self.message.is_playing == False and len(self.message) == self.message.position:
|
||||||
volume_step = self.volume*0.15
|
volume_step = self.volume*0.15
|
||||||
while self.stream.volume*100 < self.volume:
|
while self.stream != None and self.stream.volume*100 < self.volume:
|
||||||
self.stream.volume = self.stream.volume+(volume_step/100)
|
self.stream.volume = self.stream.volume+(volume_step/100)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
if self.stream != None and self.stream.is_playing == False and self.stopped == False and len(self.stream) == self.stream.position:
|
if self.stream != None and self.stream.is_playing == False and self.stopped == False and len(self.stream) == self.stream.position:
|
||||||
|
Loading…
Reference in New Issue
Block a user