def build_model(self): db = self.base.model.props.db args = [] isall = False for i in xrange(len(self.artists)): artist = self.artists[i] if artist[1]: args = [] isall = True break if i != 0: args.append(RB.RhythmDBQueryType.DISJUNCTIVE_MARKER) args.extend([RB.RhythmDBQueryType.EQUALS, RB.RhythmDBPropType.ARTIST, artist[0]]) self.model = telemotec.query_model_new(db, *args) telemotec.query_model_set_sorted(self.model) if isall: self.model.copy_contents(self.base.model) else: self.model.chain(self.base.model, False) utils.run_in_main(telemotec.query_model_do, db, self.model)
def _method_playlist_PUT(self, args, request): srcid = int(args[0]) a = [] # Build a query model for id in args[1].split(','): id = id.strip() if not id: continue if len(a) > 0: a.append(RB.RhythmDBQueryType.DISJUNCTIVE_MARKER) a.extend([ RB.RhythmDBQueryType.EQUALS, RB.RhythmDBPropType.ENTRY_ID, int(id) ]) db = self.shell.props.db model = telemotec.query_model_new(db, *a) utils.run_in_main(telemotec.query_model_do, db, model) source = self.sources.source(srcid) source.props.query_model = model self.player.props.source = source
def _method_mute_PUT(self, args, request): if int(args[0]): mute = True else: mute = False utils.run_in_main(self.player.set_mute, mute)
def _method_playlist_PUT(self, args, request): srcid = int(args[0]) a = [] # Build a query model for id in args[1].split(','): id = id.strip() if not id: continue if len(a) > 0: a.append(RB.RhythmDBQueryType.DISJUNCTIVE_MARKER) a.extend([RB.RhythmDBQueryType.EQUALS, RB.RhythmDBPropType.ENTRY_ID, int(id)]) db = self.shell.props.db model = telemotec.query_model_new(db, *a) utils.run_in_main(telemotec.query_model_do, db, model) source = self.sources.source(srcid) source.props.query_model = model self.player.props.source = source
def _method_repeat_PUT(self, args, request): ret, shuffle, repeat = self.player.get_playback_state() if int(args[0]): repeat = True else: repeat = False utils.run_in_main(self.player.set_playback_state, shuffle, repeat)
def _method_dequeue_PUT(self, args, request): for id in args[0].split(','): id = id.strip() if not id: continue entry = self.shell.props.db.entry_lookup_by_id(int(id)) utils.run_in_main(self.shell.remove_from_queue, entry.get_string(RB.RhythmDBPropType.LOCATION))
def build_model(self): db = self.base.model.props.db args = [] for i in xrange(len(self.albums)): album = self.albums[i] if i != 0: args.append(RB.RhythmDBQueryType.DISJUNCTIVE_MARKER) args.extend([RB.RhythmDBQueryType.EQUALS, RB.RhythmDBPropType.ALBUM, album[0]]) self.model = telemotec.query_model_new(db, *args) self.model.chain(self.base.model, False) utils.run_in_main(telemotec.query_model_do, db, self.model)
def build_model(self): db = self.base.model.props.db args = [] for i in xrange(len(self.albums)): album = self.albums[i] if i != 0: args.append(RB.RhythmDBQueryType.DISJUNCTIVE_MARKER) args.extend([ RB.RhythmDBQueryType.EQUALS, RB.RhythmDBPropType.ALBUM, album[0] ]) self.model = telemotec.query_model_new(db, *args) self.model.chain(self.base.model, False) utils.run_in_main(telemotec.query_model_do, db, self.model)
def _method_volume_PUT(self, args, request): utils.run_in_main(self.player.set_volume, float(args[0]))
def _method_seek_PUT(self, args, request): offset = int(args[0]) utils.run_in_main(self.player.seek, offset)
def _method_play_PUT(self, args, request): r, playing = self.player.get_playing() if not playing: utils.run_in_main(self.player.playpause, False)
def _method_next_PUT(self, args, request): utils.run_in_main(self.player.do_next)
def _method_previous_PUT(self, args, request): utils.run_in_main(self.player.do_previous)