Exemplo n.º 1
0
def scan_folder(folder):
    # print '**** processing:', folder
    logging.info('**** processing folder:{}'.format(folder))

    movie_files = [f for f in sorted(os.listdir(folder)) if f.endswith('.mp4') or f.endswith('.mkv') or f.endswith('.avi')]

    for movie_file in movie_files:
        movie_file_full_path = os.path.join(folder, movie_file)

        # if subtitle already exist, ignore it
        srt_full_path = os.path.join(folder, movie_file + '.chn.srt')
        ass_full_path = os.path.join(folder, movie_file + '.chn.ass')
        sub_full_path = os.path.join(folder, movie_file + '.chn.sub')
        if os.path.exists(srt_full_path) or os.path.exists(ass_full_path) or os.path.exists(sub_full_path):
            # print '---- subtitle already get: {}'.format(movie_file)
            logging.info('---- EXIST subtitle for: {}'.format(movie_file))
            continue

        # print '++++ subtitle for movie file: {}'.format(movie_file)

        shooter = Shooter(movie_file_full_path)
        count = shooter.start()
        logging.info('----  GET {} subtitle for {}'.format(count, movie_file))
        # detail.append((movie_file_full_path, count))

    if settings[SETTING_RECURSIVE]:
        sub_folders = [f for f in sorted(os.listdir(folder)) if os.path.isdir(os.path.join(folder, f))]
        for sub_folder in sub_folders:
            ignore_hidden = settings[SETTING_IGNORE_HIDDEN]
            if ignore_hidden:
                if sub_folder.startswith("."):
                    continue
            sub_folder_full_path = os.path.join(folder, sub_folder)
            scan_folder(sub_folder_full_path)
Exemplo n.º 2
0
def scan_folder(folder, detail=None):
    print "**** processing:", folder

    if detail is None:
        detail = []

    movie_files = [f for f in os.listdir(folder) if f.endswith(".mp4") or f.endswith(".mkv") or f.endswith(".avi")]

    for movie_file in movie_files:
        movie_file_full_path = os.path.join(folder, movie_file)

        # if subtitle already exist, ignore it
        srt_full_path = os.path.join(folder, movie_file + ".chn.srt")
        ass_full_path = os.path.join(folder, movie_file + ".chn.ass")
        if os.path.exists(srt_full_path) or os.path.exists(ass_full_path):
            print "---- subtitle already get: {}".format(movie_file)
            continue

        print "++++ subtitle for movie file: {}".format(movie_file)

        shooter = Shooter(movie_file_full_path)
        count = shooter.start()
        detail.append((movie_file_full_path, count))

    sub_folders = [f for f in os.listdir(folder) if os.path.isdir(os.path.join(folder, f))]
    for sub_folder in sub_folders:
        sub_folder_full_path = os.path.join(folder, sub_folder)
        scan_folder(sub_folder_full_path, detail)

    return detail
Exemplo n.º 3
0
def scan_folder(folder):
    # print '**** processing:', folder
    logging.info('**** processing folder:{}'.format(folder))

    movie_files = [
        f for f in sorted(os.listdir(folder))
        if f.endswith('.mp4') or f.endswith('.mkv') or f.endswith('.avi')
    ]

    for movie_file in movie_files:
        movie_file_full_path = os.path.join(folder, movie_file)

        # if subtitle already exist, ignore it
        srt_full_path = os.path.join(folder, movie_file + '.chn.srt')
        ass_full_path = os.path.join(folder, movie_file + '.chn.ass')
        sub_full_path = os.path.join(folder, movie_file + '.chn.sub')
        if os.path.exists(srt_full_path) or os.path.exists(
                ass_full_path) or os.path.exists(sub_full_path):
            # print '---- subtitle already get: {}'.format(movie_file)
            logging.info('---- EXIST subtitle for: {}'.format(movie_file))
            continue

        # print '++++ subtitle for movie file: {}'.format(movie_file)

        shooter = Shooter(movie_file_full_path)
        count = shooter.start()
        logging.info('----  GET {} subtitle for {}'.format(count, movie_file))
        # detail.append((movie_file_full_path, count))

    if settings[SETTING_RECURSIVE]:
        sub_folders = [
            f for f in sorted(os.listdir(folder))
            if os.path.isdir(os.path.join(folder, f))
        ]
        for sub_folder in sub_folders:
            ignore_hidden = settings[SETTING_IGNORE_HIDDEN]
            if ignore_hidden:
                if sub_folder.startswith("."):
                    continue
            sub_folder_full_path = os.path.join(folder, sub_folder)
            scan_folder(sub_folder_full_path)
Exemplo n.º 4
0
#!/usr/bin/env python
'''
Created on Jan 20, 2014

@author: magic282
'''
import sys
from Shooter import Shooter

if __name__ == '__main__':
    print("Welcome to ShooterSubPyDownloader")

    fileNames = sys.argv[1:]

    for f in fileNames:
        shooter = Shooter(f)
        shooter.start()
Exemplo n.º 5
0
#!/usr/bin/env python
'''
Created on Jan 20, 2014

@author: magic282
'''
import sys
from Shooter import Shooter

if __name__ == '__main__':
    print("Welcome to ShooterSubPyDownloader")

    fileNames = sys.argv[1:]

    for f in fileNames:
        shooter = Shooter(f)
        shooter.start()
Exemplo n.º 6
0
def shootSub(file, nosub_list):
    shooter = Shooter(file)
    ok = shooter.start()
    if ok: subtitleClean(file, exclude_ext)
    else: nosub_list.append(os.path.basename(file))