def __init__(self, player): #init own variables self.player = player self.ytie = YoutubeIE() #playlist init self.pl_filename = None self.pl = Playlist() self.gtk_init() self._temp_init()
class Playlist_wrapper(Playlist_interface): def __init__(self, player): #init own variables self.player = player self.ytie = YoutubeIE() #playlist init self.pl_filename = None self.pl = Playlist() self.gtk_init() self._temp_init() def _temp_init(self): self._open("playlists/test.gump") #self.set_input_url("http://www.youtube.com/watch?v=IVmd66Y1DfI") #self.set_url_clicked(None) #self._add_playlist_item("http://www.youtube.com/watch?v=IVmd66Y1DfI") #self._add_playlist_item("http://www.youtube.com/watch?v=mzNEgcqWDG4") #self._add_playlist_item("http://www.youtube.com/watch?v=kRFxTfb6_wI") #http://www.youtube.com/watch?v=wKjXVELQElE def _add_playlist_item(self, infos, url): infos["url"] = url self.pl.add_item(infos) def _move_up(self, num): if num != self.pl.length: self.pl.swap_items(num, num+1) def _move_down(self, num): if num != 0: self.pl.swap_items(num, num-1) #API def get_current_item(self): return self.pl.get_current_item() def go_next(self): self.pl.select_next() def go_previous(self): self.pl.select_previous() def _choose_format(self, infos, d): print infos def _save(self, filename): self.pl_filename = filename with open(filename, "w") as f: self.pl.save(f) def _open(self, filename): self.pl_filename = filename with open(filename, "r") as f: self.pl.load(f)