예제 #1
0
    def play(self, torrent, file_id, title=None, icon=None, cover=None):
        if not title:
            title = ''
        if not icon:
            icon = ''
        if not cover:
            cover = ''

        ts = TSengine()
        if str(
                ts.load_torrent(base64.b64encode(torrent),
                                'RAW',
                                port=self._get_port())).upper() != 'OK':
            ts.end()
            return

        ts.play_url_ind(int(file_id), title, icon, cover)
        ts.end()
예제 #2
0
 def play(self, torrent, file_id, title=None, icon=None, cover=None):
     if not title:
         title = ''
     if not icon:
         icon = ''
     if not cover:
         cover = ''
         
     ts = TSengine()
     if str(ts.load_torrent(base64.b64encode(torrent), 'RAW', port=self._get_port())).upper() != 'OK':
         ts.end()
         return
     
     ts.play_url_ind(int(file_id), title, icon, cover)
     ts.end()
예제 #3
0
 def list(self, torrent, reverse=False):
     ts = TSengine()
     if str(ts.load_torrent(base64.b64encode(torrent), 'RAW', port=self._get_port())).upper() != 'OK':
         ts.end()
         return None
     
     if not ts.files or not isinstance(ts.files, dict):
         ts.end()
         return None
     
     files = [{'id': v, 'name': urllib.unquote(k)} for k, v in ts.files.iteritems()]
     ts.end()
     files.sort(cmp=lambda f1, f2: cmp(f1['name'], f2['name']))
     if reverse:
         files.reverse()
     return files
예제 #4
0
    def list(self, torrent, reverse=False):
        ts = TSengine()
        if str(
                ts.load_torrent(base64.b64encode(torrent),
                                'RAW',
                                port=self._get_port())).upper() != 'OK':
            ts.end()
            return None

        if not ts.files or not isinstance(ts.files, dict):
            ts.end()
            return None

        files = [{
            'id': v,
            'name': urllib.unquote(k)
        } for k, v in ts.files.iteritems()]
        ts.end()
        files.sort(cmp=lambda f1, f2: cmp(f1['name'], f2['name']))
        if reverse:
            files.reverse()
        return files