Set prepared=False after playing and stopping an audio in URLStream class

This commit is contained in:
Jose Manuel Delicado 2017-09-22 17:38:03 +02:00
parent 11703f50fe
commit 851f711357

View File

@ -109,11 +109,10 @@ class URLStream(object):
transformer = audio_services.find_url_transformer(self.url) transformer = audio_services.find_url_transformer(self.url)
self.url = transformer(self.url) self.url = transformer(self.url)
log.debug("Transformed URL: %s. Prepared" % (self.url,)) log.debug("Transformed URL: %s. Prepared" % (self.url,))
self.prepared = True
else: else:
self.url = url self.url = url
log.debug("Transformed URL: %s. Prepared" % (self.url,)) log.debug("Transformed URL: %s. Prepared" % (self.url,))
self.prepared = True self.prepared = True
def seek(self,step): def seek(self,step):
pos=self.stream.get_position() pos=self.stream.get_position()
@ -144,6 +143,7 @@ class URLStream(object):
self.stream.volume = float(volume) self.stream.volume = float(volume)
self.stream.play() self.stream.play()
log.debug("played") log.debug("played")
self.prepared=False
def stop_audio(self,delete=False): def stop_audio(self,delete=False):
if hasattr(self, "stream"): if hasattr(self, "stream"):
@ -156,6 +156,7 @@ class URLStream(object):
if delete: if delete:
del self.stream del self.stream
log.debug("Deleted audio stream.") log.debug("Deleted audio stream.")
self.prepared=False
return True return True
else: else:
return False return False