コード例 #1
0
    def set_tracker_hierarchy(self, hier):
        """ Set hierarchy of trackers (announce-list) following the spec
        at http://www.bittornado.com/docs/multitracker-spec.txt
        @param hier A hierarchy of trackers as a list of lists.
        """
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()

        # TODO: check input, in particular remove / at end
        newhier = []
        if type(hier) != ListType:
            raise ValueError("hierarchy is not a list")
        for tier in hier:
            if type(tier) != ListType:
                raise ValueError("tier is not a list")
            newtier = []
            for url in tier:
                if not isValidURL(url):
                    raise ValueError("Invalid URL: " + ` url `)

                if url.endswith('/'):
                    # Some tracker code can't deal with / at end
                    url = url[:-1]
                newtier.append(url)
            newhier.append(newtier)

        self.input['announce-list'] = newhier
        self.metainfo_valid = False
コード例 #2
0
ファイル: TorrentDef.py プロジェクト: Anaconda84/Anaconda
    def set_tracker_hierarchy(self, hier):
        """ Set hierarchy of trackers (announce-list) following the spec
        at http://www.bittornado.com/docs/multitracker-spec.txt
        @param hier A hierarchy of trackers as a list of lists.
        """
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()

        # TODO: check input, in particular remove / at end
        newhier = []
        if type(hier) != ListType:
            raise ValueError("hierarchy is not a list")
        for tier in hier:
            if type(tier) != ListType:
                raise ValueError("tier is not a list")
            newtier = []
            for url in tier:
                if not isValidURL(url):
                    raise ValueError("Invalid URL: " + ` url `)

                if url.endswith("/"):
                    # Some tracker code can't deal with / at end
                    url = url[:-1]
                newtier.append(url)
            newhier.append(newtier)

        self.input["announce-list"] = newhier
        self.metainfo_valid = False
コード例 #3
0
ファイル: TorrentDef.py プロジェクト: Antiade/tribler
    def set_tracker_hierarchy(self, hier):
        """ Set hierarchy of trackers (announce-list) following the spec
        at http://www.bittornado.com/docs/multitracker-spec.txt
        @param hier A hierarchy of trackers as a list of lists.
        """
        # TODO: check input, in particular remove / at end
        newhier = []
        if not isinstance(hier, ListType):
            raise ValueError("hierarchy is not a list")
        for tier in hier:
            if not isinstance(tier, ListType):
                raise ValueError("tier is not a list")
            newtier = []
            for url in tier:
                if not isValidURL(url):
                    self._logger.error("Invalid tracker URL: %s", repr(url))
                    continue

                if url.endswith('/'):
                    # Some tracker code can't deal with / at end
                    url = url[:-1]
                newtier.append(url)
            newhier.append(newtier)

        self.input['announce-list'] = newhier
        self.metainfo_valid = False
コード例 #4
0
    def set_tracker_hierarchy(self, hier):
        """ Set hierarchy of trackers (announce-list) following the spec
        at http://www.bittorrent.org/beps/bep_0012.html
        @param hier A hierarchy of trackers as a list of lists.
        """
        # TODO: check input, in particular remove / at end
        newhier = []
        if not isinstance(hier, ListType):
            raise ValueError("hierarchy is not a list")
        for tier in hier:
            if not isinstance(tier, ListType):
                raise ValueError("tier is not a list")
            newtier = []
            for url in tier:
                if not isValidURL(url):
                    self._logger.error("Invalid tracker URL: %s", repr(url))
                    continue

                if url.endswith('/'):
                    # Some tracker code can't deal with / at end
                    url = url[:-1]

                if self.get_tracker() is None:
                    # Backwards compatibility Multitracker Metadata Extension
                    self.set_tracker(url)
                newtier.append(url)
            newhier.append(newtier)

        self.input['announce-list'] = newhier
        self.metainfo_valid = False
コード例 #5
0
ファイル: TorrentDef.py プロジェクト: yorig/tribler
    def set_tracker_hierarchy(self, hier):
        """ Set hierarchy of trackers (announce-list) following the spec
        at http://www.bittornado.com/docs/multitracker-spec.txt
        @param hier A hierarchy of trackers as a list of lists.
        """
        # TODO: check input, in particular remove / at end
        newhier = []
        if not isinstance(hier, ListType):
            raise ValueError("hierarchy is not a list")
        for tier in hier:
            if not isinstance(tier, ListType):
                raise ValueError("tier is not a list")
            newtier = []
            for url in tier:
                if not isValidURL(url):
                    self._logger.error("Invalid tracker URL: %s", repr(url))
                    continue

                if url.endswith('/'):
                    # Some tracker code can't deal with / at end
                    url = url[:-1]
                newtier.append(url)
            newhier.append(newtier)

        self.input['announce-list'] = newhier
        self.metainfo_valid = False
コード例 #6
0
ファイル: TorrentDef.py プロジェクト: Antiade/tribler
    def set_httpseeds(self, value):
        """ Set list of HTTP seeds following the BEP 17 spec (John Hoffman style):
        http://www.bittorrent.org/beps/bep_0017.html
        @param value A list of URLs.
        """
        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: " + repr(url))

        self.input['httpseeds'] = value
        self.metainfo_valid = False
コード例 #7
0
ファイル: TorrentDef.py プロジェクト: Antiade/tribler
    def set_urllist(self, value):
        """ Set list of HTTP seeds following the BEP 19 spec (GetRight style):
        http://www.bittorrent.org/beps/bep_0019.html
        @param value A list of URLs.
        """
        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: " + repr(url))

        self.input['url-list'] = value
        self.metainfo_valid = False
コード例 #8
0
    def set_httpseeds(self, value):
        """ Set list of HTTP seeds following the BEP 17 spec (John Hoffman style):
        http://www.bittorrent.org/beps/bep_0017.html
        @param value A list of URLs.
        """
        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: " + repr(url))

        self.input['httpseeds'] = value
        self.metainfo_valid = False
コード例 #9
0
    def set_urllist(self, value):
        """ Set list of HTTP seeds following the BEP 19 spec (GetRight style):
        http://www.bittorrent.org/beps/bep_0019.html
        @param value A list of URLs.
        """
        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: " + repr(url))

        self.input['url-list'] = value
        self.metainfo_valid = False
コード例 #10
0
ファイル: TorrentDef.py プロジェクト: Antiade/tribler
    def set_tracker(self, url):
        """ Sets the tracker (i.e. the torrent file's 'announce' field).
        @param url The announce URL.
        """
        if not isValidURL(url):
            raise ValueError("Invalid URL")

        if url.endswith('/'):
            # Some tracker code can't deal with / at end
            url = url[:-1]
        self.input['announce'] = url
        self.metainfo_valid = False
コード例 #11
0
    def set_tracker(self, url):
        """ Sets the tracker (i.e. the torrent file's 'announce' field).
        @param url The announce URL.
        """
        if not isValidURL(url):
            raise ValueError("Invalid URL")

        if url.endswith('/'):
            # Some tracker code can't deal with / at end
            url = url[:-1]
        self.input['announce'] = url
        self.metainfo_valid = False
コード例 #12
0
ファイル: TorrentDef.py プロジェクト: Anaconda84/Anaconda
    def set_httpseeds(self, value):
        """ Set list of HTTP seeds following the spec at
        http://www.bittornado.com/docs/webseed-spec.txt
        @param value A list of URLs.
        """
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()

        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: " + ` url `)

        self.input["httpseeds"] = value
        self.metainfo_valid = False
コード例 #13
0
    def set_httpseeds(self, value):
        """ Set list of HTTP seeds following the BEP 17 spec (John Hoffman style):
        http://www.bittorrent.org/beps/bep_0017.html
        @param value A list of URLs.
        """
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()

        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: " + ` url `)

        self.input['httpseeds'] = value
        self.metainfo_valid = False
コード例 #14
0
ファイル: TorrentDef.py プロジェクト: egbertbouman/tribler-g
    def set_httpseeds(self,value):
        """ Set list of HTTP seeds following the BEP 17 spec (John Hoffman style):
        http://www.bittorrent.org/beps/bep_0017.html
        @param value A list of URLs.
        """
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()

        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: "+`url`)

        self.input['httpseeds'] = value
        self.metainfo_valid = False
コード例 #15
0
ファイル: TorrentDef.py プロジェクト: nomadsummer/cs198mojo
    def set_httpseeds(self, value):
        """ Set list of HTTP seeds following the spec at
        http://www.bittornado.com/docs/webseed-spec.txt
        @param value A list of URLs.
        """
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()

        for url in value:
            if not isValidURL(url):
                raise ValueError("Invalid URL: " + ` url `)

        self.input['httpseeds'] = value
        self.metainfo_valid = False
コード例 #16
0
ファイル: TorrentDef.py プロジェクト: Anaconda84/Anaconda
    def set_tracker(self, url):
        """ Sets the tracker (i.e. the torrent file's 'announce' field). 
        @param url The announce URL.
        """
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()

        if not isValidURL(url):
            raise ValueError("Invalid URL")

        if url.endswith("/"):
            # Some tracker code can't deal with / at end
            url = url[:-1]
        self.input["announce"] = url
        self.metainfo_valid = False