19
19
from bdfr .configuration import Configuration
20
20
from bdfr .connector import RedditConnector
21
21
from bdfr .exceptions import ArchiverError
22
+ from bdfr .progress_bar import Progress
22
23
from bdfr .resource import Resource
23
24
24
25
logger = logging .getLogger (__name__ )
@@ -29,7 +30,9 @@ def __init__(self, args: Configuration, logging_handlers: Iterable[logging.Handl
29
30
super ().__init__ (args , logging_handlers )
30
31
31
32
def download (self ) -> None :
33
+ progress = Progress (self .args .progress_bar , len (self .reddit_lists ))
32
34
for generator in self .reddit_lists :
35
+ progress .subreddit_new (generator )
33
36
try :
34
37
for submission in generator :
35
38
try :
@@ -40,18 +43,22 @@ def download(self) -> None:
40
43
f"Submission { submission .id } in { submission .subreddit .display_name } skipped due to"
41
44
f" { submission .author .name if submission .author else 'DELETED' } being an ignored user"
42
45
)
46
+ progress .post_done (submission , False )
43
47
continue
44
48
if submission .id in self .excluded_submission_ids :
45
49
logger .debug (f"Object { submission .id } in exclusion list, skipping" )
50
+ progress .post_done (submission , False )
46
51
continue
47
52
logger .debug (f"Attempting to archive submission { submission .id } " )
48
53
self .write_entry (submission )
54
+ progress .post_done (submission , True )
49
55
except prawcore .PrawcoreException as e :
50
56
logger .error (f"Submission { submission .id } failed to be archived due to a PRAW exception: { e } " )
51
57
except prawcore .PrawcoreException as e :
52
58
logger .error (f"The submission after { submission .id } failed to download due to a PRAW exception: { e } " )
53
59
logger .debug ("Waiting 60 seconds to continue" )
54
60
sleep (60 )
61
+ progress .subreddit_done ()
55
62
56
63
def get_submissions_from_link (self ) -> list [list [praw .models .Submission ]]:
57
64
supplied_submissions = []
0 commit comments