Skip to content

Commit 20d54d5

Browse files
committed
feat: total revamp of progress system
1 parent 79a8dec commit 20d54d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1093
-1182
lines changed

ofscraper/commands/check.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,12 @@ def post_checker():
248248
@run
249249
async def post_check_runner():
250250
async for user_name, model_id, final_post_array in post_check_retriver():
251-
with progress_utils.setup_api_split_progress_live(revert=True):
252-
progress_updater.update_activity_task(
251+
with progress_utils.setup_live("api"):
252+
progress_updater.activity.update_task(
253253
description=check_str.format(
254254
username=user_name, activity="Timeline posts"
255-
)
255+
),
256+
visible=True
256257
)
257258
await process_post_media(user_name, model_id, final_post_array)
258259
await make_changes_to_content_tables(
@@ -452,9 +453,10 @@ def message_checker():
452453
@run
453454
async def message_checker_runner():
454455
async for user_name, model_id, final_post_array in message_check_retriver():
455-
with progress_utils.setup_api_split_progress_live(revert=True):
456-
progress_updater.update_activity_task(
457-
description=check_str.format(username=user_name, activity="Messages")
456+
with progress_utils.setup_live("api"):
457+
progress_updater.activity.update_task(
458+
description=check_str.format(username=user_name, activity="Messages"),
459+
visible=True
458460
)
459461
await process_post_media(user_name, model_id, final_post_array)
460462
await make_changes_to_content_tables(
@@ -525,11 +527,12 @@ def purchase_checker():
525527
@run
526528
async def purchase_checker_runner():
527529
async for user_name, model_id, final_post_array in purchase_check_retriver():
528-
with progress_utils.setup_api_split_progress_live(revert=True):
529-
progress_updater.update_activity_task(
530+
with progress_utils.setup_live("api"):
531+
progress_updater.activity.update_task(
530532
description=check_str.format(
531533
username=user_name, activity="Purchased posts"
532-
)
534+
),
535+
visible=True
533536
)
534537
await process_post_media(user_name, model_id, final_post_array)
535538
await make_changes_to_content_tables(
@@ -582,8 +585,8 @@ def stories_checker():
582585
@run
583586
async def stories_checker_runner():
584587
async for user_name, model_id, final_post_array in stories_check_retriver():
585-
with progress_utils.setup_api_split_progress_live(revert=True):
586-
progress_updater.update_activity_task(
588+
with progress_utils.setup_live("api"):
589+
progress_updater.activity.update_task(
587590
description=check_str.format(
588591
username=user_name, activity="Stories posts"
589592
)

ofscraper/commands/manual.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def manual_download(urls=None):
4545
log.warning("No valid data found from the provided URLs.")
4646
return
4747

48-
with progress_utils.setup_activity_progress_live():
48+
with progress_utils.setup_live("manual"):
4949
# Consolidate media and posts from all processed collections
5050
all_media = [
5151
item
@@ -67,16 +67,16 @@ def manual_download(urls=None):
6767
set_user_data(url_dicts)
6868

6969
for _, value in url_dicts.items():
70-
with progress_utils.setup_activity_progress_live():
7170
collection = value["collection"]
7271
model_id = collection.model_id
7372
username = collection.username
7473
media=collection.all_unique_media
7574
posts=collection.posts
7675

7776
log.info(download_manual_str.format(username=username))
78-
progress_updater.update_activity_task(
79-
description=download_manual_str.format(username=username)
77+
progress_updater.activity.update_task(
78+
description=download_manual_str.format(username=username),
79+
visible=True
8080
)
8181

8282
operations.table_init_create(model_id=model_id, username=username)
@@ -126,10 +126,11 @@ def process_urls(urls):
126126
"unknown": unknown_type_helper,
127127
}
128128

129-
with progress_utils.setup_api_split_progress_live(revert=False):
129+
with progress_utils.setup_live("api"):
130130
for url in url_helper(urls):
131-
progress_updater.update_activity_task(
132-
description=post_str_manual.format(url=url)
131+
progress_updater.activity.update_task(
132+
description=post_str_manual.format(url=url),
133+
visible=True
133134
)
134135

135136
model_id, post_id, api_type = get_info(url)

ofscraper/commands/metadata/consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ async def consumer(aws, task1, medialist, lock):
7070
)
7171
log_download_progress(media_type)
7272

73-
progress_updater.update_metadata_task(
73+
progress_updater.metadata.update_overall_task(
7474
task1,
7575
description=desc.format(
7676
p_count=common_globals.photo_count,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
desc = "Progress: ({p_count} photos, {v_count} videos, {a_count} audios, {forced_skipped} skipped, {skipped} failed || {sumcount}/{mediacount})"
1+
desc = "Metadata Progress: ({p_count} photos, {v_count} videos, {a_count} audios, {forced_skipped} not changed, {skipped} failed || {sumcount}/{mediacount})"

0 commit comments

Comments
 (0)