It look like to me you don't understand what I am trying to do. I am fetching the url from the database to play the video. If the video link is dead, I want to fetch the new video link in the database and play the video. This is what I am trying to do. I hope this is clear to you?
On your code that you wrote, it will fetch the url from the column
On your code that you wrote, it will fetch the url from the column
stream1_url
to play the video but the video link I am trying to play is dead so the code that you wrote did not call the play function again to fetch the new link from the column stream2_url
when the video link is dead. I think you need to read my post again to try to understand what I am trying to achieve.(May-03-2018, 08:27 PM)ThiefOfTime Wrote: Depending on what you want to do if you do not find a functioning link. currently you keep on trying the first url.
possibility one: just one test over all urls
def play(self, item = None, windowed = False): print "you are working on play.........................." max_number_urls = 3 bool = True url = '' if not self.player.isPlayingVideo(): conn = database.connect(self.profilePath + 'source.db') cur = conn.cursor() self.count += 1 print "self.count...............................for stream_url column" print self.count try: while self.count <= max_number_urls: cur.execute('SELECT stream%i_url FROM streams WHERE channels=?' % self.count, [self.EPG_Channel]) data = cur.fetchone() if data is not None: # you found an url in the database url = data[0] if self.check_url_functioning() == True: break self.count += 1 if self.count == max_number_urls + 1: raise RuntimeError("no URL works") except: print "All URLs down" conn.close() self.player.play(url, windowed = bool) self.channel_pressed = Falsewhat you could do alternatively is keep on searching through the known urls if they will come back some day. or you may do that just (lets say) 10 times before checking the next one. then use a counter to count the repetitions. Or a timer if you want to do ist every 5 seconds :)