#35: Add is_playable

This commit is contained in:
Bill Dengler 2015-05-13 10:39:21 -04:00
parent 0845553047
commit ea7f5bacf9

View File

@ -94,8 +94,8 @@ class soundSystem(object):
sound_object.play()
class URLStream(object):
def __init__(self):
self.url = None
def __init__(self,url=None):
self.url = url
self.prepared = False
log.debug("URL Player initialized")
@ -130,6 +130,15 @@ class URLStream(object):
self.stream.play()
log.debug("played")
def is_playable(self, url):
try:
log.debug("Checking URL playability...")
self.prepare(url)
if self.prepared == True:
self.stream = sound_lib.stream.URLStream(url=self.url)
return True
except:
return False
def stop_audio(self):
if hasattr(self, "stream") and self.stream.is_playing == True:
self.stream.stop()