Skip to content

Commit 5105fb5

Browse files
committed
3.0.033
1 parent fe8a0ee commit 5105fb5

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

.github/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ To stop playing press Ctrl+C in either the terminal or mpv
9999
<details><summary>List all subcommands</summary>
100100

101101
$ library
102-
library (v3.0.032; 99 subcommands)
102+
library (v3.0.033; 99 subcommands)
103103

104104
Create database subcommands:
105105
╭─────────────────┬──────────────────────────────────────────╮

xklb/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from xklb.utils import argparse_utils, iterables
66
from xklb.utils.log_utils import log
77

8-
__version__ = "3.0.032"
8+
__version__ = "3.0.033"
99

1010
progs = {
1111
"Create database subcommands": {

xklb/utils/arggroups.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,9 @@ def related(parser):
11851185

11861186
class FileOverFileOptional:
11871187
SKIP_HASH = "skip-hash"
1188+
SKIP_SIZE = "skip-size"
1189+
SKIP_LARGER = "skip-larger"
1190+
SKIP_SMALLER = "skip-smaller"
11881191
DELETE_DEST_HASH = "delete-dest-hash"
11891192
DELETE_DEST_SIZE = "delete-dest-size"
11901193
DELETE_DEST_LARGER = "delete-dest-larger"
@@ -1258,7 +1261,6 @@ def clobber(parent_parser):
12581261
file1.zip (incoming file)
12591262
12601263
Choose ZERO OR MORE of the following options:
1261-
skip-hash will skip the incoming file if the SHA-256 hash matches
12621264
delete-dest-hash will delete the existing file if the SHA-256 hash matches
12631265
delete-dest-size will delete the existing file if the file size matches
12641266
delete-dest-larger will delete the existing file if it is larger
@@ -1269,6 +1271,11 @@ def clobber(parent_parser):
12691271
delete-src-size will delete the incoming file if the file size matches
12701272
delete-src-larger will delete the incoming file if it is larger
12711273
delete-src-smaller will delete the incoming file if it is smaller
1274+
Useful for `lb cp`:
1275+
skip-hash will skip the incoming file if the SHA-256 hash matches
1276+
skip-size will skip the incoming file if the size matches
1277+
skip-larger will skip the incoming file if it is larger
1278+
skip-smaller will skip the incoming file if it is smaller
12721279
12731280
Choose ONE of the following required fallback options:
12741281
skip will skip the incoming file

xklb/utils/devices.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ def clobber(args, source, destination) -> tuple[str | None, str]:
193193
if sample_compare.sample_cmp(source, destination, ignore_holes=True):
194194
source = None
195195
break
196+
case arggroups.FileOverFileOptional.SKIP_SIZE:
197+
if src_size == dst_size:
198+
source = None
199+
break
200+
case arggroups.FileOverFileOptional.SKIP_LARGER:
201+
if src_size > dst_size:
202+
source = None
203+
break
204+
case arggroups.FileOverFileOptional.SKIP_SMALLER:
205+
if src_size < dst_size:
206+
source = None
207+
break
196208
case arggroups.FileOverFile.SKIP:
197209
source = None
198210
case arggroups.FileOverFile.DELETE_DEST:
@@ -327,6 +339,12 @@ def clobber_new_file(args, destination) -> str:
327339
pass
328340
case arggroups.FileOverFileOptional.SKIP_HASH:
329341
pass
342+
case arggroups.FileOverFileOptional.SKIP_SIZE:
343+
pass
344+
case arggroups.FileOverFileOptional.SKIP_LARGER:
345+
pass
346+
case arggroups.FileOverFileOptional.SKIP_SMALLER:
347+
pass
330348

331349
case arggroups.FileOverFile.DELETE_DEST:
332350
unlink(args, destination)

0 commit comments

Comments
 (0)