Ejemplo n.º 1
0
 def play_song(self, song_info):
     uri = song_info['url']
     filepath = make_local_filename(song_info)
     self.set_play_state(self.http_player, gst.STATE_NULL)
     self.set_play_state(self.local_player, gst.STATE_NULL)
     if os.path.isfile(filepath):
         self.local_player.set_property('uri', 'file://' + filepath)
         self.current_player = self.local_player
         self.set_play_state(self.local_player, gst.STATE_PLAYING)
     else:
         self.http_player.get_by_name('httpsrc').set_property('location', uri)
         self.http_player.get_by_name('filedest').set_property('location', filepath)
         self.current_player = self.http_player
         self.set_play_state(self.http_player, gst.STATE_PLAYING)
     self.playmode = True
Ejemplo n.º 2
0
 def stop_and_remove(self, player, song_info):
     player.stop_song()
     local_filename = make_local_filename(self.current_song_info)
     if player.is_http_player() and os.path.exists(local_filename):
         os.remove(local_filename)