예제 #1
0
    def set_httpseeds(self, value):
        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
예제 #2
0
 def set_tracker(self, url):
     if self.readonly:
         raise OperationNotPossibleAtRuntimeException()
     if not isValidURL(url):
         raise ValueError('Invalid URL')
     if url.endswith('/'):
         url = url[:-1]
     self.input['announce'] = url
     self.metainfo_valid = False
예제 #3
0
    def set_urllist(self, value, invalidate = True):
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()
        for url in value:
            if not isValidURL(url):
                raise ValueError('Invalid URL: ' + `url`)

        self.input['url-list'] = value
        if invalidate:
            self.metainfo_valid = False
        elif self.metainfo_valid:
            self.metainfo['url-list'] = value
예제 #4
0
    def set_tracker_hierarchy(self, hier):
        if self.readonly:
            raise OperationNotPossibleAtRuntimeException()
        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('/'):
                    url = url[:-1]
                newtier.append(url)

            newhier.append(newtier)

        self.input['announce-list'] = newhier
        self.metainfo_valid = False