Skip to content

Commit

Permalink
fix check mode update mediaobjs process
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Aug 28, 2024
1 parent 5b23e9b commit 5d0da13
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
12 changes: 4 additions & 8 deletions ofscraper/commands/runners/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import ofscraper.classes.table.table as table
import ofscraper.db.operations as operations
import ofscraper.actions.actions.download.normal.downloadnormal as downloadnormal
import ofscraper.data.models.manager as manager
import ofscraper.utils.args.accessors.read as read_args
import ofscraper.utils.args.mutators.write as write_args
import ofscraper.utils.auth.request as auth_requests
Expand Down Expand Up @@ -70,7 +69,7 @@ def process_download_cart():
while not table.row_queue.empty():
try:
process_item()
except Exception:
except Exception as _:
# handle getting new downloads
None
if len(cart_dict.keys()) > 0:
Expand Down Expand Up @@ -118,6 +117,7 @@ def process_item():
post = media.post
model_id = media.post.model_id
username = media.post.username

log.info(
f"Downloading individual media ({media.filename}) to disk for {username}"
)
Expand Down Expand Up @@ -177,12 +177,8 @@ async def data_refill(media_id, post_id, target_name, model_id):
else:
return
async for username, model_id, final_post_array in retriver():
if any(
x.id == media_id and x.postid == post_id and x.username == target_name
for x in await process_post_media(username, model_id, final_post_array)
):
break

for x in await process_post_media(username, model_id, final_post_array):
ALL_MEDIA.update({"_".join([str(getattr(x, key)) for key in MEDIA_KEY]):x})
def allow_check_dupes():
args = read_args.retriveArgs()
args.force_all = True
Expand Down
7 changes: 3 additions & 4 deletions ofscraper/utils/args/parse/group_bundles/utils/check.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import functools
import arrow

import cloup as click

import ofscraper.utils.args.parse.arguments.utils.date as date_helper


def check_mode_changes(func):
@functools.wraps(func)
@click.pass_context
def wrapper(ctx, *args, **kwargs):
# fix before for check modes
ctx.params["before"] = date_helper.before_callback(ctx, ctx.params, None)

ctx.params["before"] = arrow.now().shift(days=4)
ctx.params["before_original"] = None
return func(ctx, *args, **kwargs)

return wrapper
4 changes: 3 additions & 1 deletion ofscraper/utils/logs/classes/handlers/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ def emit(self, record):
# only emit after widget is set
if self._widget is None:
return
elif record.message in log_globals.stop_codes:
elif hasattr(record, "message") and record.message in log_globals.stop_codes:
return
elif record in log_globals.stop_codes:
return
log_entry = self.format(record)
log_entry = f"{log_entry}"
Expand Down
2 changes: 2 additions & 0 deletions ofscraper/utils/logs/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def print_latest_version():

if re.search(new_version,__version__):
log.error("[bold yellow]OF-Scraper up to date[/bold yellow]")
elif __version__ =="0.0.0":
log.error("[bold yellow]OF-Scraper can't check version (probably from zip)[/bold yellow]")
elif ".dev" in __version__:
log.error("OF-Scraper up to date[/bold yellow]")
else:
Expand Down

0 comments on commit 5d0da13

Please sign in to comment.