def parse(self, filetree=1):
     if not self.__m_filedata:
         log.error("No data to process!")
         return
     try:
         self.__m_metadata = bencode.bdecode(self.__m_filedata)
     except Exception, e:
         log.warning("Failed to decode torrent data %s: %s", self.filename if self.filename else "", e)
         raise e
Exemple #2
0
 def parse(self, filetree=1):
     if not self.__m_filedata:
         log.error("No data to process!")
         return
     try:
         self.__m_metadata = bencode.bdecode(self.__m_filedata)
     except Exception, e:
         log.warning("Failed to decode torrent data %s: %s",
                     self.filename if self.filename else "", e)
         raise e
 def __init__(self, filename=None, filedump=None, filetree=1):
     if not filename and not filedump:
         log.error("Both filename and filedump are None!")
         return
     self.filename = None
     if filename:
         self.filename = filename
         # Read the torrent from file
         try:
             log.debug("Attempting to open %s.", filename)
             self.__m_filedata = open(filename, "rb").read()
         except Exception, e:
             log.warning("Unable to open %s: %s", filename, e)
             raise e
Exemple #4
0
 def __init__(self, filename=None, filedump=None, filetree=1):
     if not filename and not filedump:
         log.error("Both filename and filedump are None!")
         return
     self.filename = None
     if filename:
         self.filename = filename
         # Read the torrent from file
         try:
             log.debug("Attempting to open %s.", filename)
             self.__m_filedata = open(filename, "rb").read()
         except Exception, e:
             log.warning("Unable to open %s: %s", filename, e)
             raise e