Пример #1
0
 def __init__(self, apikey):
     try:
         self.apikey = apikey
         self.log = TNGLog()
         self.urls['images'] = self.__GetImageURL() + 'original'
     except Exception as e:
         self.log.error(unicode(e))
         raise
Пример #2
0
    def __init__(self, RootDestination):
        #Root Folder has to Contain Folders like this A-D, E-G etc.
        if self.__ContainsGroupFolders(RootDestination) is False:
            self.__dstFolders['root'] = RootDestination
        else:
            self.__GetDstFolders(RootDestination)

        self.log = TNGLog()
Пример #3
0
 def __init__(self, server, username=None, password=None):
     self.username = username
     self.password = password
     self.server = server
     self.version = '2.0'
     self.log = TNGLog()
Пример #4
0
    def __init__(
        self,
        #Path to the Folder containing the Movie
        path,
        #Language for the Movie
        language='',
        #ApiKey for TMDB
        apikey='',
    ):

        self.files = {}
        self.newFiles = {}
        self.newFiles['video'] = []
        self.newFiles['nfo'] = []
        self.infos = u''
        self.NFO = u''
        self.nfoname = u''
        self.path = path
        self.log = TNGLog()
        self.id = False

        # Read the configuration
        self.config = ConfigParser()
        self.config.read(os.path.join(os.getcwd(), 'settings.cfg'))

        try:
            #=======================================================================
            # Get Paths for all Items in current movie
            #=======================================================================
            self.files['video'] = self.__GetFileType(
                self.path, ('.mkv', '.mp4', '.mov', '.mpg', '.avi', '.mpeg'),
                100
            )  #For Movies we want a minimum filesize of 100 MB, otherwise we assume it is a sample
            self.files['nfo'] = self.__GetFileType(self.path, '.nfo')
            self.files['image'] = self.__GetFileType(
                self.path, ('.jpg', '.jpeg', '.png', '.tbn'))

            #=======================================================================
            # Extract the Name of the Movie from the Folder
            #=======================================================================
            self.Name = self.__GetNamefromFolder(os.path.basename(path))
            self.Year = self.__GetYear(os.path.basename(path))

            if len(apikey) > 0:
                self.tmdb = tmdb(apikey)
                #=======================================================================
                # Get an IMDB ID
                #=======================================================================

                #First try to get ID from Foldername
                _id = self.__GetIDFromFolder()
                if _id is False:
                    #Search the NFO Files for ID
                    _id = self.__SearchIDbyNFO()
                #Query the TMDB
                if _id is False:
                    _id = self.tmdb.search(self.Name)

                if _id is False and self.config.get('General',
                                                    'interactive') == 'True':
                    _id = self.__GetIDfromUser()

                if _id is False:
                    raise Exception("Could not get ID for item %s" %
                                    os.path.basename(self.path))
                else:
                    self.id = _id

                #===================================================================
                # Get detailed Movie Information and store them in self.infos
                #===================================================================
                self.__GetDetailedMovieInfos(language)

        except Exception:
            raise
Пример #5
0
 def __init__(self, path1, path2):
     self.log = TNGLog()
     self.item = {}
     if self.addFile(path1) or self.addFile(path2):
         raise Exception("skipping compare: at least one file is missing")
Пример #6
0
        dest='language',
        type=unicode,
        default='de',
        required=False,
        help='Language of Movie Infos in ISO 639-1 code Default:German(de)')
    args = parser.parse_args()

    #===========================================================================
    # Logging
    #===========================================================================

    logpath = os.path.abspath(os.path.join(LogFile, os.pardir))
    if not os.path.isdir(logpath):
        os.mkdir(logpath)
    #Create the wrapper log instance
    log = TNGLog()

    formatter = logging.Formatter('%(asctime)s [%(levelname)-8s] %(message)s',
                                  '%d-%m-%Y %H:%M:%S')

    #Initialize the File Logger
    hdlr = handlers.RotatingFileHandler(os.path.join(LogFile), 'a', 524288, 10)
    hdlr.setLevel(logging.DEBUG)
    #hdlr.setLevel(logging.DEBUG) if args.debugMode == True else hdlr.setLevel(logging.INFO)
    hdlr.setFormatter(formatter)
    log.logger.addHandler(hdlr)

    #Initialize the Stdout Logger
    hdlr2 = logging.StreamHandler(sys.stdout)
    hdlr2.setFormatter(formatter)
    hdlr2.setLevel(