Skip to content

Commit

Permalink
fix manual mode
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Jan 25, 2024
1 parent da8955d commit 323620b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ofscraper/classes/placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import arrow

import ofscraper.api.me as me
import ofscraper.filters.models.selector as selector
import ofscraper.models.selector as selector
import ofscraper.utils.args.read as read_args
import ofscraper.utils.cache as cache
import ofscraper.utils.config.custom as custom_
Expand Down
5 changes: 3 additions & 2 deletions ofscraper/commands/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ofscraper.classes.sessionbuilder as sessionbuilder
import ofscraper.db.operations as operations
import ofscraper.download.download as download
import ofscraper.models.selector as selector
import ofscraper.utils.args.read as read_args
import ofscraper.utils.args.write as write_args
import ofscraper.utils.constants as constants
Expand All @@ -21,11 +22,11 @@ def manual_download(urls=None):
log = logging.getLogger("shared")
network.check_cdm()
media_dict = get_media_from_urls(urls)
log.debug(f"Media dict length {len(list(media_dict.values()))}")
log.debug(f"Number of values from media dict {len(list(media_dict.values()))}")
args = read_args.retriveArgs()
args.dupe = True
write_args.setArgs(args)

selector.all_subs_helper()
for value in media_dict.values():
if len(value) == 0:
continue
Expand Down
2 changes: 1 addition & 1 deletion ofscraper/commands/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import ofscraper.db.operations as operations
import ofscraper.download.download as download
import ofscraper.filters.media.main as filters
import ofscraper.filters.models.selector as userselector
import ofscraper.models.selector as userselector
import ofscraper.prompts.prompts as prompts
import ofscraper.utils.actions as actions
import ofscraper.utils.args.areas as areas
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import ofscraper.filters.models.flags as flags
import ofscraper.filters.models.other as other
import ofscraper.filters.models.price as price
import ofscraper.filters.models.retriver as retriver
import ofscraper.filters.models.sort as sort
import ofscraper.filters.models.subtype as subtype
import ofscraper.models.retriver as retriver
import ofscraper.prompts.prompts as prompts
import ofscraper.utils.args.read as read_args
import ofscraper.utils.args.write as write_args
Expand All @@ -19,7 +19,9 @@


def get_model_fromParsed(name):
modelObjs = list(filter(lambda x: x.name == name, PARSED_SUBS))
if not ALL_SUBS:
all_subs_helper()
modelObjs = list(filter(lambda x: x.name == name, ALL_SUBS))
return modelObjs[0] if len(modelObjs) > 0 else None


Expand Down
2 changes: 1 addition & 1 deletion ofscraper/prompts/prompt_groups/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from prompt_toolkit.shortcuts import prompt as prompt
from rich.console import Console

import ofscraper.filters.models.selector as userselector
import ofscraper.models.selector as userselector
import ofscraper.prompts.model_helpers as modelHelpers
import ofscraper.prompts.prompt_strings as prompt_strings
import ofscraper.prompts.prompt_validators as prompt_validators
Expand Down
5 changes: 4 additions & 1 deletion ofscraper/utils/context/run_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

def run(coro):
def inner(*args, **kwargs):
loop = asyncio.new_event_loop()
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
tasks = loop.run_until_complete(coro(*args, **kwargs))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["datawhores <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.11,<=3.13"
python = ">=3.11,<3.13"


httpx = { extras = ["http2"], version = "^0.23.3" }
Expand Down

0 comments on commit 323620b

Please sign in to comment.