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
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
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
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
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
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
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
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
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
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
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
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