Beispiel #1
0
def reSub():

    media = []

    import popen2
    import enzyme

    for mediaPath in ReSubSearchPaths:
        for root, dirs, files in os.walk(mediaPath):
            for files in ["*.m4v"]:
                fp = root + "/" + files
                media.extend(glob.glob(fp))

    for path in media:

        r = popen2.popen3(HandleBarBinPath + '/bin/SublerCLI -source "' + path + '" -listtracks')
        tracks = r[0].readlines()
        r[0].close()

        subsInTrack = filter(hasSubtitle, tracks)
        if len(subsInTrack) > 0:
            continue

        r = popen2.popen3(HandleBarBinPath + '/bin/SublerCLI -source "' + path + '" -listmetadata')
        comments = r[0].readlines()
        matches = filter(hasComments, comments)

        if len(matches) > 0:

            start = len("Comments: Original filename ")
            file = matches[0][start:].strip()

            md = metadata(file, 0)
            sub = subs(file, md.guess["type"])
            sub.downloadSubtitles()

            md.addSubtitles(path)
Beispiel #2
0
def parseFailedFiles():

    media = []

    for root, dirs, files in os.walk(HandleBarConfigPath + DebugFailedPath):
        for files in ["*.m4v"]:
            fp = root + "/" + files
            media.extend(glob.glob(fp))

    for path in media:

        md = metadata(path, 0)

        """ SUBS """
        sub = subs(path, md.guess["type"])
        sub.downloadSubtitles()

        result = md.parseFile()

        if result != True:
            print "FAILED --"
            return False

        moveToItunes(md.filePath)