Skip to content

Commit

Permalink
3.0.033
Browse files Browse the repository at this point in the history
  • Loading branch information
chapmanjacobd committed Dec 10, 2024
1 parent fe8a0ee commit 5105fb5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ To stop playing press Ctrl+C in either the terminal or mpv
<details><summary>List all subcommands</summary>

$ library
library (v3.0.032; 99 subcommands)
library (v3.0.033; 99 subcommands)

Create database subcommands:
╭─────────────────┬──────────────────────────────────────────╮
Expand Down
2 changes: 1 addition & 1 deletion xklb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from xklb.utils import argparse_utils, iterables
from xklb.utils.log_utils import log

__version__ = "3.0.032"
__version__ = "3.0.033"

progs = {
"Create database subcommands": {
Expand Down
9 changes: 8 additions & 1 deletion xklb/utils/arggroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ def related(parser):

class FileOverFileOptional:
SKIP_HASH = "skip-hash"
SKIP_SIZE = "skip-size"
SKIP_LARGER = "skip-larger"
SKIP_SMALLER = "skip-smaller"
DELETE_DEST_HASH = "delete-dest-hash"
DELETE_DEST_SIZE = "delete-dest-size"
DELETE_DEST_LARGER = "delete-dest-larger"
Expand Down Expand Up @@ -1258,7 +1261,6 @@ def clobber(parent_parser):
file1.zip (incoming file)
Choose ZERO OR MORE of the following options:
skip-hash will skip the incoming file if the SHA-256 hash matches
delete-dest-hash will delete the existing file if the SHA-256 hash matches
delete-dest-size will delete the existing file if the file size matches
delete-dest-larger will delete the existing file if it is larger
Expand All @@ -1269,6 +1271,11 @@ def clobber(parent_parser):
delete-src-size will delete the incoming file if the file size matches
delete-src-larger will delete the incoming file if it is larger
delete-src-smaller will delete the incoming file if it is smaller
Useful for `lb cp`:
skip-hash will skip the incoming file if the SHA-256 hash matches
skip-size will skip the incoming file if the size matches
skip-larger will skip the incoming file if it is larger
skip-smaller will skip the incoming file if it is smaller
Choose ONE of the following required fallback options:
skip will skip the incoming file
Expand Down
18 changes: 18 additions & 0 deletions xklb/utils/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ def clobber(args, source, destination) -> tuple[str | None, str]:
if sample_compare.sample_cmp(source, destination, ignore_holes=True):
source = None
break
case arggroups.FileOverFileOptional.SKIP_SIZE:
if src_size == dst_size:
source = None
break
case arggroups.FileOverFileOptional.SKIP_LARGER:
if src_size > dst_size:
source = None
break
case arggroups.FileOverFileOptional.SKIP_SMALLER:
if src_size < dst_size:
source = None
break
case arggroups.FileOverFile.SKIP:
source = None
case arggroups.FileOverFile.DELETE_DEST:
Expand Down Expand Up @@ -327,6 +339,12 @@ def clobber_new_file(args, destination) -> str:
pass
case arggroups.FileOverFileOptional.SKIP_HASH:
pass
case arggroups.FileOverFileOptional.SKIP_SIZE:
pass
case arggroups.FileOverFileOptional.SKIP_LARGER:
pass
case arggroups.FileOverFileOptional.SKIP_SMALLER:
pass

case arggroups.FileOverFile.DELETE_DEST:
unlink(args, destination)
Expand Down

0 comments on commit 5105fb5

Please sign in to comment.