Skip to content

Commit

Permalink
Add files fixed by pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
raydouglass committed Sep 12, 2023
1 parent 2595580 commit 55253c4
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ __[rename](#rename)__
__[search](#search)__

__[tv-rename](#tv-rename)__


Help output
```
Expand Down Expand Up @@ -158,7 +158,7 @@ Battlestar Galatica (2003) - s00e01 - Battlestar Galactica The Miniseries (1).mk

## rename

`manage-media rename <template> <input file>` or `manage-media rename --recursive <template> <input directory>`
`manage-media rename <template> <input file>` or `manage-media rename --recursive <template> <input directory>`

A flexible tool to rename files

Expand Down Expand Up @@ -272,7 +272,7 @@ For example, if you ripped some Battlestar Galactica blurays, you might have a f
- BSG_Season1_Disc2_t01.mkv
- BSG_Season1_Disc2_t02.mkv
- BSG_Season1_Disc2_t03.mkv

`manage-media tv-rename -s 1 -e 1 --tvdb --show "Battlestar Galactica" --output "BSG/Season 1" BSG_Season1_Disc*`

Result
Expand All @@ -286,8 +286,8 @@ Result
- Battlestar Galatica (2003) - S01E06 - Litmus.mkv
- Battlestar Galatica (2003) - S01E07 - Six Degrees of Separation.mkv
- Battlestar Galatica (2003) - S01E08 - Flesh and Bone.mkv


## Configuration

You can configuration where to find various executables by creating a file `~/.config/mms/config.ini`. By default, commands will use the executables found in your path.
Expand Down
2 changes: 1 addition & 1 deletion media_management_scripts/commands/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def name(self):
def build_argparse(self, subparser):
desc = """
Converts a video file to 'standard' parameters. By default, this is H264 with AAC audio.
Convert to HEVC/H.265:
convert --video-codec hevc <input> <output>
Convert to HEVC with AC3 audio:
Expand Down
20 changes: 10 additions & 10 deletions media_management_scripts/commands/rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@ def build_argparse(self, subparser):
formatter_class=argparse.RawTextHelpFormatter,
description="""
Rename files based on a template.
Templates can include variables or expressions by surrounding with ${...}. Functions can be called like ${upper(i)} or ${i | upper}.
The following variables are available:
* i/index - The index of the current file being renamed
* wo_ext - The file name basename without the extension
* ext - The file extension of the current file (without '.')
* filename - The filename of the current file (basename)
* re/regex - A list of regex match groups (use re[0], re[1], etc)
The following functions are available:
* upper - Upper cases the input
* lower - Lower cases the input
* ifempty(a, b, c) - If a is empty or null, then b, otherwise c
* lpad(a, b:int) - Left pads a to length b (defaults to 2+) with spaces
* zpad(a, b:int) - Left pads a to length b (defaults to 2+) with zeros
lpad/zpad - By default pads to at least 2 characters. If there are 100+ files, then 3 characters, 1000+ files, then 4 characters, etc.
Regular Expressions:
If a regex is included, the match groups (0=whole match, >0=match group) are available in a list 're' or 'regex'.
Each match group is converted to an int if possible, so a zero padded int will lose the zeros.
Examples:
Input: S02E04.mp4
Regex: S(\d+)E(\d+)
Template: 'Season ${re[1]} Episode ${re[2]}.{ext}'
Result: 'Season 2 Episode 4.mp4'
Template: Template: 'Season ${re[1] | zpad} Episode ${zpad(re[2], 3)}.{ext}'
Results: 'Season 02 Episode 004.mp4'
Input: whatever.mp4
Regex: S(\d+)E(\d)
Template: 'Season ${ifempty(re[1], 'unknown', re[1])} Episode ${re[2]}.{ext}'
Expand Down
8 changes: 4 additions & 4 deletions media_management_scripts/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def build_argparse(self, subparser):
formatter_class=argparse.RawTextHelpFormatter,
description="""
Searches a directory for video files matching parameters.
If a video has multiple streams, comparisons mean at least one stream matches.
Available parameters:
Video:
v.codec - The video codec (h264, h265, mpeg2, etc)
Expand All @@ -37,11 +37,11 @@ def build_argparse(self, subparser):
resolution - The resolution name (LOW_DEF, HIGH_DEF, etc)
Metadata:
meta.xyz - Follows the basic JSON metadata output
Functions:
isNull(xyz) - Returns true if the value is null
all(xyz) - Instead of one stream matching, check all of them
Examples:
Find all videos that are H264
v.codec = h264
Expand Down
2 changes: 1 addition & 1 deletion sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ deinterlace_threshold = .5
[logging]
level = DEBUG
file = convert.log
db = processed.shelve
db = processed.shelve
2 changes: 1 addition & 1 deletion tests/comskip.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ dvrcut_options="dvrcut \"%s.dvr-ms\" \"%s_clean.dvr-ms\" "
windowtitle="Comskip - %s"
output_dvrmstb=1
dvrmsstandoff=120000
output_plist_cutlist=0
output_plist_cutlist=0
2 changes: 1 addition & 1 deletion tests/test_logging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ handlers:

root:
level: INFO
handlers: [console]
handlers: [console]

0 comments on commit 55253c4

Please sign in to comment.