Skip to content

Commit

Permalink
fix config prompt memnu
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Jan 24, 2024
1 parent aae72b1 commit 4f0de3c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions ofscraper/const/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
"This tool is for educational purposes only and is not intended for actual use. Should you choose to actually use it you accept all consequences and agree that you are not using it to redistribute content or for any other action that will cause loss of revenue to creators or platforms scraped.",
]
APP_TOKEN = "33d57ade8c02dbc5a333db99ff9ae26a"
CONTINUE_BOOL = True
24 changes: 20 additions & 4 deletions ofscraper/prompts/prompt_groups/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import ofscraper.utils.cache as cache
import ofscraper.utils.config.custom as custom
import ofscraper.utils.config.data as data
import ofscraper.utils.config.file as config_file
import ofscraper.utils.config.schema as schema
import ofscraper.utils.constants as constants
import ofscraper.utils.paths.common as common_paths
Expand Down Expand Up @@ -195,11 +196,24 @@ def config_prompt_advanced() -> dict:
],
"long_instruction": "Truncation is based on operating system",
},
{
"type": "list",
"name": "infinite_loop_action_mode",
"message": "Run Program in infinite loop when in action mode",
"default": data.get_InfiniteLoop(),
"choices": [
Choice(True, "Yes"),
Choice(False, "No"),
],
"long_instruction": "Action Mode is when at least one --action is based as an arg or --scrape-paid",
},
]
)
out.update(new_settings)
out = schema.get_current_config_schema(out)
return out
config = config_file.open_config()
config.update(out)
final = schema.get_current_config_schema(config)
return final


def config_prompt() -> dict:
Expand Down Expand Up @@ -449,8 +463,10 @@ def config_prompt() -> dict:
)
answer["responsetype"] = answer2
out.update(answer)
out = schema.get_current_config_schema({"config": out})
return out
config = config_file.open_config()
config.update(out)
final = schema.get_current_config_schema({"config": config})
return final


def manual_config_prompt(configText) -> str:
Expand Down
2 changes: 2 additions & 0 deletions ofscraper/prompts/prompt_groups/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def action_prompt() -> int:


def continue_prompt() -> bool:
if not constants.getattr("CONTINUE_BOOL"):
return False
name = "continue"
answer = promptClasses.batchConverter(
*[
Expand Down
9 changes: 5 additions & 4 deletions ofscraper/utils/config/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ def get_InfiniteLoop(config=None):
return constants_attr.getattr("INFINITE_LOOP_DEFAULT")
elif config == False:
return constants.INFINITE_LOOP_DEFAULT
return (
config.get("advanced_options", {}).get("infinite_loop")
if config.get("advanced_options", {}).get("infinite_loop") != None
else constants_attr.getattr("INFINITE_LOOP_DEFAULT")
val = (
config.get("infinite_loop_action_mode")
if config.get("infinite_loop_action_mode") != None
else config.get("advanced_options", {}).get("infinite_loop_action_mode")
)
return val if val != None else constants_attr.getattr("INFINITE_LOOP_DEFAULT")


@wrapper.config_reader
Expand Down
2 changes: 1 addition & 1 deletion ofscraper/utils/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_current_config_schema(config: dict = None) -> dict:
"custom_values": custom.get_custom(config=config),
"sanitize_text": data.get_sanitizeDB(config=config),
"temp_dir": data.get_TempDir(config=config),
"infinite_loop": data.get_InfiniteLoop(config=config),
"infinite_loop_action_mode": data.get_InfiniteLoop(config=config),
},
"responsetype": {
"timeline": data.get_timeline_responsetype(config=config),
Expand Down

0 comments on commit 4f0de3c

Please sign in to comment.