Skip to content

Commit

Permalink
3.0.025
Browse files Browse the repository at this point in the history
  • Loading branch information
chapmanjacobd committed Nov 13, 2024
1 parent eaf24fa commit 60c53de
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 86 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.024; 91 subcommands)
library (v3.0.025; 91 subcommands)

Create database subcommands:
╭─────────────────┬──────────────────────────────────────────╮
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Format with this:
ssort $file &&
isort --profile black --line-length=120 $file &&
black --line-length=120 --skip-string-normalization $file

84 changes: 43 additions & 41 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.024"
__version__ = "3.0.025"

progs = {
"Create database subcommands": {
Expand Down
14 changes: 8 additions & 6 deletions xklb/createdb/tildes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def save_page(args, text):
comment_element.find("time", class_="comment-posted-time")["datetime"][:-1],
),
),
"time_modified": nums.to_timestamp(datetime.fromisoformat(edited_time_element["datetime"][:-1]))
if edited_time_element
else None,
"time_modified": (
nums.to_timestamp(datetime.fromisoformat(edited_time_element["datetime"][:-1]))
if edited_time_element
else None
),
"score": int(score_element.text.split()[0]) if score_element else 0,
"text": "".join(str(el) for el in comment_element.find("div", class_="comment-text").contents),
}
Expand Down Expand Up @@ -102,9 +104,9 @@ def save_page(args, text):
),
"time_published": time_published,
"score": int(score_element.text.split()[0]) if score_element else 0,
"num_comments": int(num_comments_element.span.get_text("\n", strip=True).split()[0])
if num_comments_element
else 0,
"num_comments": (
int(num_comments_element.span.get_text("\n", strip=True).split()[0]) if num_comments_element else 0
),
"num_words": num_words,
"title": topic_title_element.get_text("\n", strip=True),
"text": "".join(str(el) for el in text_element.contents) if text_element else None,
Expand Down
12 changes: 6 additions & 6 deletions xklb/createdb/tube_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ def yt_cli_to_api(opts):
if match_filter_user_config is None:
match_filters.append("duration >? 59 & duration <? 14399")
ydl_opts["format_sort"] = ["res:576", "channels:2"]
ydl_opts[
"format"
] = "(bestvideo[filesize<2G]+bestaudio/best[filesize<2G]/bestvideo*+bestaudio/best)[format_id!$=-drc][dynamic_range!^=HDR]/bestvideo[filesize<2G]+bestaudio/best[filesize<2G]/bestvideo*+bestaudio/best"
ydl_opts["format"] = (
"(bestvideo[filesize<2G]+bestaudio/best[filesize<2G]/bestvideo*+bestaudio/best)[format_id!$=-drc][dynamic_range!^=HDR]/bestvideo[filesize<2G]+bestaudio/best[filesize<2G]/bestvideo*+bestaudio/best"
)

if args.profile == DBType.audio:
ydl_opts[
"format"
] = "(bestaudio[ext=opus]/bestaudio[ext=mka]/bestaudio[ext=webm]/bestaudio[ext=ogg]/bestaudio[ext=oga]/bestaudio/best)[format_id!$=-drc]/bestaudio/best"
ydl_opts["format"] = (
"(bestaudio[ext=opus]/bestaudio[ext=mka]/bestaudio[ext=webm]/bestaudio[ext=ogg]/bestaudio[ext=oga]/bestaudio/best)[format_id!$=-drc]/bestaudio/best"
)
ydl_opts["postprocessors"].append({"key": "FFmpegExtractAudio", "preferredcodec": args.extract_audio_ext})

def blocklist_check(info, *pargs, incomplete):
Expand Down
2 changes: 2 additions & 0 deletions xklb/folders/big_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def collect_media(args) -> list[dict]:
if args.database:
media = list(args.db.query(*sqlgroups.fs_sql(args, args.limit)))
else:
if args.hide_deleted:
args.paths = [p for p in args.paths if os.path.exists(p)]
media = arg_utils.gen_d(args)
media = [d if "size" in d else file_utils.get_filesize(d) for d in media]
return media
Expand Down
12 changes: 11 additions & 1 deletion xklb/mediafiles/process_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--max-image-height", type=int, default=2400)
parser.add_argument("--max-image-width", type=int, default=2400)
parser.add_argument(
"--delete-larger", "--delete-original", action=argparse.BooleanOptionalAction, default=True, help="Delete larger of transcode or original files"
"--delete-larger",
"--delete-original",
action=argparse.BooleanOptionalAction,
default=True,
help="Delete larger of transcode or original files",
)
parser.add_argument("--clean-path", action=argparse.BooleanOptionalAction, default=True, help="Clean output path")
parser.add_argument(
"--hide-deleted",
action=argparse.BooleanOptionalAction,
default=True,
help="Exclude non-existent files from processing",
)
arggroups.clobber(parser)
arggroups.debug(parser)

Expand Down
6 changes: 5 additions & 1 deletion xklb/mediafiles/process_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--max-image-height", type=int, default=2400)
parser.add_argument("--max-image-width", type=int, default=2400)
parser.add_argument(
"--delete-larger", "--delete-original", action=argparse.BooleanOptionalAction, default=True, help="Delete larger of transcode or original files"
"--delete-larger",
"--delete-original",
action=argparse.BooleanOptionalAction,
default=True,
help="Delete larger of transcode or original files",
)
parser.add_argument("--clean-path", action=argparse.BooleanOptionalAction, default=True, help="Clean output path")
arggroups.clobber(parser)
Expand Down
Loading

0 comments on commit 60c53de

Please sign in to comment.