Skip to content

Commit 5759d97

Browse files
committed
2.5.005
1 parent 1f363cc commit 5759d97

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

.github/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ To stop playing press Ctrl+C in either the terminal or mpv
9595
<details><summary>List all subcommands</summary>
9696

9797
$ library
98-
xk media library subcommands (v2.5.004)
98+
xk media library subcommands (v2.5.005)
9999

100100
Create database subcommands:
101101
╭───────────────┬────────────────────────────────────────────────────╮

xklb/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.5.004"
1+
__version__ = "2.5.005"

xklb/fs_extract.py

-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ def find_new_files(args, path) -> List[str]:
301301
exts = None
302302
else:
303303
if DBType.audio in args.profiles:
304-
exts |= consts.VIDEO_EXTENSIONS
305304
exts |= consts.AUDIO_ONLY_EXTENSIONS
306305
if DBType.video in args.profiles:
307306
exts |= consts.VIDEO_EXTENSIONS

xklb/scripts/cluster_sort.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ def cluster_paths(paths, n_clusters=None):
148148
return result
149149

150150

151+
def print_groups(groups):
152+
for group in groups:
153+
group["grouped_paths"] = [s.rstrip("\n") for s in group["grouped_paths"]]
154+
155+
print(json.dumps(groups, indent=4))
156+
raise SystemExit(0)
157+
158+
151159
def cluster_dicts(args, media):
152160
if len(media) < 2:
153161
return media
@@ -223,14 +231,6 @@ def cluster_dicts(args, media):
223231
media = [media_keyed[p] for p in sorted_paths]
224232
return media
225233

226-
def print_groups(groups):
227-
for group in groups:
228-
group["grouped_paths"] = [s.rstrip("\n") for s in group["grouped_paths"]]
229-
230-
print(json.dumps(groups, indent=4))
231-
raise SystemExit(0)
232-
233-
234234

235235
def cluster_images(paths, n_clusters=None):
236236
paths = [s.rstrip("\n") for s in paths]

xklb/scripts/process_audio.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def parse_args() -> argparse.Namespace:
1414
parser.add_argument("--always-split", action="store_true")
1515
parser.add_argument("--split-longer-than")
1616
parser.add_argument("--min-split-segment", default=DEFAULT_MIN_SPLIT)
17+
parser.add_argument("--delete-video", action="store_true")
1718
parser.add_argument("--dry-run", action="store_true")
1819
parser.add_argument("--verbose", "-v", action="count", default=0)
1920

@@ -33,6 +34,7 @@ def process_path(
3334
split_longer_than=None,
3435
min_split_segment=nums.human_to_seconds(DEFAULT_MIN_SPLIT),
3536
dry_run=False,
37+
delete_video=False,
3638
):
3739
path = Path(path)
3840
ffprobe_cmd = ["ffprobe", "-v", "error", "-print_format", "json", "-show_format", "-show_streams", path]
@@ -43,6 +45,7 @@ def process_path(
4345
print("No stream found:", path)
4446
return path
4547
audio_stream = next((stream for stream in info["streams"] if stream["codec_type"] == "audio"), None)
48+
video_stream = next((stream for stream in info["streams"] if stream["codec_type"] == "video"), None)
4649
if not audio_stream:
4750
print("No audio stream found:", path)
4851
return path
@@ -121,7 +124,10 @@ def process_path(
121124
print(cmd)
122125
else:
123126
subprocess.check_call(cmd, shell=True)
124-
if is_split:
127+
if video_stream:
128+
if delete_video:
129+
path.unlink() # Remove original
130+
elif is_split:
125131
path.unlink() # Remove original
126132
else:
127133
if output_path.stat().st_size > path.stat().st_size:
@@ -144,6 +150,7 @@ def process_audio():
144150
always_split=args.always_split,
145151
split_longer_than=args.split_longer_than,
146152
min_split_segment=args.min_split_segment,
153+
delete_video=args.delete_video,
147154
dry_run=args.dry_run,
148155
)
149156
except Exception:

0 commit comments

Comments
 (0)