コード例 #1
0
 def getInfo(self, filePath):
     key = md5(latinToAscii(filePath)).digest()
     if not self.hashes.get(key):
         self.hashes[key] = {
             'moviehash': hashFile(filePath),
             'moviebytesize': str(os.path.getsize(filePath))
         }
     return self.hashes.get(key)
コード例 #2
0
 def getInfo(self, filePath):
     key = md5(latinToAscii(filePath)).digest()
     if not self.hashes.get(key):
         self.hashes[key] = {
             'moviehash': hashFile(filePath),
             'moviebytesize': str(os.path.getsize(filePath))
         }
     return self.hashes.get(key)
コード例 #3
0
ファイル: library.py プロジェクト: nberlee/CouchPotato
    def getMovies(self, folder=None, withMeta=True):
        log.debug("getMoviesStart")

        movies = []
        qualities = Qualities()

        movieFolder = unicode(folder) if folder else self.config.get("Renamer", "destination")
        if not os.path.isdir(movieFolder):
            log.error("Can't find directory: %s" % movieFolder)
            return movies

        log.debug("os.walk(movieFolder) %s" % movieFolder)
        for root, subfiles, filenames in os.walk(movieFolder):
            if self.abort:
                log.debug("Aborting moviescan")
                return movies

            movie = {
                "movie": None,
                "queue": 0,
                "match": False,
                "meta": {},
                "info": {
                    "name": None,
                    "cpnfoImdb": None,
                    "ppScriptName": None,
                    "imdb": None,
                    "year": None,
                    "quality": "",
                    "resolution": None,
                    "sourcemedia": "",
                    "size": 0,
                    "codec": {"video": "", "audio": ""},
                    "group": "",
                },
                "history": None,
                "path": root,
                "folder": root.split(os.path.sep)[-1:].pop(),
                "nfo": [],
                "files": [],
                "trailer": [],
                "cpnfo": None,
                "subtitles": {"files": [], "extras": []},
            }

            if movie["folder"] == "VIDEO_TS":
                movie["folder"] = movie["path"].split(os.path.sep)[-2:-1].pop()
                movie["info"]["quality"] = "dvdr"

            if movie["folder"] == "STREAM" and movie["path"].split(os.path.sep)[-2:-1].pop() == "BDMV":
                movie["folder"] = movie["path"].split(os.path.sep)[-3:-2].pop()
                movie["info"]["quality"] = "bluray"
                movie["info"]["sourcemedia"] = "bluray"

            patterns = []
            for extType in self.extensions.itervalues():
                patterns.extend(extType)

            for pattern in patterns:
                for filename in fnmatch.filter(sorted(filenames), pattern):
                    fullFilePath = os.path.join(root, filename)
                    log.debug("Processing file: %s" % fullFilePath)

                    new = {
                        "filename": filename,
                        "ext": os.path.splitext(filename)[1].lower()[1:],  # [1:]to remove . from extension
                    }

                    # cpnfo
                    if new.get("filename") in self.extensions["cpnfo"]:
                        movie["cpnfo"] = new.get("filename")
                    # nfo file
                    if "*." + new.get("ext") in self.extensions["nfo"]:
                        movie["nfo"].append(filename)
                    # subtitle file
                    elif "*." + new.get("ext") in self.extensions["subtitle"]:
                        movie["subtitles"]["files"].append(new)
                    # idx files
                    elif "*." + new.get("ext") in self.extensions["subtitleExtras"]:
                        movie["subtitles"]["extras"].append(new)
                    # trailer file
                    elif re.search("(^|[\W_])trailer\d*[\W_]", filename.lower()) and self.filesizeBetween(
                        fullFilePath, 2, 250
                    ):
                        movie["trailer"].append(new)
                    else:
                        # ignore movies files / or not
                        if self.keepFile(fullFilePath):
                            log.debug("self.keepFile(fullFilePath)")
                            new["hash"] = hashFile(fullFilePath)  # Add movie hash
                            new["size"] = os.path.getsize(fullFilePath)  # File size
                            movie["files"].append(new)

            if movie["files"]:
                log.debug("Files found")
                # Find movie by cpnfo
                if movie["cpnfo"]:
                    log.debug("Scanning cpnfo")
                    cpnfoFile = open(os.path.join(movie["path"], movie["cpnfo"]), "r").readlines()
                    cpnfoFile = [x.strip() for x in cpnfoFile]
                    movie["info"]["ppScriptName"] = cpnfoFile[0]
                    movie["info"]["cpnfoImdb"] = cpnfoFile[1]

                # Find movie by nfo
                if movie["nfo"]:
                    log.debug("Scanning nfo")
                    for nfo in movie["nfo"]:
                        nfoFile = open(os.path.join(movie["path"], nfo), "r").read()
                        movie["info"]["imdb"] = self.getImdb(nfoFile)

                # Find movie via files
                log.debug("self.determineMovie(movie)")
                movie["movie"] = self.determineMovie(movie)

                if movie["movie"]:
                    movie["match"] = True

                    log.debug("self.getHistory(movie[movie])")
                    movie["history"] = self.getHistory(movie["movie"])
                    movie["queue"] = self.getQueue(movie["movie"])

                    movie["info"]["name"] = movie["movie"].name
                    movie["info"]["year"] = movie["movie"].year
                    if movie["info"]["quality"] == "":
                        try:
                            movie["info"]["quality"] = qualities.types.get(movie["queue"].qualityType).get("label")
                        except:
                            movie["info"]["quality"] = qualities.guess(
                                [os.path.join(movie["path"], file["filename"]) for file in movie["files"]]
                            )

                    for file in movie["files"]:
                        movie["info"]["size"] += file["size"]

                    movie["info"]["size"] = str(movie["info"]["size"])
                    movie["info"]["group"] = self.getGroup(movie["folder"])
                    movie["info"]["codec"]["video"] = self.getCodec(movie["folder"], self.codecs["video"])
                    movie["info"]["codec"]["audio"] = self.getCodec(movie["folder"], self.codecs["audio"])

                    # get metainfo about file
                    if withMeta:
                        log.debug("self.getHistory(movie[movie])")
                        testFile = os.path.join(movie["path"], movie["files"][0]["filename"])
                        try:
                            movie["meta"].update(self.getMeta(testFile))
                        except:
                            pass

                        # check the video file for its resolution
                        if movie["meta"].has_key("video stream"):
                            width = movie["meta"]["video stream"][0]["image width"]
                            height = movie["meta"]["video stream"][0]["image height"]

                            if width and height:
                                if width > 1900 and width < 2000 and height <= 1080:
                                    namedResolution = "1080p"
                                elif width > 1200 and width < 1300 and height <= 720:
                                    namedResolution = "720p"
                                else:
                                    namedResolution = None
                        else:
                            log.info("Unable to fetch audio/video details for %s" % testFile)
                            namedResolution = None

                        movie["info"]["resolution"] = namedResolution
                        if movie["info"]["sourcemedia"] == "":
                            movie["info"]["sourcemedia"] = self.getSourceMedia(testFile)

                # Create filename without cd1/cd2 etc
                log.debug("removeMultipart")
                movie["filename"] = self.removeMultipart(os.path.splitext(movie["files"][0]["filename"])[0])

                # Give back ids, not table rows
                if self.noTables:
                    log.debug("self.noTables")
                    movie["history"] = [h.id for h in movie["history"]] if movie["history"] else movie["history"]
                    movie["movie"] = movie["movie"].id if movie["movie"] else movie["movie"]

                log.debug("movies.append(movie)")
                movies.append(movie)

        log.debug("getMoviesEnd")
        return movies
コード例 #4
0
ファイル: library.py プロジェクト: FrozenCow/CouchPotato
    def getMovies(self, folder = None):

        movies = []
        qualities = Qualities()

        movieFolder = unicode(folder if folder else self.config.get('Renamer', 'destination'))
        if not os.path.isdir(movieFolder):
            log.error('Can\'t find directory: %s' % movieFolder)
            return movies

        for root, subfiles, filenames in os.walk(movieFolder):
            if self.abort:  return movies

            movie = {
                'movie': None,
                'queue': 0,
                'match': False,
                'info': {
                    'name': None,
                    'year': None,
                    'quality': '',
                    'resolution': None,
                    'sourcemedia': '',
                    'size': 0,
                    'codec': {
                        'video': '',
                        'audio': ''
                    },
                    'group': ''
                },
                'history': None,
                'path': root,
                'folder': root.split(os.path.sep)[-1:].pop(),
                'nfo':[], 'files':[], 'trailer':[],
                'subtitles':{
                    'files': [],
                    'extras': []
                }
            }

            patterns = []
            for extType in self.extensions.itervalues():
                patterns.extend(extType)

            for pattern in patterns:
                for filename in fnmatch.filter(sorted(filenames), pattern):
                    fullFilePath = os.path.join(root, filename)
                    new = {
                       'filename': filename,
                       'ext': os.path.splitext(filename)[1].lower()[1:], #[1:]to remove . from extension
                    }

                    #nfo file
                    if('*.' + new.get('ext') in self.extensions['nfo']):
                        movie['nfo'].append(filename)
                    #subtitle file
                    elif('*.' + new.get('ext') in self.extensions['subtitle']):
                        movie['subtitles']['files'].append(new)
                    #idx files
                    elif('*.' + new.get('ext') in self.extensions['subtitleExtras']):
                        movie['subtitles']['extras'].append(new)
                    #trailer file
                    elif re.search('(^|[\W_])trailer\d*[\W_]', filename.lower()) and self.filesizeBetween(fullFilePath, 2, 250):
                        movie['trailer'].append(new)
                    else:
                        #ignore movies files / or not
                        if self.keepFile(fullFilePath):
                            new['hash'] = hashFile(fullFilePath) # Add movie hash
                            new['size'] = os.path.getsize(fullFilePath) # File size
                            movie['files'].append(new)

            if movie['files']:

                # Find movie by nfo
                if movie['nfo']:
                    for nfo in movie['nfo']:
                        nfoFile = open(os.path.join(movie['path'], nfo), 'r').read()
                        imdbId = self.getImdb(nfoFile)
                        if imdbId:
                            movie['movie'] = self.getMovieByIMDB(imdbId)

                # Find movie via files
                if not movie['movie']:
                    movie['movie'] = self.determineMovie(movie)

                if movie['movie']:
                    movie['history'] = self.getHistory(movie['movie'])

                    movie['match'] = True
                    movie['info']['name'] = movie['movie'].name
                    movie['info']['year'] = movie['movie'].year
                    try:
                        movie['info']['quality'] = movie['history'].movieQueue.qualityType
                    except:
                        movie['info']['quality'] = qualities.guess([os.path.join(movie['path'], file['filename']) for file in movie['files']])

                    for file in movie['files']:
                        movie['info']['size'] += file['size']

                    movie['info']['size'] = str(movie['info']['size'])
                    movie['info']['group'] = self.getGroup(movie['folder'])
                    movie['info']['codec']['video'] = self.getCodec(movie['folder'], self.codecs['video'])
                    movie['info']['codec']['audio'] = self.getCodec(movie['folder'], self.codecs['audio'])

                    #check the video file for it's resolution
                    test_file = os.path.join(movie['path'], movie['files'][0]['filename'])
                    resolution = self.getVideoResolution(test_file)

                    if resolution:
                        if resolution[0] > 1900 and resolution[0] < 2000 and resolution[1] <= 1080:
                            named_resolution = '1080p'
                        elif resolution[0] > 1200 and resolution[0] < 1300 and resolution[1] <= 720:
                            named_resolution = '720p'
                        else:
                            named_resolution = None
                    else:
                        named_resolution = None
                    movie['info']['resolution'] = named_resolution
                    movie['info']['sourcemedia'] = self.getSourceMedia(test_file)

                # Create filename without cd1/cd2 etc
                movie['filename'] = self.removeMultipart(os.path.splitext(movie['files'][0]['filename'])[0])

                # Give back ids, not table rows
                if self.noTables:
                    movie['history'] = [h.id for h in movie['history']] if movie['history'] else movie['history']
                    movie['movie'] = movie['movie'].id if movie['movie'] else movie['movie']

                movies.append(movie)

        return movies
コード例 #5
0
ファイル: library.py プロジェクト: bjensen/CouchPotato
    def getMovies(self, folder = None, withMeta = True):
        log.debug('getMoviesStart')

        movies = []
        qualities = Qualities()

        movieFolder = unicode(folder) if folder else self.config.get('Renamer', 'destination')
        if not os.path.isdir(movieFolder):
            log.error('Can\'t find directory: %s' % movieFolder)
            return movies

        log.debug('os.walk(movieFolder) %s' % movieFolder)
        # Walk the tree once to catch any UnicodeDecodeErrors that might arise
        # from malformed file and directory names. Use the non-unicode version
        # of movieFolder if so.
        try:
            for x in os.walk(movieFolder): pass
            walker = os.walk(movieFolder)
        except UnicodeDecodeError:
            walker = os.walk(str(movieFolder))
        for root, subfiles, filenames in walker:
            if self.abort:
                log.debug('Aborting moviescan')
                return movies

            movie = {
                'movie': None,
                'queue': 0,
                'match': False,
                'meta': {},
                'info': {
                    'name': None,
                    'cpnfoImdb': None,
                    'ppScriptName': None,
                    'imdb': None,
                    'year': None,
                    'quality': '',
                    'resolution': None,
                    'sourcemedia': '',
                    'size': 0,
                    'codec': {
                        'video': '',
                        'audio': ''
                    },
                    'group': ''
                },
                'history': None,
                'path': root,
                'folder': root.split(os.path.sep)[-1:].pop(),
                'nfo':[], 'files':[], 'trailer':[], 'cpnfo':None,
                'subtitles':{
                    'files': [],
                    'extras': []
                }
            }

            if movie['folder'] == 'VIDEO_TS':
                movie['folder'] = movie['path'].split(os.path.sep)[-2:-1].pop()

            patterns = []
            for extType in self.extensions.itervalues():
                patterns.extend(extType)

            for pattern in patterns:
                for filename in fnmatch.filter(sorted(filenames), pattern):
                    fullFilePath = os.path.join(root, filename)
                    log.debug('Processing file: %s' % fullFilePath)

                    new = {
                       'filename': filename,
                       'ext': os.path.splitext(filename)[1].lower()[1:], #[1:]to remove . from extension
                    }

                    #cpnfo
                    if new.get('filename') in self.extensions['cpnfo']:
                        movie['cpnfo'] = new.get('filename')
                    #nfo file
                    if('*.' + new.get('ext') in self.extensions['nfo']):
                        movie['nfo'].append(filename)
                    #subtitle file
                    elif('*.' + new.get('ext') in self.extensions['subtitle']):
                        movie['subtitles']['files'].append(new)
                    #idx files
                    elif('*.' + new.get('ext') in self.extensions['subtitleExtras']):
                        movie['subtitles']['extras'].append(new)
                    #trailer file
                    elif re.search('(^|[\W_])trailer\d*[\W_]', filename.lower()) and self.filesizeBetween(fullFilePath, 2, 250):
                        movie['trailer'].append(new)
                    else:
                        #ignore movies files / or not
                        if self.keepFile(fullFilePath):
                            log.debug('self.keepFile(fullFilePath)')
                            new['hash'] = hashFile(fullFilePath) # Add movie hash
                            new['size'] = os.path.getsize(fullFilePath) # File size
                            movie['files'].append(new)

            if movie['files']:
                log.debug('Files found')
                #Find movie by cpnfo
                if movie['cpnfo']:
                    log.debug('Scanning cpnfo')
                    cpnfoFile = open(os.path.join(movie['path'], movie['cpnfo']), 'r').readlines()
                    cpnfoFile = [x.strip() for x in cpnfoFile]
                    movie['info']['ppScriptName'] = cpnfoFile[0]
                    movie['info']['cpnfoImdb'] = cpnfoFile[1]

                # Find movie by nfo
                if movie['nfo']:
                    log.debug('Scanning nfo')
                    for nfo in movie['nfo']:
                        nfoFile = open(os.path.join(movie['path'], nfo), 'r').read()
                        movie['info']['imdb'] = self.getImdb(nfoFile)

                # Find movie via files
                log.debug('self.determineMovie(movie)')
                movie['movie'] = self.determineMovie(movie)

                if movie['movie']:
                    movie['match'] = True

                    log.debug('self.getHistory(movie[movie])')
                    movie['history'] = self.getHistory(movie['movie'])
                    movie['queue'] = self.getQueue(movie['movie'])

                    movie['info']['name'] = movie['movie'].name
                    movie['info']['year'] = movie['movie'].year
                    try:
                        movie['info']['quality'] = qualities.types.get(movie['queue'].qualityType).get('label')
                    except:
                        movie['info']['quality'] = qualities.guess([os.path.join(movie['path'], file['filename']) for file in movie['files']])

                    for file in movie['files']:
                        movie['info']['size'] += file['size']

                    movie['info']['size'] = str(movie['info']['size'])
                    movie['info']['group'] = self.getGroup(movie['folder'])
                    movie['info']['codec']['video'] = self.getCodec(movie['folder'], self.codecs['video'])
                    movie['info']['codec']['audio'] = self.getCodec(movie['folder'], self.codecs['audio'])

                    #get metainfo about file
                    if withMeta:
                        log.debug('self.getHistory(movie[movie])')
                        testFile = os.path.join(movie['path'], movie['files'][0]['filename'])
                        try:
                            movie['meta'].update(self.getMeta(testFile))
                        except:
                            pass

                        #check the video file for its resolution
                        if movie['meta'].has_key('video stream'):
                            width = movie['meta']['video stream'][0]['image width']
                            height = movie['meta']['video stream'][0]['image height']

                            if width and height:
                                if width > 1900 and width < 2000 and height <= 1080:
                                    namedResolution = '1080p'
                                elif width > 1200 and width < 1300 and height <= 720:
                                    namedResolution = '720p'
                                else:
                                    namedResolution = None
                        else:
                            log.info("Unable to fetch audio/video details for %s" % testFile)
                            namedResolution = None

                        movie['info']['resolution'] = namedResolution
                        movie['info']['sourcemedia'] = self.getSourceMedia(testFile)

                # Create filename without cd1/cd2 etc
                log.debug('removeMultipart')
                movie['filename'] = self.removeMultipart(os.path.splitext(movie['files'][0]['filename'])[0])

                # Give back ids, not table rows
                if self.noTables:
                    log.debug('self.noTables')
                    movie['history'] = [h.id for h in movie['history']] if movie['history'] else movie['history']
                    movie['movie'] = movie['movie'].id if movie['movie'] else movie['movie']

                log.debug('movies.append(movie)')
                movies.append(movie)

        log.debug('getMoviesEnd')
        return movies
コード例 #6
0
ファイル: library.py プロジェクト: mchhaily/CouchPotato
    def getMovies(self, folder=None, withMeta=True):
        log.debug('getMoviesStart')

        movies = []
        qualities = Qualities()

        movieFolder = unicode(folder) if folder else self.config.get(
            'Renamer', 'destination')
        if not os.path.isdir(movieFolder):
            log.error('Can\'t find directory: %s' % movieFolder)
            return movies

        log.debug('os.walk(movieFolder) %s' % movieFolder)
        # Walk the tree once to catch any UnicodeDecodeErrors that might arise
        # from malformed file and directory names. Use the non-unicode version
        # of movieFolder if so.
        try:
            for x in os.walk(movieFolder):
                pass
            walker = os.walk(movieFolder)
        except UnicodeDecodeError:
            walker = os.walk(str(movieFolder))
        for root, subfiles, filenames in walker:
            if self.abort:
                log.debug('Aborting moviescan')
                return movies

            movie = {
                'movie': None,
                'queue': 0,
                'match': False,
                'meta': {},
                'info': {
                    'name': None,
                    'cpnfoImdb': None,
                    'ppScriptName': None,
                    'imdb': None,
                    'year': None,
                    'quality': '',
                    'resolution': None,
                    'sourcemedia': '',
                    'size': 0,
                    'codec': {
                        'video': '',
                        'audio': ''
                    },
                    'group': ''
                },
                'history': None,
                'path': root,
                'folder': root.split(os.path.sep)[-1:].pop(),
                'nfo': [],
                'files': [],
                'trailer': [],
                'cpnfo': None,
                'subtitles': {
                    'files': [],
                    'extras': []
                }
            }

            if movie['folder'] == 'VIDEO_TS':
                movie['folder'] = movie['path'].split(os.path.sep)[-2:-1].pop()

            patterns = []
            for extType in self.extensions.itervalues():
                patterns.extend(extType)

            for pattern in patterns:
                for filename in fnmatch.filter(sorted(filenames), pattern):
                    fullFilePath = os.path.join(root, filename)
                    log.debug('Processing file: %s' % fullFilePath)

                    new = {
                        'filename': filename,
                        'ext': os.path.splitext(filename)[1].lower()
                        [1:],  #[1:]to remove . from extension
                    }

                    #cpnfo
                    if new.get('filename') in self.extensions['cpnfo']:
                        movie['cpnfo'] = new.get('filename')
                    #nfo file
                    if ('*.' + new.get('ext') in self.extensions['nfo']):
                        movie['nfo'].append(filename)
                    #subtitle file
                    elif ('*.' + new.get('ext')
                          in self.extensions['subtitle']):
                        movie['subtitles']['files'].append(new)
                    #idx files
                    elif ('*.' + new.get('ext')
                          in self.extensions['subtitleExtras']):
                        movie['subtitles']['extras'].append(new)
                    #trailer file
                    elif re.search('(^|[\W_])trailer\d*[\W_]',
                                   filename.lower()) and self.filesizeBetween(
                                       fullFilePath, 2, 250):
                        movie['trailer'].append(new)
                    else:
                        #ignore movies files / or not
                        if self.keepFile(fullFilePath):
                            log.debug('self.keepFile(fullFilePath)')
                            new['hash'] = hashFile(
                                fullFilePath)  # Add movie hash
                            new['size'] = os.path.getsize(
                                fullFilePath)  # File size
                            movie['files'].append(new)

            if movie['files']:
                log.debug('Files found')
                #Find movie by cpnfo
                if movie['cpnfo']:
                    log.debug('Scanning cpnfo')
                    cpnfoFile = open(
                        os.path.join(movie['path'], movie['cpnfo']),
                        'r').readlines()
                    cpnfoFile = [x.strip() for x in cpnfoFile]
                    movie['info']['ppScriptName'] = cpnfoFile[0]
                    movie['info']['cpnfoImdb'] = cpnfoFile[1]

                # Find movie by nfo
                if movie['nfo']:
                    log.debug('Scanning nfo')
                    for nfo in movie['nfo']:
                        nfoFile = open(os.path.join(movie['path'], nfo),
                                       'r').read()
                        movie['info']['imdb'] = self.getImdb(nfoFile)

                # Find movie via files
                log.debug('self.determineMovie(movie)')
                movie['movie'] = self.determineMovie(movie)

                if movie['movie']:
                    movie['match'] = True

                    log.debug('self.getHistory(movie[movie])')
                    movie['history'] = self.getHistory(movie['movie'])
                    movie['queue'] = self.getQueue(movie['movie'])

                    movie['info']['name'] = movie['movie'].name
                    movie['info']['year'] = movie['movie'].year
                    try:
                        movie['info']['quality'] = qualities.types.get(
                            movie['queue'].qualityType).get('label')
                    except:
                        movie['info']['quality'] = qualities.guess([
                            os.path.join(movie['path'], file['filename'])
                            for file in movie['files']
                        ])

                    for file in movie['files']:
                        movie['info']['size'] += file['size']

                    movie['info']['size'] = str(movie['info']['size'])
                    movie['info']['group'] = self.getGroup(movie['folder'])
                    movie['info']['codec']['video'] = self.getCodec(
                        movie['folder'], self.codecs['video'])
                    movie['info']['codec']['audio'] = self.getCodec(
                        movie['folder'], self.codecs['audio'])

                    #get metainfo about file
                    if withMeta:
                        log.debug('self.getHistory(movie[movie])')
                        testFile = os.path.join(movie['path'],
                                                movie['files'][0]['filename'])
                        try:
                            movie['meta'].update(self.getMeta(testFile))
                        except:
                            pass

                        #check the video file for its resolution
                        if movie['meta'].has_key('video stream'):
                            width = movie['meta']['video stream'][0][
                                'image width']
                            height = movie['meta']['video stream'][0][
                                'image height']

                            if width and height:
                                if width > 1900 and width < 2000 and height <= 1080:
                                    namedResolution = '1080p'
                                elif width > 1200 and width < 1300 and height <= 720:
                                    namedResolution = '720p'
                                else:
                                    namedResolution = None
                        else:
                            log.info(
                                "Unable to fetch audio/video details for %s" %
                                testFile)
                            namedResolution = None

                        movie['info']['resolution'] = namedResolution
                        movie['info']['sourcemedia'] = self.getSourceMedia(
                            testFile)

                # Create filename without cd1/cd2 etc
                log.debug('removeMultipart')
                movie['filename'] = self.removeMultipart(
                    os.path.splitext(movie['files'][0]['filename'])[0])

                # Give back ids, not table rows
                if self.noTables:
                    log.debug('self.noTables')
                    movie['history'] = [
                        h.id for h in movie['history']
                    ] if movie['history'] else movie['history']
                    movie['movie'] = movie['movie'].id if movie[
                        'movie'] else movie['movie']

                log.debug('movies.append(movie)')
                movies.append(movie)

        log.debug('getMoviesEnd')
        return movies