Ejemplo n.º 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
Ejemplo n.º 2
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
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
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
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
0
    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