def _dataBase(self): def db_delete(self): self.song_controller.removeSongById(self.received_msg['info']) def db_showdb(self): self.response['type'] = "json" self.response['queryType'] = 'database' songs = self.song_controller.toArray() self.response['songs'] = songs def db_addSong(self): self.song_controller.addKnownSong({'song': self.received_msg['song'], 'artist': self.received_msg['artist'], 'stream': self.received_msg['stream']}) def db_addSongAndriod(self): self.song_controller.addKnownSong({'song': arr[0], 'artist': arr[1], 'stream': arr[2]}) def db_addSongBySourceType(self): self.song_controller.addSongBySourceType(self.received_msg) def db_fetchdb(self): pass self.song_controller = songs_controller() dataBase_options = {'delete': db_delete, 'showdb': db_showdb, 'addSong': db_addSong, 'addSongAndroid': db_addSongAndriod, 'addSongBySourceType': db_addSongBySourceType, 'fetchdb': db_fetchdb} cmd = self.received_msg['cmd'] dataBase_options[cmd](self)
def __init__(self): self.client = Client() self.client.init() self.sc = songs_controller() self.sc.clearSongsTable() vlc_args = [""] self.instance = vlc.libvlc_new(len(vlc_args),vlc_args) self.mlist = self.instance.media_list_new() self.player = self.instance.media_player_new() self.mlp = self.instance.media_list_player_new() self.mlp.set_media_player(self.player) self.mlp.set_media_list(self.mlist) self.em = self.player.event_manager() self.em.event_attach(vlc.EventType.MediaPlayerEndReached, self.songEnded)
def __init__(self): self.gc = groove_controller(self) self.vc = vlc_controller(self) self.sc = songs_controller()