コード例 #1
0
ファイル: main.py プロジェクト: minrk/tvnamer
            return
        else:
            warn(errormsg)
    except (SeasonNotFound, EpisodeNotFound, EpisodeNameNotFound), errormsg:
        # Show was found, so use corrected series name
        if Config['giveup_on_error']:
            warn("Skipping %s because: %s"%(episode.fullfilename,errormsg))
            return
        else:
            warn(errormsg)
            episode.seriesname = correctedSeriesName
    else:
        episode.seriesname = correctedSeriesName
        episode.episodename = epName

    cnamer = Renamer(episode.fullpath)
    newName = episode.generateFilename()

    print "#" * 20
    print "Old filename: %s" % episode.fullfilename
    print "New filename: %s" % newName

    if Config['alwaysrename']:
        try:
            cnamer.newName(newName)
        except OSError, e:
            warn(e)
        return

    ans = None
    while ans not in ['y', 'n', 'a', 'q', '']:
コード例 #2
0
ファイル: main.py プロジェクト: catesandrew/tvnamer
                                 series_id=Config['series_id'])
    except (DataRetrievalError, ShowNotFound), errormsg:
        if Config['always_rename'] and Config['skip_file_on_error'] is True:
            warn("Skipping file due to error: %s" % errormsg)
            return
        else:
            warn(errormsg)
    except (SeasonNotFound, EpisodeNotFound, EpisodeNameNotFound), errormsg:
        # Show was found, so use corrected series name
        if Config['always_rename'] and Config['skip_file_on_error']:
            warn("Skipping file due to error: %s" % errormsg)
            return

        warn(errormsg)

    cnamer = Renamer(episode.fullpath)

    shouldRename = False

    if Config["move_files_only"]:

        newName = episode.fullfilename
        shouldRename = True

    else:
        newName = episode.generateFilename()
        if newName == episode.fullfilename:
            p("#" * 20)
            p("Existing filename is correct: %s" % episode.fullfilename)
            p("#" * 20)
コード例 #3
0
            return
        else:
            warn(errormsg)
    except (IssueNotFound, IssueNameNotFound), errormsg:
        # Series was found, so use corrected series name
        if Config['always_rename'] and Config['skip_file_on_error'] is True:
            warn("Skipping file due to error: %s" % errormsg)
            return

        warn(errormsg)
        issue.seriesname = correctedSeriesName
    else:
        issue.seriesname = correctedSeriesName
        issue.issuename = issName

    cnamer = Renamer(issue.fullpath)
    newName = issue.generateFilename()

    p("#" * 20)
    p("Old filename: %s" % issue.fullfilename)

    if len(Config['output_filename_replacements']):
        p("Before custom output replacements: %s" % (newName))
        # Only apply to filename, not extension
        newName, newExt = os.path.splitext(newName)
        newName = applyCustomOutputReplacements(newName)
        newName = newName + newExt

    p("New filename: %s" % newName)

    if Config['always_rename']: