Skip to content

Commit

Permalink
fix retry remove callback move to wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Aug 28, 2024
1 parent 2736452 commit a30b5d9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ofscraper/utils/args/parse/arguments/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,11 @@
"-rd",
"--redownload",
"--re-download",
"re_download",
"redownload",
help="Forces redownloading of all files in selected post types",
default=False,
is_flag=True,
callback=lambda ctx, param, value: retry_helper.retry_callback(ctx, param, value)

)

like_toggle_force = click.option(
Expand Down
13 changes: 7 additions & 6 deletions ofscraper/utils/args/parse/arguments/utils/retry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import arrow
def retry_callback(ctx, param, value):
params = ctx.params
if value:
params["force_all"] = True
params["after"] = arrow.get(2000)
params["no_api_cache"]=True
def retry_modifiy(ctx):
# Modify the URL based on certain conditions or ctx values
if ctx.params['redownload']:
ctx.params["force_all"] = True
ctx.params["after"] = arrow.get(2000)
ctx.params["no_api_cache"]=True
return ctx
2 changes: 2 additions & 0 deletions ofscraper/utils/args/parse/commands/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ofscraper.utils.args.parse.group_bundles.advanced_common import advanced_args
from ofscraper.utils.args.parse.group_bundles.common import common_args
from ofscraper.utils.args.parse.group_bundles.main import main_program_args
import ofscraper.utils.args.parse.arguments.utils.retry as retry_helper


@click.group(
Expand All @@ -15,4 +16,5 @@
@advanced_args
@click.pass_context
def program(ctx, *args, **kwargs):
ctx=retry_helper.retry_modifiy(ctx)
return ctx.params, ctx.info_name
2 changes: 2 additions & 0 deletions ofscraper/utils/args/parse/commands/metadata.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import cloup as click

from ofscraper.utils.args.parse.group_bundles.metadata import metadata_args
import ofscraper.utils.args.parse.arguments.utils.retry as retry_helper


@metadata_args
@click.pass_context
def metadata(ctx, *args, **kwargs):
ctx=retry_helper.retry_modifiy(ctx)
return ctx.params, ctx.info_name

0 comments on commit a30b5d9

Please sign in to comment.