diff --git a/.github/README.md b/.github/README.md index b0724e35..6b9e807b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -99,7 +99,7 @@ To stop playing press Ctrl+C in either the terminal or mpv
List all subcommands $ library - library (v3.0.024; 91 subcommands) + library (v3.0.025; 91 subcommands) Create database subcommands: ╭─────────────────┬──────────────────────────────────────────╮ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eac8e165..ad45eacc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,3 +10,4 @@ Format with this: ssort $file && isort --profile black --line-length=120 $file && black --line-length=120 --skip-string-normalization $file + diff --git a/pdm.lock b/pdm.lock index 9f8c504d..26244c9d 100644 --- a/pdm.lock +++ b/pdm.lock @@ -454,52 +454,54 @@ files = [ [[package]] name = "contourpy" -version = "1.3.0" -requires_python = ">=3.9" +version = "1.3.1" +requires_python = ">=3.10" summary = "Python library for calculating contours of 2D quadrilateral grids" dependencies = [ "numpy>=1.23", ] files = [ - {file = "contourpy-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0fa4c02abe6c446ba70d96ece336e621efa4aecae43eaa9b030ae5fb92b309ad"}, - {file = "contourpy-1.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:834e0cfe17ba12f79963861e0f908556b2cedd52e1f75e6578801febcc6a9f49"}, - {file = "contourpy-1.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dbc4c3217eee163fa3984fd1567632b48d6dfd29216da3ded3d7b844a8014a66"}, - {file = "contourpy-1.3.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4865cd1d419e0c7a7bf6de1777b185eebdc51470800a9f42b9e9decf17762081"}, - {file = "contourpy-1.3.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:303c252947ab4b14c08afeb52375b26781ccd6a5ccd81abcdfc1fafd14cf93c1"}, - {file = "contourpy-1.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:637f674226be46f6ba372fd29d9523dd977a291f66ab2a74fbeb5530bb3f445d"}, - {file = "contourpy-1.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:76a896b2f195b57db25d6b44e7e03f221d32fe318d03ede41f8b4d9ba1bff53c"}, - {file = "contourpy-1.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e1fd23e9d01591bab45546c089ae89d926917a66dceb3abcf01f6105d927e2cb"}, - {file = "contourpy-1.3.0-cp311-cp311-win32.whl", hash = "sha256:d402880b84df3bec6eab53cd0cf802cae6a2ef9537e70cf75e91618a3801c20c"}, - {file = "contourpy-1.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:6cb6cc968059db9c62cb35fbf70248f40994dfcd7aa10444bbf8b3faeb7c2d67"}, - {file = "contourpy-1.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:570ef7cf892f0afbe5b2ee410c507ce12e15a5fa91017a0009f79f7d93a1268f"}, - {file = "contourpy-1.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:da84c537cb8b97d153e9fb208c221c45605f73147bd4cadd23bdae915042aad6"}, - {file = "contourpy-1.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0be4d8425bfa755e0fd76ee1e019636ccc7c29f77a7c86b4328a9eb6a26d0639"}, - {file = "contourpy-1.3.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9c0da700bf58f6e0b65312d0a5e695179a71d0163957fa381bb3c1f72972537c"}, - {file = "contourpy-1.3.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eb8b141bb00fa977d9122636b16aa67d37fd40a3d8b52dd837e536d64b9a4d06"}, - {file = "contourpy-1.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3634b5385c6716c258d0419c46d05c8aa7dc8cb70326c9a4fb66b69ad2b52e09"}, - {file = "contourpy-1.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0dce35502151b6bd35027ac39ba6e5a44be13a68f55735c3612c568cac3805fd"}, - {file = "contourpy-1.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:aea348f053c645100612b333adc5983d87be69acdc6d77d3169c090d3b01dc35"}, - {file = "contourpy-1.3.0-cp312-cp312-win32.whl", hash = "sha256:90f73a5116ad1ba7174341ef3ea5c3150ddf20b024b98fb0c3b29034752c8aeb"}, - {file = "contourpy-1.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:b11b39aea6be6764f84360fce6c82211a9db32a7c7de8fa6dd5397cf1d079c3b"}, - {file = "contourpy-1.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:3e1c7fa44aaae40a2247e2e8e0627f4bea3dd257014764aa644f319a5f8600e3"}, - {file = "contourpy-1.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:364174c2a76057feef647c802652f00953b575723062560498dc7930fc9b1cb7"}, - {file = "contourpy-1.3.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:32b238b3b3b649e09ce9aaf51f0c261d38644bdfa35cbaf7b263457850957a84"}, - {file = "contourpy-1.3.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d51fca85f9f7ad0b65b4b9fe800406d0d77017d7270d31ec3fb1cc07358fdea0"}, - {file = "contourpy-1.3.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:732896af21716b29ab3e988d4ce14bc5133733b85956316fb0c56355f398099b"}, - {file = "contourpy-1.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d73f659398a0904e125280836ae6f88ba9b178b2fed6884f3b1f95b989d2c8da"}, - {file = "contourpy-1.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:c6c7c2408b7048082932cf4e641fa3b8ca848259212f51c8c59c45aa7ac18f14"}, - {file = "contourpy-1.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f317576606de89da6b7e0861cf6061f6146ead3528acabff9236458a6ba467f8"}, - {file = "contourpy-1.3.0-cp313-cp313-win32.whl", hash = "sha256:31cd3a85dbdf1fc002280c65caa7e2b5f65e4a973fcdf70dd2fdcb9868069294"}, - {file = "contourpy-1.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:4553c421929ec95fb07b3aaca0fae668b2eb5a5203d1217ca7c34c063c53d087"}, - {file = "contourpy-1.3.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:345af746d7766821d05d72cb8f3845dfd08dd137101a2cb9b24de277d716def8"}, - {file = "contourpy-1.3.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:3bb3808858a9dc68f6f03d319acd5f1b8a337e6cdda197f02f4b8ff67ad2057b"}, - {file = "contourpy-1.3.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:420d39daa61aab1221567b42eecb01112908b2cab7f1b4106a52caaec8d36973"}, - {file = "contourpy-1.3.0-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4d63ee447261e963af02642ffcb864e5a2ee4cbfd78080657a9880b8b1868e18"}, - {file = "contourpy-1.3.0-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:167d6c890815e1dac9536dca00828b445d5d0df4d6a8c6adb4a7ec3166812fa8"}, - {file = "contourpy-1.3.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:710a26b3dc80c0e4febf04555de66f5fd17e9cf7170a7b08000601a10570bda6"}, - {file = "contourpy-1.3.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:75ee7cb1a14c617f34a51d11fa7524173e56551646828353c4af859c56b766e2"}, - {file = "contourpy-1.3.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:33c92cdae89ec5135d036e7218e69b0bb2851206077251f04a6c4e0e21f03927"}, - {file = "contourpy-1.3.0.tar.gz", hash = "sha256:7ffa0db17717a8ffb127efd0c95a4362d996b892c2904db72428d5b52e1938a4"}, + {file = "contourpy-1.3.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3e8b974d8db2c5610fb4e76307e265de0edb655ae8169e8b21f41807ccbeec4b"}, + {file = "contourpy-1.3.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:20914c8c973f41456337652a6eeca26d2148aa96dd7ac323b74516988bea89fc"}, + {file = "contourpy-1.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19d40d37c1c3a4961b4619dd9d77b12124a453cc3d02bb31a07d58ef684d3d86"}, + {file = "contourpy-1.3.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:113231fe3825ebf6f15eaa8bc1f5b0ddc19d42b733345eae0934cb291beb88b6"}, + {file = "contourpy-1.3.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4dbbc03a40f916a8420e420d63e96a1258d3d1b58cbdfd8d1f07b49fcbd38e85"}, + {file = "contourpy-1.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a04ecd68acbd77fa2d39723ceca4c3197cb2969633836ced1bea14e219d077c"}, + {file = "contourpy-1.3.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c414fc1ed8ee1dbd5da626cf3710c6013d3d27456651d156711fa24f24bd1291"}, + {file = "contourpy-1.3.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:31c1b55c1f34f80557d3830d3dd93ba722ce7e33a0b472cba0ec3b6535684d8f"}, + {file = "contourpy-1.3.1-cp311-cp311-win32.whl", hash = "sha256:f611e628ef06670df83fce17805c344710ca5cde01edfdc72751311da8585375"}, + {file = "contourpy-1.3.1-cp311-cp311-win_amd64.whl", hash = "sha256:b2bdca22a27e35f16794cf585832e542123296b4687f9fd96822db6bae17bfc9"}, + {file = "contourpy-1.3.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:0ffa84be8e0bd33410b17189f7164c3589c229ce5db85798076a3fa136d0e509"}, + {file = "contourpy-1.3.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:805617228ba7e2cbbfb6c503858e626ab528ac2a32a04a2fe88ffaf6b02c32bc"}, + {file = "contourpy-1.3.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ade08d343436a94e633db932e7e8407fe7de8083967962b46bdfc1b0ced39454"}, + {file = "contourpy-1.3.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:47734d7073fb4590b4a40122b35917cd77be5722d80683b249dac1de266aac80"}, + {file = "contourpy-1.3.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2ba94a401342fc0f8b948e57d977557fbf4d515f03c67682dd5c6191cb2d16ec"}, + {file = "contourpy-1.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efa874e87e4a647fd2e4f514d5e91c7d493697127beb95e77d2f7561f6905bd9"}, + {file = "contourpy-1.3.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1bf98051f1045b15c87868dbaea84f92408337d4f81d0e449ee41920ea121d3b"}, + {file = "contourpy-1.3.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:61332c87493b00091423e747ea78200659dc09bdf7fd69edd5e98cef5d3e9a8d"}, + {file = "contourpy-1.3.1-cp312-cp312-win32.whl", hash = "sha256:e914a8cb05ce5c809dd0fe350cfbb4e881bde5e2a38dc04e3afe1b3e58bd158e"}, + {file = "contourpy-1.3.1-cp312-cp312-win_amd64.whl", hash = "sha256:08d9d449a61cf53033612cb368f3a1b26cd7835d9b8cd326647efe43bca7568d"}, + {file = "contourpy-1.3.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a761d9ccfc5e2ecd1bf05534eda382aa14c3e4f9205ba5b1684ecfe400716ef2"}, + {file = "contourpy-1.3.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:523a8ee12edfa36f6d2a49407f705a6ef4c5098de4f498619787e272de93f2d5"}, + {file = "contourpy-1.3.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece6df05e2c41bd46776fbc712e0996f7c94e0d0543af1656956d150c4ca7c81"}, + {file = "contourpy-1.3.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:573abb30e0e05bf31ed067d2f82500ecfdaec15627a59d63ea2d95714790f5c2"}, + {file = "contourpy-1.3.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a9fa36448e6a3a1a9a2ba23c02012c43ed88905ec80163f2ffe2421c7192a5d7"}, + {file = "contourpy-1.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ea9924d28fc5586bf0b42d15f590b10c224117e74409dd7a0be3b62b74a501c"}, + {file = "contourpy-1.3.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5b75aa69cb4d6f137b36f7eb2ace9280cfb60c55dc5f61c731fdf6f037f958a3"}, + {file = "contourpy-1.3.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:041b640d4ec01922083645a94bb3b2e777e6b626788f4095cf21abbe266413c1"}, + {file = "contourpy-1.3.1-cp313-cp313-win32.whl", hash = "sha256:36987a15e8ace5f58d4d5da9dca82d498c2bbb28dff6e5d04fbfcc35a9cb3a82"}, + {file = "contourpy-1.3.1-cp313-cp313-win_amd64.whl", hash = "sha256:a7895f46d47671fa7ceec40f31fae721da51ad34bdca0bee83e38870b1f47ffd"}, + {file = "contourpy-1.3.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:9ddeb796389dadcd884c7eb07bd14ef12408aaae358f0e2ae24114d797eede30"}, + {file = "contourpy-1.3.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:19c1555a6801c2f084c7ddc1c6e11f02eb6a6016ca1318dd5452ba3f613a1751"}, + {file = "contourpy-1.3.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:841ad858cff65c2c04bf93875e384ccb82b654574a6d7f30453a04f04af71342"}, + {file = "contourpy-1.3.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4318af1c925fb9a4fb190559ef3eec206845f63e80fb603d47f2d6d67683901c"}, + {file = "contourpy-1.3.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:14c102b0eab282427b662cb590f2e9340a9d91a1c297f48729431f2dcd16e14f"}, + {file = "contourpy-1.3.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05e806338bfeaa006acbdeba0ad681a10be63b26e1b17317bfac3c5d98f36cda"}, + {file = "contourpy-1.3.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4d76d5993a34ef3df5181ba3c92fabb93f1eaa5729504fb03423fcd9f3177242"}, + {file = "contourpy-1.3.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:89785bb2a1980c1bd87f0cb1517a71cde374776a5f150936b82580ae6ead44a1"}, + {file = "contourpy-1.3.1-cp313-cp313t-win32.whl", hash = "sha256:8eb96e79b9f3dcadbad2a3891672f81cdcab7f95b27f28f1c67d75f045b6b4f1"}, + {file = "contourpy-1.3.1-cp313-cp313t-win_amd64.whl", hash = "sha256:287ccc248c9e0d0566934e7d606201abd74761b5703d804ff3df8935f523d546"}, + {file = "contourpy-1.3.1.tar.gz", hash = "sha256:dfd97abd83335045a913e3bcc4a09c0ceadbe66580cf573fe961f4a825efa699"}, ] [[package]] diff --git a/xklb/__main__.py b/xklb/__main__.py index dcb1dacf..8de76b57 100644 --- a/xklb/__main__.py +++ b/xklb/__main__.py @@ -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": { diff --git a/xklb/createdb/tildes.py b/xklb/createdb/tildes.py index f275b9a4..0c7d9b88 100644 --- a/xklb/createdb/tildes.py +++ b/xklb/createdb/tildes.py @@ -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), } @@ -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, diff --git a/xklb/createdb/tube_backend.py b/xklb/createdb/tube_backend.py index 88cf9486..5f6f44e2 100644 --- a/xklb/createdb/tube_backend.py +++ b/xklb/createdb/tube_backend.py @@ -429,14 +429,14 @@ def yt_cli_to_api(opts): if match_filter_user_config is None: match_filters.append("duration >? 59 & duration 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 diff --git a/xklb/mediafiles/process_image.py b/xklb/mediafiles/process_image.py index b0367a39..acf3c526 100644 --- a/xklb/mediafiles/process_image.py +++ b/xklb/mediafiles/process_image.py @@ -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) diff --git a/xklb/mediafiles/process_text.py b/xklb/mediafiles/process_text.py index 03470008..5eb03fd3 100644 --- a/xklb/mediafiles/process_text.py +++ b/xklb/mediafiles/process_text.py @@ -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) diff --git a/xklb/utils/arg_utils.py b/xklb/utils/arg_utils.py index 857fe7e4..66439740 100644 --- a/xklb/utils/arg_utils.py +++ b/xklb/utils/arg_utils.py @@ -1,12 +1,10 @@ -import argparse, operator, os.path, random +import argparse, operator, random from collections import defaultdict from copy import copy from pathlib import Path -from typing import Generator from xklb.utils import consts, file_utils, iterables, nums, processes, strings from xklb.utils.consts import SC -from xklb.utils.log_utils import log def gen_paths(args, default_exts=None): @@ -17,8 +15,8 @@ def gen_paths(args, default_exts=None): for path in args.paths: json_data = strings.safe_json_loads(path) if isinstance(json_data, list): - for d in json_data: - yield d["path"] + for json_item in json_data: + yield json_item["path"] elif isinstance(json_data, dict): yield json_data["path"] else: @@ -29,11 +27,6 @@ def gen_paths(args, default_exts=None): p = Path(path) if p.is_dir(): yield from file_utils.rglob(str(p), args.ext or default_exts, getattr(args, "exclude", None))[0] - elif getattr(args, 'hide_deleted', False): - if os.path.exists(p): - yield path - else: - log.info("Skipping non-existent file %s", path) else: yield path @@ -47,17 +40,9 @@ def gen_d(args, default_exts=None): json_data = strings.safe_json_loads(path) if isinstance(json_data, list): for json_item in json_data: - if getattr(args, 'hide_deleted', False): - if os.path.exists(json_item["path"]): - yield json_item - else: - yield json_item + yield json_item elif isinstance(json_data, dict): - if getattr(args, 'hide_deleted', False): - if os.path.exists(json_data["path"]): - yield json_data - else: - yield json_data + yield json_data else: raise TypeError else: @@ -67,11 +52,6 @@ def gen_d(args, default_exts=None): if p.is_dir(): for sp in file_utils.rglob(str(p), args.ext or default_exts, getattr(args, "exclude", None))[0]: yield {"path": sp} - elif getattr(args, 'hide_deleted', False): - if os.path.exists(p): - yield {"path": path} - else: - log.info("Skipping non-existent file %s", path) else: yield {"path": path} diff --git a/xklb/utils/arggroups.py b/xklb/utils/arggroups.py index fe6ff10d..e17c509f 100644 --- a/xklb/utils/arggroups.py +++ b/xklb/utils/arggroups.py @@ -1327,7 +1327,11 @@ def process_ffmpeg(parent_parser): "--delete-no-audio", action="store_true", help="Delete files with no audio instead of transcoding video" ) 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") diff --git a/xklb/utils/db_utils.py b/xklb/utils/db_utils.py index 5b122cf0..1ccdb371 100644 --- a/xklb/utils/db_utils.py +++ b/xklb/utils/db_utils.py @@ -189,9 +189,9 @@ def optimize(args) -> None: fts_columns, create_triggers=True, replace=True, - tokenize="trigram" - if sqlite3.sqlite_version_info >= (3, 34, 0) - else 'unicode61 "tokenchars=_."', # https://www.sqlite.org/releaselog/3_34_0.html + tokenize=( + "trigram" if sqlite3.sqlite_version_info >= (3, 34, 0) else 'unicode61 "tokenchars=_."' + ), # https://www.sqlite.org/releaselog/3_34_0.html ) else: with db.conn: # type: ignore