Example #1
0
    def __init__(self, install_dir='.'):
        
        if Category.__single:
            raise RuntimeError, "Category is singleton"
        filename = os.path.join(install_dir,'Tribler', 'Category', category_file)
        Category.__single = self
        self.utility = None
        #self.torrent_db = TorrentDBHandler.getInstance()
        try:
            self.category_info = getCategoryInfo(filename)
            self.category_info.sort(rankcmp)
        except:
            self.category_info = None
            print_exc()

        self.xxx_filter = XXXFilter(install_dir)
        
        
        if DEBUG:
            print >>sys.stderr,"category: Categories defined by user",self.getCategoryNames()
Example #2
0
    def __init__(self, install_dir='.', ffEnabled=False):

        if Category.__single:
            raise RuntimeError("Category is singleton")
        filename = os.path.join(install_dir, LIBRARYNAME, 'Category', category_file)
        Category.__single = self
        try:
            self.category_info = getCategoryInfo(filename)
            self.category_info.sort(rankcmp)
        except:
            self.category_info = []
            if DEBUG:
                print_exc()

        self.xxx_filter = XXXFilter(install_dir)

        if DEBUG:
            print >> sys.stderr, "category: Categories defined by user", self.getCategoryNames()

        self.ffEnabled = ffEnabled
        self.set_family_filter(None)
Example #3
0
    def __init__(self, install_dir='.'):
        
        if Category.__single:
            raise RuntimeError, "Category is singleton"
        filename = os.path.join(install_dir,LIBRARYNAME, 'Category', category_file)
        Category.__single = self
        self.utility = None
        #self.torrent_db = TorrentDBHandler.getInstance() # Arno, 2009-01-30: apparently unused
        try:
            self.category_info = getCategoryInfo(filename)
            self.category_info.sort(rankcmp)
        except:
            self.category_info = []
            if DEBUG:
                print_exc()

        self.xxx_filter = XXXFilter(install_dir)
        
        
        if DEBUG:
            print >>sys.stderr,time.asctime(),'-', "category: Categories defined by user",self.getCategoryNames()
Example #4
0
    def __init__(self, session, ffEnabled=False):
        self._logger = logging.getLogger(self.__class__.__name__)
        self._session = session

        if Category.__single:
            raise RuntimeError("Category is singleton")
        filename = os.path.join(self._session.get_install_dir(), LIBRARYNAME, u'Category', CATEGORY_CONFIG_FILE)
        Category.__single = self
        try:
            self.category_info = getCategoryInfo(filename)
            self.category_info.sort(cmp_rank)
        except:
            self.category_info = []
            self._logger.critical('', exc_info=True)

        self.xxx_filter = XXXFilter(self._session.get_install_dir())

        self._logger.debug("category: Categories defined by user: %s", self.getCategoryNames())

        self.ffEnabled = ffEnabled
        self.set_family_filter(None)