예제 #1
0
파일: artist.py 프로젝트: dignan/telemote
    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)
예제 #2
0
    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
예제 #3
0
    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)
예제 #4
0
파일: player.py 프로젝트: dignan/telemote
    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
예제 #5
0
파일: player.py 프로젝트: dignan/telemote
    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)
예제 #6
0
    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)
예제 #7
0
파일: player.py 프로젝트: dignan/telemote
    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)
예제 #8
0
파일: player.py 프로젝트: dignan/telemote
    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))
예제 #9
0
    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))
예제 #10
0
파일: album.py 프로젝트: jessevdk/telemote
    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)
예제 #11
0
    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)
예제 #12
0
파일: player.py 프로젝트: dignan/telemote
 def _method_volume_PUT(self, args, request):
     utils.run_in_main(self.player.set_volume, float(args[0]))
예제 #13
0
 def _method_seek_PUT(self, args, request):
     offset = int(args[0])
     utils.run_in_main(self.player.seek, offset)
예제 #14
0
    def _method_play_PUT(self, args, request):
        r, playing = self.player.get_playing()

        if not playing:
            utils.run_in_main(self.player.playpause, False)
예제 #15
0
파일: player.py 프로젝트: dignan/telemote
 def _method_next_PUT(self, args, request):
     utils.run_in_main(self.player.do_next)
예제 #16
0
파일: player.py 프로젝트: dignan/telemote
 def _method_previous_PUT(self, args, request):
     utils.run_in_main(self.player.do_previous)
예제 #17
0
파일: player.py 프로젝트: dignan/telemote
 def _method_seek_PUT(self, args, request):
     offset = int(args[0])
     utils.run_in_main(self.player.seek, offset)
예제 #18
0
파일: player.py 프로젝트: dignan/telemote
    def _method_play_PUT(self, args, request):
        r, playing = self.player.get_playing()

        if not playing:
            utils.run_in_main(self.player.playpause, False)
예제 #19
0
 def _method_next_PUT(self, args, request):
     utils.run_in_main(self.player.do_next)
예제 #20
0
 def _method_previous_PUT(self, args, request):
     utils.run_in_main(self.player.do_previous)
예제 #21
0
 def _method_volume_PUT(self, args, request):
     utils.run_in_main(self.player.set_volume, float(args[0]))