Exemple #1
0
def renameActor(actor, shortName):
    path = SysConst.getImageCachePath() + actor
    newPath = SysConst.getImageCachePath() + shortName
    exist = os.path.exists(path)
    exist2 = os.path.exists(newPath)
    if exist and not exist2:
        Log.info(path + " <--> " + newPath)
        os.rename(path, newPath)
Exemple #2
0
def calcByActor(actor):
    movies = MovieDAO.getMoviesByCondition("actor = '" + actor + "' and vr = 1")
    print(movies)

    allImages = DiskIndex.getAllImages(SysConst.getImageCachePath())

    for movie in movies:
        calcMovie(movie, allImages)
Exemple #3
0
def copyImageToTemp(movieNumbers):
    if not os.path.exists(SysConst.getImageTempPath()):
        os.mkdir(SysConst.getImageTempPath())

    allImages = getAllImages(SysConst.getImageCachePath())
    for num in movieNumbers:
        for image in allImages:
            if num in image["fullpath"]:
                shutil.copy(image["fullpath"],
                            SysConst.getImageTempPath() + image["filename"])
                break
Exemple #4
0
def copyOneImageToTemp(actor, avNumber):
    if not os.path.exists(SysConst.getImageTempPath()):
        os.mkdir(SysConst.getImageTempPath())

    source = SysConst.getImageCachePath() + actor + "//" + avNumber + ".jpg"
    to = SysConst.getImageTempPath() + avNumber + ".jpg"
    shutil.copy(source, to)


# avList = [{"av_number": "ABS-072"}]
# pprint(findLocalMovies(avList=avList, path="G://Game//File//"))

#deleteSmallImages(SysConst.getImageCachePath())
#copyImageToTemp(["ABS-072"])
#copyOneImageToTemp("阿部乃美久", "ARMG-274")
Exemple #5
0
def calcMovie(movie, allImages):
    try:
        actor = movie["actor"]
        conn = SysConst.getConnect()
        basePath = SysConst.getImageCachePath() + actor + "//" + movie["av_number"] + ".jpg";

        if not os.path.exists(basePath):
            print("can not find file: " + basePath)
            return

        base = movie["av_number"]
        targetMap = getTargetMap(base, conn)
        print("compare " + actor + "/" + base)
        count = 0
        skipCount = 0

        for image in allImages:
            targetPath = image["fullpath"]
            target = image["filename"][0:-4]
            # exist = SimilarDAO.hasSimilar(base, target, conn)
            if not target in targetMap:
                # print(targetPath)
                count += 1

                if count % 500 == 0:
                    print("calc " + str(count))
                    conn.commit()
                    conn.close()
                    conn = SysConst.getConnect()

                similar = ImageSimilar.calc_similar_by_path(basePath, targetPath)
                obj = {"base": base, "target": target, "similar": similar}
                SimilarDAO.saveSimilar(obj, conn)
            else:
                skipCount += 1

        print("count: " + str(count) + ", skip: " + str(skipCount))
    finally:
        conn.commit()
        conn.close()
Exemple #6
0
def calcAllVR():
    movies = MovieDAO.getMoviesByCondition("vr = 1")
    #print(movies)
    allImages = DiskIndex.getAllImages(SysConst.getImageCachePath())
    for movie in movies:
        calcMovie(movie, allImages)
Exemple #7
0
def getFilePath(actor, avNumber):
    return SysConst.getImageCachePath() + actor + "//" + avNumber + ".jpg"
Exemple #8
0
def checkDirPath(actor):
    path = SysConst.getImageCachePath() + actor
    #Log.info(sys.getdefaultencoding() + " path: " + path)
    exist = os.path.exists(path)
    if not exist:
        os.mkdir(path)