Skip to content

Commit

Permalink
Format arguments descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ivandokov committed Nov 13, 2023
1 parent 281507f commit c77f298
Showing 1 changed file with 86 additions and 84 deletions.
170 changes: 86 additions & 84 deletions phockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,54 +77,54 @@ def parse_args(args=sys.argv[1:]):
'--move',
action='store_true',
help="""\
Instead of copying the process will move all files from the INPUTDIR to the OUTPUTDIR.
This is useful when working with a big collection of files and the remaining free space
is not enough to make a copy of the INPUTDIR.
""",
Instead of copying the process will move all files from the INPUTDIR to the OUTPUTDIR.
This is useful when working with a big collection of files and the remaining free space
is not enough to make a copy of the INPUTDIR.
""",
)

exclusive_group_link_move.add_argument(
'-l',
'--link',
action='store_true',
help="""\
Instead of copying the process will make hard links to all files in INPUTDIR and place
them in the OUTPUTDIR.
This is useful when working with working structure and want to create YYYY/MM/DD
structure to point to same files.
""",
Instead of copying the process will make hard links to all files in INPUTDIR and place
them in the OUTPUTDIR.
This is useful when working with working structure and want to create YYYY/MM/DD
structure to point to same files.
""",
)

parser.add_argument(
'-o',
'--original-names',
action='store_true',
help="""\
Organize the files in selected format or using the default year/month/day format but
keep original filenames.
""",
Organize the files in selected format or using the default year/month/day format but
keep original filenames.
""",
)

parser.add_argument(
'-t',
'--timestamp',
action='store_true',
help="""\
Use the timestamp of the file (last modified date) if there is no EXIF date information.
If the user supplies a regex, it will be used if it finds a match in the filename.
This option is intended as "last resort" since the file modified date may not be
accurate, nevertheless it can be useful if no other date information can be obtained.
""",
Use the timestamp of the file (last modified date) if there is no EXIF date information.
If the user supplies a regex, it will be used if it finds a match in the filename.
This option is intended as "last resort" since the file modified date may not be
accurate, nevertheless it can be useful if no other date information can be obtained.
""",
)

parser.add_argument(
'-y',
'--dry-run',
action='store_true',
help="""\
Does a trial run with no permanent changes to the filesystem.
So it will not move any files, just shows which changes would be done.
""",
Does a trial run with no permanent changes to the filesystem.
So it will not move any files, just shows which changes would be done.
""",
)

parser.add_argument(
Expand All @@ -134,9 +134,10 @@ def parse_args(args=sys.argv[1:]):
default=1,
choices=range(1, 255),
metavar='1-255',
help="Sets the level of concurrency for processing files in a "
"directory. Defaults to 1. Higher values can improve "
"throughput of file operations"
help="""\
Sets the level of concurrency for processing files in a directory.
Defaults to 1. Higher values can improve throughput of file operations
""",
)

parser.add_argument(
Expand All @@ -146,8 +147,8 @@ def parse_args(args=sys.argv[1:]):
choices=range(0, 255),
metavar='1-255',
help="""\
Descend at most 'maxdepth' levels (a non-negative integer) of directories
""",
Descend at most 'maxdepth' levels (a non-negative integer) of directories
""",
)

parser.add_argument(
Expand All @@ -156,35 +157,35 @@ def parse_args(args=sys.argv[1:]):
action='store',
type=re.compile,
help="""\
Specify date format for date extraction from filenames if there is no EXIF date
information.
Example:
{regex}
can be used to extract the date from file names like the following
IMG_27.01.2015-19.20.00.jpg.
""",
Specify date format for date extraction from filenames if there is no EXIF date
information.
Example:
{regex}
can be used to extract the date from file names like the following
IMG_27.01.2015-19.20.00.jpg.
""",
)

parser.add_argument(
'-f',
'--date-field',
action='store',
help="""\
Use a custom date extracted from the exif field specified.
To set multiple fields to try in order until finding a valid date, use spaces to
separate fields inside a string.
Use a custom date extracted from the exif field specified.
To set multiple fields to try in order until finding a valid date, use spaces to
separate fields inside a string.
Example:
DateTimeOriginal
"DateTimeOriginal CreateDate FileModifyDate"
Example:
DateTimeOriginal
"DateTimeOriginal CreateDate FileModifyDate"
These fields are checked by default when this argument is not set:
"SubSecCreateDate SubSecDateTimeOriginal CreateDate DateTimeOriginal"
These fields are checked by default when this argument is not set:
"SubSecCreateDate SubSecDateTimeOriginal CreateDate DateTimeOriginal"
To get all date fields available for a file, do:
exiftool -time:all -mimetype -j <file>
""",
To get all date fields available for a file, do:
exiftool -time:all -mimetype -j <file>
""",
)

exclusive_group_debug_silent = parser.add_mutually_exclusive_group()
Expand All @@ -194,51 +195,51 @@ def parse_args(args=sys.argv[1:]):
action='store_true',
default=False,
help="""\
Enable debugging. Alternately, set the LOGLEVEL environment variable to DEBUG
""",
Enable debugging. Alternately, set the LOGLEVEL environment variable to DEBUG
""",
)

exclusive_group_debug_silent.add_argument(
'--quiet',
action='store_true',
default=False,
help="""\
Run without output.
""",
Run without output.
""",
)

exclusive_group_debug_silent.add_argument(
'--progress',
action='store_true',
default=False,
help="""\
Run with progressbar output.
""",
Run with progressbar output.
""",
)

parser.add_argument(
'--log',
action='store',
help="""\
Specify the output directory where your log file should be exported.
This flag can be used in conjunction with the flag `--quiet` or `--progress`.
""",
Specify the output directory where your log file should be exported.
This flag can be used in conjunction with the flag `--quiet` or `--progress`.
""",
)

parser.add_argument(
'input_dir',
metavar='INPUTDIR',
help="""\
Specify the source directory where your photos are located.
""",
Specify the source directory where your photos are located.
""",
)

parser.add_argument(
'output_dir',
metavar='OUTPUTDIR',
help="""\
Specify the output directory where your photos should be exported.
""",
Specify the output directory where your photos should be exported.
""",
)

parser.add_argument(
Expand All @@ -247,74 +248,75 @@ def parse_args(args=sys.argv[1:]):
choices=['image', 'video'],
metavar='image|video',
help="""\
By default, Phockup addresses both image and video files.
If you want to restrict your command to either images or
videos only, use `--file-type=[image|video]`.
""",
By default, Phockup addresses both image and video files.
If you want to restrict your command to either images or
videos only, use `--file-type=[image|video]`.
""",
)

parser.add_argument(
'--no-date-dir',
type=str,
default=Phockup.DEFAULT_NO_DATE_DIRECTORY,
help="""\
Files without EXIF date information are placed in a directory
named 'unknown' by default. This option overrides that
folder name. e.g. --no-date-dir=misc, --no-date-dir="no date"
""",
Files without EXIF date information are placed in a directory
named 'unknown' by default. This option overrides that
folder name. e.g. --no-date-dir=misc, --no-date-dir="no date"
""",
)

parser.add_argument(
'--skip-unknown',
action='store_true',
default=False,
help="""\
Ignore files that don't contain valid EXIF data for the criteria specified.
This is useful if you intend to make multiple passes over an input directory
with varying and specific EXIF fields that are note checked by default.
""", )
Ignore files that don't contain valid EXIF data for the criteria specified.
This is useful if you intend to make multiple passes over an input directory
with varying and specific EXIF fields that are note checked by default.
""",
)

parser.add_argument(
'--output_prefix',
type=str,
default='',
help="""\
String to prepend to the output directory to aid in sorting
files by an additional level prior to sorting by date. This
string will immediately follow the output path and is intended
to allow runtime setting of the output path (e.g. via $USER,
$HOSTNAME, %%USERNAME%%, etc.)
"""
String to prepend to the output directory to aid in sorting
files by an additional level prior to sorting by date. This
string will immediately follow the output path and is intended
to allow runtime setting of the output path (e.g. via $USER,
$HOSTNAME, %%USERNAME%%, etc.)
""",
)

parser.add_argument(
'--output_suffix',
type=str,
default='',
help="""\
String to append to the destination directory to aid in sorting
files by an additional level after sorting by date.
"""
String to append to the destination directory to aid in sorting
files by an additional level after sorting by date.
""",
)

parser.add_argument(
'--from-date',
type=str,
default=None,
help="""\
Limit the operations to the files that are newer than --from-date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.
"""
Limit the operations to the files that are newer than --from-date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.
""",
)

parser.add_argument(
'--to-date',
type=str,
default=None,
help="""\
Limit the operations to the files that are older than --to-date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.
"""
Limit the operations to the files that are older than --to-date (inclusive).
The date must be specified in format YYYY-MM-DD. Files with unknown date won't be skipped.
""",
)

return parser.parse_args(args)
Expand Down

0 comments on commit c77f298

Please sign in to comment.