Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
moved options to their own path
- created options.py to hold a custom version of OptionParser - updated front end script to use options
- Loading branch information
Showing
2 changed files
with
76 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from optparse import OptionParser as OptParser, SUPPRESS_HELP | ||
|
||
class OptionParser(OptParser): | ||
|
||
def __init__(self, usage, version): | ||
OptParser.__init__(self, usage=usage, version=version) | ||
|
||
self.add_option('--config', dest='config', \ | ||
help='Select a location for your config file. If the ' | ||
'path is invalid the default locations will be used.') | ||
self.add_option('-c', '--canonical', dest='canonical', | ||
help='Set the show\'s canonical name to use when ' | ||
'performing the online lookup.') | ||
self.add_option('--debug', action='store_true', dest='debug', | ||
help=SUPPRESS_HELP) | ||
self.add_option('--deluge', action='store_true', dest='deluge', | ||
help='Checks Deluge to make sure the file has been ' | ||
'completed before renaming.') | ||
self.add_option('--deluge-ratio', dest='deluge_ratio', | ||
help='Checks Deluge for completed and that the file ' | ||
'has at least reached X share ratio.') | ||
self.add_option('-d', '--dry-run', dest='dry', action='store_true', | ||
help='Dry run your renaming.') | ||
self.add_option('-e', '--episode', dest='episode', | ||
help='Set the episode number. Currently this will ' | ||
'cause errors when working with more than one file.') | ||
self.add_option('--ignore-filelist', dest='ignore_filelist', | ||
help=SUPPRESS_HELP) | ||
self.add_option('--ignore-recursive', action='store_true', | ||
dest='ignore_recursive', | ||
help='Only use files from the root of a given ' | ||
'directory, not entering any sub-directories.') | ||
self.add_option('--log-file', dest='log_file', | ||
help='Set the log file location.') | ||
self.add_option('-l', '--log-level', dest='log_level', | ||
help='Set the log level. Options: short, minimal, ' | ||
'info and debug.') | ||
self.add_option('--library', dest='library', default='thetvdb', | ||
help='Set the library to use for retrieving episode ' | ||
'titles. Options: thetvdb & tvrage.') | ||
self.add_option('-n', '--name', dest='name', | ||
help='Set the show\'s name. This will be used as the ' | ||
'show\'s when the renaming is completed.') | ||
self.add_option('-o', '--output', dest='output_format', | ||
help='Set the output format for the episodes being ' | ||
'renamed.') | ||
self.add_option('--organise', action='store_true', dest='organise', | ||
help='Organise renamed files into folders based on ' | ||
'their show name and season number.') | ||
self.add_option('--no-organise', action='store_false', dest='organise', | ||
help='Explicitly tell Tv Renamr not to organise ' | ||
'renamed files. Used to override the config.') | ||
self.add_option('-q', '--quiet', action='store_true', dest='quiet', | ||
help='Don\'t output logs to the command line') | ||
self.add_option('-r', '--recursive', action='store_true', | ||
dest='recursive', | ||
help='Recursively lookup files in a given directory') | ||
self.add_option('--rename-dir', dest='rename_dir', | ||
help='The directory to move renamed files to, ' | ||
'if not specified the working directory is used.') | ||
self.add_option('--no-rename-dir', action='store_false', | ||
dest='rename_dir', | ||
help='Explicity tell Tv Renamr not to move renamed ' | ||
'files. Used to override the config.') | ||
self.add_option('--regex', dest='regex', | ||
help='The regular expression to use when extracting ' | ||
'information from files.') | ||
self.add_option('-s', '--season', dest='season', | ||
help='Set the season number.') | ||
self.add_option('-t', '--the', action='store_true', dest='the', | ||
help='Set the position of \'The\' in a show\'s name' | ||
' to the end of the file') | ||
|
||
def parse_args(self): | ||
return OptParser.parse_args(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters