Skip to content

Commit

Permalink
2.5.010
Browse files Browse the repository at this point in the history
  • Loading branch information
chapmanjacobd committed Mar 2, 2024
1 parent 096db10 commit 8eb827b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ To stop playing press Ctrl+C in either the terminal or mpv
<details><summary>List all subcommands</summary>

$ library
xk media library subcommands (v2.5.009)
xk media library subcommands (v2.5.010)

Create database subcommands:
╭───────────────┬────────────────────────────────────────────────────╮
Expand Down
2 changes: 1 addition & 1 deletion xklb/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.5.009"
__version__ = "2.5.010"
12 changes: 6 additions & 6 deletions xklb/fs_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,18 @@ def extract_metadata(mp_args, path) -> Optional[Dict[str, int]]:
# TODO: it would be better if this was saved to and checked against an external global file
media["hash"] = sample_hash.sample_hash_file(path)

if getattr(mp_args, "process", False):
if objects.is_profile(mp_args, DBType.audio) and Path(path).suffix not in [".opus", ".mka"]:
path = media["path"] = process_audio.process_path(
path, split_longer_than=2160 if "audiobook" in path.lower() else None
)

if getattr(mp_args, "move", False) and not file_utils.is_file_open(path):
dest_path = bytes(Path(mp_args.move) / Path(path).relative_to(mp_args.playlist_path))
dest_path = path_utils.clean_path(dest_path)
file_utils.rename_move_file(path, dest_path)
media["path"] = dest_path

if getattr(mp_args, "process", False):
if objects.is_profile(mp_args, DBType.audio) and Path(path).suffix not in [".opus", ".mka"]:
path = media["path"] = process_audio.process_path(
path, split_longer_than=2160 if "audiobook" in path.lower() else None
)

return media


Expand Down
1 change: 1 addition & 0 deletions xklb/scripts/process_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def process_path(
path.unlink() # Remove original
elif is_split:
path.unlink() # Remove original
return path.with_suffix(".000.mka") # TODO: return multiple paths...
else:
if output_path.stat().st_size > path.stat().st_size:
output_path.unlink() # Remove transcode
Expand Down
5 changes: 3 additions & 2 deletions xklb/tube_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def tube_opts(args, func_opts=None, playlist_opts: Optional[str] = None) -> dict
"youtube_include_dash_manifest": False,
"youtube_include_hls_manifest": False,
"no_check_certificate": True,
"check_formats": False,
"ignore_no_formats_error": True,
"skip_playlist_after_errors": 21,
"clean_infojson": False,
Expand Down Expand Up @@ -347,7 +346,9 @@ def out_dir(p):
}

if args.verbose >= consts.LOG_DEBUG:
func_opts["progress_hooks"] = [lambda d: log.debug(f"downloading {d['_percent_str']} {d['_speed_str']} {d['downloaded_bytes']} bytes")]
func_opts["progress_hooks"] = [
lambda d: log.debug(f"downloading {d['_percent_str']} {d['_speed_str']} {d['downloaded_bytes']} bytes")
]

if args.profile != DBType.audio:
func_opts["subtitlesformat"] = "srt/best"
Expand Down

0 comments on commit 8eb827b

Please sign in to comment.