Added checks when using player_function

This commit is contained in:
Manuel Cortez 2019-10-07 16:50:30 -05:00
parent 9003d3c738
commit 5a36db2366
2 changed files with 7 additions and 4 deletions

View File

@ -849,13 +849,16 @@ class Controller(object):
self.search("me_audio").play_all()
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):
player.player.volume = player.player.volume+2
if player.player != None:
player.player.volume = player.player.volume+2
def menu_mute(self, *args, **kwargs):
player.player.volume = 0
if player.player != None:
player.player.volume = 0
def seek_left(self, *args, **kwargs):
pub.sendMessage("seek", ms=-500000)

View File

@ -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. """
if self.message != None and self.message.is_playing == False and len(self.message) == self.message.position:
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)
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: