New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add template filter to parse human-readable file size to bytes #3750
Conversation
I like the idea. Maybe we should remove the anchors from the regex so that less regex in the template itself is needed? And maybe we make an optional parameter to control whether it assumes SI units or not, e.g. |
minor improve of regex false-positive match
@gazpachoking Updated. Please check again and feel free to comment :) P.S. should I add a specified test for this filter? I found most of the filters have no specified test except |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small comments, but looks good to me! And I think a few tests would be a great idea if you are up for it.
I thought of one more question... should it be case sensitive? I'm thinking people will only use this filter on fields that are very likely to have a size in it, so we probably don't need to be so strict about the casing. |
Updated. I've added an argument that can let user match case-insensitive, and false by default. Case-insensitive matching will significantly increase the wrong match rate. Considering a title like this, which are really common in most RSS feed:
A case-insensitive matching will match the sample rate |
That's a good point. We probably could have gone with it several iterations ago, but I can't help tweaking. 😄 What about a negative lookahead at the end of the regex to eliminate that kind of error? Something like |
I adjusted the regex with lookahead syntax, it should work without wrong match: (?P<digit>\d+(?:\.\d+)?)\s*(?P<unit>[KMGTPE]?i?B(?!\w)) If you think there is no problem with this regexp, please reply and I will push the new commit later. I believe this regex should work for 99% of entries. And for scenarios that this filter can't handle, users can chain the |
Awesome, thanks! |
* Update docker/build-push-action action to v4 * Update irc to download tracker config correctly (#3678) [fix] irc: Update irc to download tracker config correctly * Bump isort version in pre-commit * Close task requests session after execution. Hopefully helps address issue with file handles being left open. * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 22.12.0 → 23.1.0](psf/black@22.12.0...23.1.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.5.22 * Prepare v3.5.23.dev * Fix for empty lazy field * use better way for cheking for existance of a field Co-authored-by: Chase Sterling <chase.sterling@gmail.com> * v3.5.23 * Prepare v3.5.24.dev * [fix] pyload ng (#3684) * Fix for pyload ng --------- Co-authored-by: Stefan Bischoff <stefan.bischoff@power.cloud> * v3.5.24 * Prepare v3.5.25.dev * fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * revert space change * v3.5.25 * Prepare v3.5.26.dev * [fix] sftp_list host_key accessing exception (#3694) * v3.5.26 * Prepare v3.5.27.dev * [add] from_qbittorrent plugin (#3692) * [change] Add support for 'labels' in Transmission. (#3693) * v3.5.27 * Prepare v3.5.28.dev * [fix] memusage debugging module updated for python 3 * [fix] memusage plugin crashes with windows * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/python-poetry/poetry: 1.3.0 → 1.4.0](python-poetry/poetry@1.3.0...1.4.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.5.28 * Prepare v3.5.29.dev * [fix] Memory leak when there is no sys.stderr (#3701) Also clean up the Manager init behavior and logging startup to be a bit easier to follow. * v3.5.29 * Prepare v3.5.30.dev * Add more detailed assertions for entries generated by the sftp_list plugin. Previously the test cases only focused on if a certain entry existed, not that it contined the correct data. As such this change adds assert_entries() method which allows more detail about the entries generated to be specified as well as checking if any erroneous entires were also generated. This change preceeds the change of symlink handling in the sftp_list plugin to make it easier to assert the URL change in the test. This change also includes a small bit of cleanup in terms of the task names to make it clearer which variables are been set in that test case. * Dont normalized every path returned via the sftp_list plugin. Previously every path returned from the sftp_list plugin was normalised, this meant that symlinks were always resolved before been returned making it impossible to get the symlinks path. * If a sftp_download entry points to a symlink and delete_origin is true, only remove the symlink, and not it's target. This changes the behaviour when dealing with entries representing symlinks. If entry previously represented a symlink it would remove it's target or in the case of a directory it's contents. This changes that behaviour such as in the case of a symlink, only the link will be removed, but not it's target. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Allow newer rpyc versions. fix #3601 * v3.5.30 * Prepare v3.5.31.dev * [fix] transmission: transmission-rpc deprecated base64 torrent content (#3715) * fix: transmission-rpc deprecated base64 torrent content * use patblib.Path * use shared timeout * read bytes * [add] Torznab: Add timeout parameter (#2738) * Torznab: Add timeout parameter This is needed for under some environments with many sources on the torznab, the answer will take more than 30 seconds. Let the user configure this to adapt according to their needs. * v3.5.31 * Prepare v3.5.32.dev * [add] sftp plugin supports additional SSH key types (#3714) * Handle additional SSH Key. pysftp doesn't handle Ed25519Key and ECDSA key types, this change monkeypatches the _set_authentication method in pysftp to add handling for these additional key types. * v3.5.32 * Prepare v3.5.33.dev * Pushsafer Notification Service (#3718) [change] pushsafer: Adds more options to customize notification * v3.5.33 * Prepare v3.5.34.dev * Update actions/stale action to v8 (#3725) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v3.5.34 * Prepare v3.5.35.dev * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0) * v3.5.35 * Prepare v3.5.36.dev * v3.5.36 * Prepare v3.5.37.dev * upgrade to transmission-rpc v4 (#3716) transmission: Update to use transmission-rpc >=4.0 * v3.6.0 * Prepare v3.6.1.dev * upgrade to new python syntax (#3738) Adds a pre-commit hook which updates syntax to cleaner versions available in newer python versions. * [change] rarbg: allow using domain_delay and increase default delay. fix #3705 Increase rarbg delay from 3s to 6s. Allow using domain_delay to override the built in delay for rarbg. Add an option to not replace existing domain limiter on a session. * Add ruff to dev dependencies * Ruff fix E713. not X in Y -> X not in Y * Ruff fix F541. f-strings without placeholders * Ruff fix F401. unused imports * Ruff fix F841. unused variables * Ruff fix E731. lambda assignment * Ruff fix F402. shadowed variables * Ruff fix F821. undefined names * Add some noqa for purposefully delayed imports * Ruff fix F811. redefinition of unused names * Ruff fix E722. bare excepts * Ruff fix E741. ambiguous variable names * Fix aria2 config schema I just broke * Fix sftp plugin? * add qb package to Docker (#3737) Move extra docker requirements to pyproject.toml Build docker image on PRs * v3.6.1 * Prepare v3.6.2.dev * Enable ruff in pre-commit. Enable ruff to do import sorting. Sort all imports. * Switch from pyupgrade to ruff in pre-commit. More pyupgrade type fixes. * Remove isort and pylint deps. * Enable pylint error checking on ruff. * Some fixes for flake8 bugbear warnings. * Enable flake8 comprehension fixes (C4) Fix them. * Enable some more ruff checks. * from_transmission: Properly set url field to prevent crash. fix #3741 * Simplify by using pathlib instead of os.path * Enable implicit string concat linting * Tweak docker webui install for easier maintenance (#3739) * Update docker.io/python Docker tag to v3.11 * Switch Dockerfile to use dev_tools to bundle webui --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v3.6.2 * Prepare v3.6.3.dev * v3.6.3 * Prepare v3.6.4.dev * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.261 → v0.0.262](astral-sh/ruff-pre-commit@v0.0.261...v0.0.262) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.6.4 * Prepare v3.6.5.dev * Cross build docker images for more arch * Add rust compiler This is needed to build cryptography * Add cargo package manager * Set cargo to use of the git executable to fetch, Ref. rust-lang/cargo#10230 * Add git We need it to allow cargo to fetch packages * add * [fix] from_transmission: Don't crash when generating done_date. fix #3745 * fix(deps): update dependency flask to v2.3.2 [security] * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Maybe fix renovate/pre-commit wars on vulnerability PRs * Different try to disable requirements.txt detection for vulnerability prs * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.262 → v0.0.263](astral-sh/ruff-pre-commit@v0.0.262...v0.0.263) * v3.6.5 * Prepare v3.6.6.dev * fix(deps): update dependency flask to v2.2.5 [security] * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.6.6 * Prepare v3.6.7.dev * [Add] template filter to parse human-readable file size to bytes (#3750) * Add template filter to parse human-readable file size to bytes * pass test * handle undefined variable case * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add si carry support and remove regex anchor minor improve of regex false-positive match * tighten up regexp and adjust variable name * add specified test for `parse_size` * add case-insensitive matching support --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * add provenance: false to docker buildx (#3759) * Strip timezone from transmission_date_done field to be consistent with other datetimes * v3.6.7 * Prepare v3.6.8.dev * [change] Update dockerfile for faster builds and smaller updates * Optimize docker layers so that dependencies don't get rebuilt when they haven't changed * CI now caches docker image layers for faster builds * v3.6.8 * Prepare v3.6.9.dev * chore(deps): update actions/cache action to v3 * Remove unused docker caching (#3763) The docker/build-push-action has built in caching. Looks like the explicit cache action wasn't doing anything. * [fix] download: Fix streaming downloads to disk instead of loading entirely in memory. fix #3762 (#3764) * Cache intermediate layers for docker builds * [pre-commit.ci] pre-commit autoupdate (#3765) updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.263 → v0.0.265](astral-sh/ruff-pre-commit@v0.0.263...v0.0.265) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * v3.6.9 * Prepare v3.6.10.dev * [change] morethantv: Update categories to match website * Update ubuntu Docker tag to v22 (#3662) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v3.7.0 * Prepare v3.7.1.dev * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Steve Adams <stevezau@gmail.com> Co-authored-by: Chase Sterling <chase.sterling@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: FlexGet-Bot <chase.sterling+fg@gmail.com> Co-authored-by: Stefan Bischoff <stefan.bischoff@power.cloud> Co-authored-by: StefftheEmperor2 <55734627+StefftheEmperor2@users.noreply.github.com> Co-authored-by: Trim21 <trim21.me@gmail.com> Co-authored-by: Aidan Rowe <aidanrowe@gmail.com> Co-authored-by: paranoidi <marko.koivusalo@gmail.com> Co-authored-by: ProteinPig <ProteinPig@Gmail.com> Co-authored-by: kingamjick <kingamajick@gmail.com> Co-authored-by: eSoares <eSoares@users.noreply.github.com> Co-authored-by: Kevin Siml <appzer@users.noreply.github.com> Co-authored-by: ianstalk <ijeaston@gmail.com> Co-authored-by: Massimiliano Cannarozzo <maxcanna@gmail.com> Co-authored-by: Johnny Hsieh <32300164+mnixry@users.noreply.github.com> Co-authored-by: Steve <38679608+spgomez@users.noreply.github.com> Co-authored-by: Patrick Egli <paedy@P-DESKTOP>
* [fix] imdb_lookup: updated the scraper for the newish html structure * fix some tests * cassettes * ... * move to https as imdb now redirects to https by default * fix test_imdb tests * fix imdb parser tests * fix imdb tests * more updates to vcr recordings to fix imdb tests * use api v3 * fix profile endpoint * fix profileid name * language id required * fixed * Initial rewrite * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Initial rewrite * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test cassettes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix exact match * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test imdb cache * fix nfo tests * refactor exact testing * fix text exists * Fix test * Radarr sonarr api v3 - Fix merge conflicts (#3771) * Revert unwanted changes Restore api.py and test_metainfo.py to develop version. Delete imdb.py (not existent on develop) tmp * Adapt cassettes for radarr/sonarr tests --------- Co-authored-by: Patrick Egli <paedy@P-DESKTOP> * Radarr sonarr api v3 - Fix merge conflicts with develop (#3775) * Update docker/build-push-action action to v4 * Update irc to download tracker config correctly (#3678) [fix] irc: Update irc to download tracker config correctly * Bump isort version in pre-commit * Close task requests session after execution. Hopefully helps address issue with file handles being left open. * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 22.12.0 → 23.1.0](psf/black@22.12.0...23.1.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.5.22 * Prepare v3.5.23.dev * Fix for empty lazy field * use better way for cheking for existance of a field Co-authored-by: Chase Sterling <chase.sterling@gmail.com> * v3.5.23 * Prepare v3.5.24.dev * [fix] pyload ng (#3684) * Fix for pyload ng --------- Co-authored-by: Stefan Bischoff <stefan.bischoff@power.cloud> * v3.5.24 * Prepare v3.5.25.dev * fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * revert space change * v3.5.25 * Prepare v3.5.26.dev * [fix] sftp_list host_key accessing exception (#3694) * v3.5.26 * Prepare v3.5.27.dev * [add] from_qbittorrent plugin (#3692) * [change] Add support for 'labels' in Transmission. (#3693) * v3.5.27 * Prepare v3.5.28.dev * [fix] memusage debugging module updated for python 3 * [fix] memusage plugin crashes with windows * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/python-poetry/poetry: 1.3.0 → 1.4.0](python-poetry/poetry@1.3.0...1.4.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.5.28 * Prepare v3.5.29.dev * [fix] Memory leak when there is no sys.stderr (#3701) Also clean up the Manager init behavior and logging startup to be a bit easier to follow. * v3.5.29 * Prepare v3.5.30.dev * Add more detailed assertions for entries generated by the sftp_list plugin. Previously the test cases only focused on if a certain entry existed, not that it contined the correct data. As such this change adds assert_entries() method which allows more detail about the entries generated to be specified as well as checking if any erroneous entires were also generated. This change preceeds the change of symlink handling in the sftp_list plugin to make it easier to assert the URL change in the test. This change also includes a small bit of cleanup in terms of the task names to make it clearer which variables are been set in that test case. * Dont normalized every path returned via the sftp_list plugin. Previously every path returned from the sftp_list plugin was normalised, this meant that symlinks were always resolved before been returned making it impossible to get the symlinks path. * If a sftp_download entry points to a symlink and delete_origin is true, only remove the symlink, and not it's target. This changes the behaviour when dealing with entries representing symlinks. If entry previously represented a symlink it would remove it's target or in the case of a directory it's contents. This changes that behaviour such as in the case of a symlink, only the link will be removed, but not it's target. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Allow newer rpyc versions. fix #3601 * v3.5.30 * Prepare v3.5.31.dev * [fix] transmission: transmission-rpc deprecated base64 torrent content (#3715) * fix: transmission-rpc deprecated base64 torrent content * use patblib.Path * use shared timeout * read bytes * [add] Torznab: Add timeout parameter (#2738) * Torznab: Add timeout parameter This is needed for under some environments with many sources on the torznab, the answer will take more than 30 seconds. Let the user configure this to adapt according to their needs. * v3.5.31 * Prepare v3.5.32.dev * [add] sftp plugin supports additional SSH key types (#3714) * Handle additional SSH Key. pysftp doesn't handle Ed25519Key and ECDSA key types, this change monkeypatches the _set_authentication method in pysftp to add handling for these additional key types. * v3.5.32 * Prepare v3.5.33.dev * Pushsafer Notification Service (#3718) [change] pushsafer: Adds more options to customize notification * v3.5.33 * Prepare v3.5.34.dev * Update actions/stale action to v8 (#3725) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v3.5.34 * Prepare v3.5.35.dev * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0) * v3.5.35 * Prepare v3.5.36.dev * v3.5.36 * Prepare v3.5.37.dev * upgrade to transmission-rpc v4 (#3716) transmission: Update to use transmission-rpc >=4.0 * v3.6.0 * Prepare v3.6.1.dev * upgrade to new python syntax (#3738) Adds a pre-commit hook which updates syntax to cleaner versions available in newer python versions. * [change] rarbg: allow using domain_delay and increase default delay. fix #3705 Increase rarbg delay from 3s to 6s. Allow using domain_delay to override the built in delay for rarbg. Add an option to not replace existing domain limiter on a session. * Add ruff to dev dependencies * Ruff fix E713. not X in Y -> X not in Y * Ruff fix F541. f-strings without placeholders * Ruff fix F401. unused imports * Ruff fix F841. unused variables * Ruff fix E731. lambda assignment * Ruff fix F402. shadowed variables * Ruff fix F821. undefined names * Add some noqa for purposefully delayed imports * Ruff fix F811. redefinition of unused names * Ruff fix E722. bare excepts * Ruff fix E741. ambiguous variable names * Fix aria2 config schema I just broke * Fix sftp plugin? * add qb package to Docker (#3737) Move extra docker requirements to pyproject.toml Build docker image on PRs * v3.6.1 * Prepare v3.6.2.dev * Enable ruff in pre-commit. Enable ruff to do import sorting. Sort all imports. * Switch from pyupgrade to ruff in pre-commit. More pyupgrade type fixes. * Remove isort and pylint deps. * Enable pylint error checking on ruff. * Some fixes for flake8 bugbear warnings. * Enable flake8 comprehension fixes (C4) Fix them. * Enable some more ruff checks. * from_transmission: Properly set url field to prevent crash. fix #3741 * Simplify by using pathlib instead of os.path * Enable implicit string concat linting * Tweak docker webui install for easier maintenance (#3739) * Update docker.io/python Docker tag to v3.11 * Switch Dockerfile to use dev_tools to bundle webui --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v3.6.2 * Prepare v3.6.3.dev * v3.6.3 * Prepare v3.6.4.dev * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.261 → v0.0.262](astral-sh/ruff-pre-commit@v0.0.261...v0.0.262) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.6.4 * Prepare v3.6.5.dev * Cross build docker images for more arch * Add rust compiler This is needed to build cryptography * Add cargo package manager * Set cargo to use of the git executable to fetch, Ref. rust-lang/cargo#10230 * Add git We need it to allow cargo to fetch packages * add * [fix] from_transmission: Don't crash when generating done_date. fix #3745 * fix(deps): update dependency flask to v2.3.2 [security] * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Maybe fix renovate/pre-commit wars on vulnerability PRs * Different try to disable requirements.txt detection for vulnerability prs * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.262 → v0.0.263](astral-sh/ruff-pre-commit@v0.0.262...v0.0.263) * v3.6.5 * Prepare v3.6.6.dev * fix(deps): update dependency flask to v2.2.5 [security] * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * v3.6.6 * Prepare v3.6.7.dev * [Add] template filter to parse human-readable file size to bytes (#3750) * Add template filter to parse human-readable file size to bytes * pass test * handle undefined variable case * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add si carry support and remove regex anchor minor improve of regex false-positive match * tighten up regexp and adjust variable name * add specified test for `parse_size` * add case-insensitive matching support --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * add provenance: false to docker buildx (#3759) * Strip timezone from transmission_date_done field to be consistent with other datetimes * v3.6.7 * Prepare v3.6.8.dev * [change] Update dockerfile for faster builds and smaller updates * Optimize docker layers so that dependencies don't get rebuilt when they haven't changed * CI now caches docker image layers for faster builds * v3.6.8 * Prepare v3.6.9.dev * chore(deps): update actions/cache action to v3 * Remove unused docker caching (#3763) The docker/build-push-action has built in caching. Looks like the explicit cache action wasn't doing anything. * [fix] download: Fix streaming downloads to disk instead of loading entirely in memory. fix #3762 (#3764) * Cache intermediate layers for docker builds * [pre-commit.ci] pre-commit autoupdate (#3765) updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.263 → v0.0.265](astral-sh/ruff-pre-commit@v0.0.263...v0.0.265) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * v3.6.9 * Prepare v3.6.10.dev * [change] morethantv: Update categories to match website * Update ubuntu Docker tag to v22 (#3662) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v3.7.0 * Prepare v3.7.1.dev * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Steve Adams <stevezau@gmail.com> Co-authored-by: Chase Sterling <chase.sterling@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: FlexGet-Bot <chase.sterling+fg@gmail.com> Co-authored-by: Stefan Bischoff <stefan.bischoff@power.cloud> Co-authored-by: StefftheEmperor2 <55734627+StefftheEmperor2@users.noreply.github.com> Co-authored-by: Trim21 <trim21.me@gmail.com> Co-authored-by: Aidan Rowe <aidanrowe@gmail.com> Co-authored-by: paranoidi <marko.koivusalo@gmail.com> Co-authored-by: ProteinPig <ProteinPig@Gmail.com> Co-authored-by: kingamjick <kingamajick@gmail.com> Co-authored-by: eSoares <eSoares@users.noreply.github.com> Co-authored-by: Kevin Siml <appzer@users.noreply.github.com> Co-authored-by: ianstalk <ijeaston@gmail.com> Co-authored-by: Massimiliano Cannarozzo <maxcanna@gmail.com> Co-authored-by: Johnny Hsieh <32300164+mnixry@users.noreply.github.com> Co-authored-by: Steve <38679608+spgomez@users.noreply.github.com> Co-authored-by: Patrick Egli <paedy@P-DESKTOP> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: cvium <clausvium@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: patrickegli <patrickegli@users.noreply.github.com> Co-authored-by: Patrick Egli <paedy@P-DESKTOP> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Chase Sterling <chase.sterling@gmail.com> Co-authored-by: FlexGet-Bot <chase.sterling+fg@gmail.com> Co-authored-by: Stefan Bischoff <stefan.bischoff@power.cloud> Co-authored-by: StefftheEmperor2 <55734627+StefftheEmperor2@users.noreply.github.com> Co-authored-by: Trim21 <trim21.me@gmail.com> Co-authored-by: Aidan Rowe <aidanrowe@gmail.com> Co-authored-by: paranoidi <marko.koivusalo@gmail.com> Co-authored-by: ProteinPig <ProteinPig@Gmail.com> Co-authored-by: kingamjick <kingamajick@gmail.com> Co-authored-by: eSoares <eSoares@users.noreply.github.com> Co-authored-by: Kevin Siml <appzer@users.noreply.github.com> Co-authored-by: ianstalk <ijeaston@gmail.com> Co-authored-by: Massimiliano Cannarozzo <maxcanna@gmail.com> Co-authored-by: Johnny Hsieh <32300164+mnixry@users.noreply.github.com> Co-authored-by: Steve <38679608+spgomez@users.noreply.github.com>
Motivation for changes:
Some of the plugin, for example
rss
does not produce thetorrent_size
entry field, but for some sites, it actually contains human-readable size like114.5MB
,14GB
, or1.91TB
in the torrent title.In some cases, we need to filter out the torrents that are larger or smaller than we expected size. In this case, a filter to parse human-readable string to actual bytes number is necessary.
Detailed changes:
parse_size
to support parse the string like114.5GB
to122943438848
bytes intConfig usage if relevant (new plugin or updated schema):
To Do:
Current PR is a proof of concept, if you have any ideas about it, welcome comment.