def __init__(self, user_list, subreddit_list, queue, unfinished_downloads_list):
"""
Class that does the main part of the work for the program. This class contains the praw instance that is used
for actually extracting the content from reddit. When an instance is created all settings parameters must be
supplied to the instance. This class also calls the necessary functions of the other classes and completes the
downloads.
:param user_list: The actual list of User objects contained in the user ListModel class displayed in the GUI
:param subreddit_list: The actual list of Subreddit objects contained in the subreddit ListModel class displayed
in the GUI. If this class is initialized to only run a user list, this parameter is None
:param queue: The queue that text is added to in order to update the GUI
The rest of teh parameters are all configuration options that are set in the settings dialog
"""
super().__init__()
self._r = praw.Reddit(user_agent='python:DownloaderForReddit:%s (by /u/MalloyDelacroix)' % __version__,
client_id='frGEUVAuHGL2PQ', client_secret=None)
self.settings_manager = Core.Injector.get_settings_manager()
self.user_list = user_list
self.subreddit_list = subreddit_list
self.queue = queue
self.validated_objects = Queue()
self.validated_subreddits = []
self.failed_downloads = []
self.downloaded_users = {}
self.unfinished_downloads = []
self.user_run = True if self.user_list is not None else False
self.post_limit = self.settings_manager.post_limit
self.save_path = self.settings_manager.save_directory
self.subreddit_sort_method = self.settings_manager.subreddit_sort_method
self.subreddit_sort_top_method = self.settings_manager.subreddit_sort_top_method
self.restrict_date = self.settings_manager.restrict_by_date
self.restrict_by_score = self.settings_manager.restrict_by_score
self.restrict_score_method = self.settings_manager.score_limit_operator
self.restrict_score_limit = self.settings_manager.post_score_limit
self.unfinished_downloads_list = unfinished_downloads_list
self.load_undownloaded_content = self.settings_manager.save_undownloaded_content
self.queued_posts = Queue()
self.run = True
self.start_extractor()
self.start_downloader()
self.download_number = 0
RedditExtractor.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录