def main(): app = QApplication(sys.argv) rddtDataExtractor = loadState() if rddtDataExtractor is None: rddtDataExtractor = RedditDataExtractor() rddtDataExtractor.currentlyDownloading = False # If something weird happened to cause currentlyDownloading to be saved as True, set it back to False queue = Queue() thread = QThread() recv = QueueMessageReceiver(queue) mainGUIWindow = RddtDataExtractorGUI(rddtDataExtractor, queue, recv) recv.queuePutSignal.connect(mainGUIWindow.append_text) recv.moveToThread(thread) thread.started.connect(recv.run) # Add clean up finished signals so the threads end appropriately when the program ends recv.finished.connect(thread.quit) recv.finished.connect(recv.deleteLater) thread.finished.connect(thread.deleteLater) # start the receiver thread.start() # show the GUI mainGUIWindow.show() # display Imgur API pop up if not hidden by user and client-id isn't set if rddtDataExtractor.showImgurAPINotification and rddtDataExtractor.imgurAPIClientID is None: mainGUIWindow.notifyImgurAPI() # and wait for the user to exit sys.exit(app.exec_())
def setUp(self): self.app = QApplication(sys.argv) rddtDataExtractor = RedditDataExtractor() rddtDataExtractor.defaultPath = pathlib.Path('Downloads') if not rddtDataExtractor.defaultPath.exists(): rddtDataExtractor.defaultPath.mkdir() rddtDataExtractor.defaultPath = rddtDataExtractor.defaultPath.resolve() queue = Queue() self.thread = QThread() self.recv = QueueMessageReceiver(queue) w = redditDataExtractorGUI.RddtDataExtractorGUI(rddtDataExtractor, queue, self.recv) self.recv.queuePutSignal.connect(w.append_text) self.recv.moveToThread(self.thread) self.thread.started.connect(self.recv.run) self.recv.finished.connect(self.thread.quit) self.recv.finished.connect(self.recv.deleteLater) self.thread.finished.connect(self.thread.deleteLater) self.thread.start() self.form = w
def main(): app = QApplication(sys.argv) rddtDataExtractor = loadState() if rddtDataExtractor is None: rddtDataExtractor = RedditDataExtractor() else: # If something weird happened to cause currentlyDownloading to be saved as True, set it back to False rddtDataExtractor.currentlyDownloading = False # reinstantiate the praw instance because it doesn't shelve properly # praw shelve issue causes http.validate_certs to be uninstantiated rddtDataExtractor._r = praw.Reddit( user_agent='Data Extractor for reddit v1.1 by /u/VoidXC') rddtDataExtractor._r.http.validate_certs = 'RedditDataExtractor/cacert.pem' queue = Queue() thread = QThread() recv = QueueMessageReceiver(queue) mainGUIWindow = RddtDataExtractorGUI(rddtDataExtractor, queue, recv) recv.queuePutSignal.connect(mainGUIWindow.append_text) recv.moveToThread(thread) thread.started.connect(recv.run) # Add clean up finished signals so the threads end appropriately when the program ends recv.finished.connect(thread.quit) recv.finished.connect(recv.deleteLater) thread.finished.connect(thread.deleteLater) # start the receiver thread.start() # show the GUI mainGUIWindow.show() # display Imgur API pop up if not hidden by user and client-id isn't set if rddtDataExtractor.showImgurAPINotification and rddtDataExtractor.imgurAPIClientID is None: mainGUIWindow.notifyImgurAPI() # and wait for the user to exit sys.exit(app.exec_())
def setUp(self): self.app = QApplication(sys.argv) rddtDataExtractor = RedditDataExtractor() rddtDataExtractor.defaultPath = pathlib.Path('Downloads') if not rddtDataExtractor.defaultPath.exists(): rddtDataExtractor.defaultPath.mkdir() rddtDataExtractor.defaultPath = rddtDataExtractor.defaultPath.resolve() queue = Queue() self.thread = QThread() self.recv = QueueMessageReceiver(queue) w = redditDataExtractorGUI.RddtDataExtractorGUI( rddtDataExtractor, queue, self.recv) self.recv.queuePutSignal.connect(w.append_text) self.recv.moveToThread(self.thread) self.thread.started.connect(self.recv.run) self.recv.finished.connect(self.thread.quit) self.recv.finished.connect(self.recv.deleteLater) self.thread.finished.connect(self.thread.deleteLater) self.thread.start() self.form = w self.externalImageHashes = { '2b8tbe 1.webm': b'\xc3\xea\x97"?,A\xd9\xda\x7f4\xa8\x92\x80\xc2\xd6\\\x04\x8a\xa9iK\xdb\xf3\xd5\x90\xcf\n\xf5\x94\x15\x06', '2b9cfw 5.jpg': b'\xa2\x91Y\xbez\x9d\x8c\x03\x18\xa5\x83\\\xde${\xce\xe5M\x88~4\xfe2\x1a,\xe5\x10:\x07\xb9\xad\xf3', '2b8nag 4.jpg': b'\tW\xd6\xc5\t\xa7\xe1\xb2\xa2\xb5\x15\xad<L\x86m\x10\xa0\xab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x1a3\xb4\x84C4@\xef;\x8a', '2b9dm4 1.jpg': b'P\x13\x16\xca\xb1n}\xcc\x902\xd4%uXR\xc2B\xbec\x84~\xe9c\xf6Qh\x84\x82\xee\xca\xb3\xd9', '2b8uyr 1.webm': b'\xd6\x07r\xd0\xbbo\x12\xd1\x1b\x07\xa8:\xbf[ r\xabn<t\xa5\x84\xe3\xd4Vy_\x8e\x15\x1b\xf4<', '2b8s5r 1.gif': b';\x88\xe6\xf7\x038\xa3\x89\xd1\xe0\xf2\x8e\x01\x9e\xec\x1d8\x8b\x15*\x0e\xda\x0b\xd9\tAl\xa9,\x07\xa5D', '2b9cfw 2.jpg': b'8A\xb3\xf0\x889\x7f\xec\xa37\x10ElFD\xa4\xee\xde\xd1\xc4OI\\|\x99U\x9d\xa6\x8ev\x9e\xe9', '2b83a2 1.jpg': b'=\xaa\xae:\xc7\xa2K \xceT\xc6\x88\xd1\x84\xa1\x11\xdc^!\x94\x04shu\xfb\x9d7\x89\xbaE\xc4\xf5', '2b8w9y 1.gif': b'I\x96\x85n\xfe\xa6\x8a\xe9\xde\xffzp\x82\x17\xd8\x1e\x00\xefD<\x01\xf0[9 F\x85\x83S\xdb;7', '2b8wdl 1.gif': b'h\xd7;\r\x1a\xf9_\xa0\x04\x85(\x86\x18/!*#\x18\xca\xe9\xcc\x99\x17\xfbI\x80\x80\xd9f\xc5\x85 ', '3c51k9 1.gif': b'P\x99\xb7`)\xc1\x15\xb1?\rR\x0e\xe4\xe0:H\xbdB\xf3<\x9f\x08\xd4\xa5\xeb\xc2\xa8l\r}h\x1c', '3c53r1 1.webm': b'O\x144\x8d\x04h\xe8\xc4\xd6-\x02\x85 \xf4cI\xb5\xd3\xd8\xe4\xa8\x85\rJ\x9f0\xf5\x92O"e\xbe' } self.externalCommentImageHashes = { '2bby9l_comment_1 1.webm': b'\x0cN\xe1\x96\x1eo\xc8r3A\xbf{:\xba\xfa\x90\xcd\x95\xd1\xa1\xaa\xe03fP\xcb\xf6~\xfa\x9c\xd0\x07', '2bby9l_comment_2 1.gif': b'\xe7\xca\xa6\xe9\x0f\xb7ZPE\x82{\x9b\xd4V\x15M\x815\xa4i\xf3\xb5\xbd\xa5\xbbf@yz\xd7!\xe8', '2bby9l_comment_3 1.jpg': b'\xa6\xc8p\x86\t\x0c\xef\xf1d\x8c\x93S\x94\xa6\xa3\xf0a\x7fp\xac\xe2\xd3Q\x17\x06\xd3\xbf)P\xfb\xf8\xf7', '2bby9l_comment_4 1.gif': b'\x03\xba\xa8\xdeC\xd1\xba\xb4\x84\xad[d]\x16\xff\x11\xa3\xbeb/\xbc\xfd\xa3C\xa32l\xfd\xe8y\x10h', '2bby9l_comment_4 2.gif': b'4\x86rl/CAq6Bn\xe8\xbc\x1fb5ie\x1c$\x88!\xb8\x9fw\x8cP\xadYs\x9bF', '2b8uyr_comment_1 1.webm': b'\xd6\x07r\xd0\xbbo\x12\xd1\x1b\x07\xa8:\xbf[ r\xabn<t\xa5\x84\xe3\xd4Vy_\x8e\x15\x1b\xf4<', '2cebx6_comment_1 1_00001.mp4': b'@\xf0\xe7"\x8e[e\xdb\xea\x9c\x9f\xd5\x004q\xf8\x1d\xa6\xcc\\\xe8pfu\xc5\xa4O\xffsU2\x87', '2bcnhu_comment_1 1.jpg': b'\xd5r8\xb0e\x7f\\M\xbe\x14\xe7\x13\xcd\xe4};s\xe0\x1ad\x14\x9b(H\xb1\\[/\x1b\x9b\xe8\xbe' } self.externalSelftextImageHashes = { '2bcokj_selftext_2 1.png': b"\xba\xe37g\xb1\x8f\x97\xdc\xdeB\x12S\x12\xd7\xa1\xc2g\xfbL\x18\xf698R\xa3\x06?\x0b'V\xb0\xa1", '2bcma6_selftext_1 1.jpg': b'\x16m\x81\x81I\x00\xa9\xd2d\xe7\xb1\xd8_o\xf9\xb8\xb1\x9ej<\xb0r\x03\xbae\x96g\x02\xfb\xa7\r\x19', '2bcokj_selftext_1 3.jpg': b'\xbf<\x15\x8b#\xd5\x9dZ\xa2~\x8d\xa9j\xf4\x84/\xd0K\x08-}I\xb4]9\xdc\xb3\x8d\xd1\xf9;\x95', '2bcnhu_selftext_1 1.jpg': b'+%\xf7\xc1\x8d\x14 J)\x84\xfc=\xf3\xeb\x943\xc7\xa8\xa3\xc8\xf8\xd6\x17;D;\x8f\xbe\xc2\xdc5%', '2bcokj_selftext_1 1.jpg': b'\xed\t\xd2\x02i%\xd3\x05\x8b}\x85\xb6b\x8d}\xf4J\xb6\xaa\xb6U\xadZ\xa6"_\xaf\x08\xd8[\x93}', '2bcokj_selftext_1 2.jpg': b'<\x00|M\xdca\xd5y&G\x10\xbf6\x81\xf4e\xb9\x86\xb9\xe9\xaaF\x9a\xbaS\xd0\xda\xa7^m\xba\xc0', '2cecdc_selftext_1 1_00001.mp4': b'\xdd{lG\x82h\xbbH\xf6Y~c\xc0"\xa9iq\x1d\xbd\xe2\x0c[r\\y\xa0M\x1dv\xad>\xc0' } self.userName = "******" self.userCommentExternalDownloads = { 'http://i.minus.com/iZfA0KDJtn3rp.gif', 'http://i.imgur.com/kJzROu3.jpg', 'http://i.imgur.com/9Zgw1z6.gif', 'http://i.imgur.com/QSwFyyg.gif', 'http://i.imgur.com/kLsgG6I.jpg', 'http://zippy.gfycat.com/ThankfulInfiniteAmericancrow.webm', 'http://fat.gfycat.com/UnkemptInsidiousGermanshorthairedpointer.webm', 'http://www.cnn.com/video/data/2.0/video/bestoftv/2013/09/20/ab-anthony-bourdain-parts-unknown-new-mexico-3.cnn.html' } self.userCommentRedditSubmissions = { 'https://www.reddit.com/r/reddit_data_extractor/comments/2bby9l/textpost_no_link_comments_with_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8uyr/gfycat_gif_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2bcnhu/textpost_link_comments_with_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2cebx6/selftext_no_link_comment_with_video_link/' } self.userSubmissionExternalDownloads = { 'http://i.minus.com/ibjZuvlB5STFck.gif', 'http://i.minus.com/iTML5h4UapbNx.gif', 'http://www.vidble.com/g8LQqiKCVU_med.jpg', 'http://i.imgur.com/YFSXROu.jpg', 'https://s3.amazonaws.com/br-cdn/temp_images/2014/07/04/657f7564a8d7785b8747311b3275abaf.gif?1404508284', 'http://i.imgur.com/OK2RXHQ.jpg', 'http://www.vidble.com/9LPShmlZOn.jpg', 'http://www.vidble.com/LckxM9EYoH_med.jpg', 'http://i.imgur.com/VDjOWMx.jpg', 'http://www.vidble.com/rmiqXMbpPm_med.jpg', 'http://zippy.gfycat.com/ThinVastErin.webm', 'http://www.vidble.com/LZNUFKV1ot_med.jpg', 'http://www.vidble.com/8qzzbdcwJc_med.jpg', 'http://i.imgur.com/gxePU46.jpg', 'http://www.vidble.com/wjDwGwuuKB.gif', 'http://zippy.gfycat.com/RightIndelibleCottonmouth.webm', 'http://i.imgur.com/2wtfRlv.jpg', 'http://i.imgur.com/VpxANpN.gif', 'http://i.imgur.com/X8fICEo.jpg', 'http://fat.gfycat.com/UnkemptInsidiousGermanshorthairedpointer.webm', 'https://www.youtube.com/watch?v=hpigjnKl7nI', 'http://i.imgur.com/7i4vIHl.gif', 'http://i.imgur.com/ZndFj3U.webm' } self.userSubmissionRedditSubmissions = { 'https://www.reddit.com/r/reddit_data_extractor/comments/2vi2g9/youtube_video/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8w9y/minus_gif_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8wdl/minus_gif_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8nag/imgur_album_hashtag/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8vjl/gfycat_gif_hashtag_format/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8s5r/imgur_single_gif/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9cru/vidble_gif_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9dm4/vidble_jpg_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8tbe/gfycat_webm_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b83a2/imgur_single_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8vpe/s3_amazonaws_gif_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8uyr/gfycat_gif_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9cfw/vidble_album/', 'https://www.reddit.com/r/reddit_data_extractor/comments/3c51k9/imgur_gifv_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/3c53r1/imgur_gifv_page/' } self.userSelftextExternalDownloads = { 'http://i.imgur.com/IvvH2jQ.jpg', 'http://i.imgur.com/QnzS9se.jpg', 'http://i.imgur.com/QwxVxlY.jpg', 'http://www.vidble.com/ubq1myyQQk.jpg', 'http://i.imgur.com/T5CFNo4.jpg', 'http://i.imgur.com/v9Wfk4k.png', 'http://www.dailymotion.com/video/x22mrag_cristiano-ronaldo-amazing-goal-bayern-munich-vs-real-madrid-0-4-29-04-2014_sport' } self.userSelftextRedditSubmissions = { 'https://www.reddit.com/r/reddit_data_extractor/comments/2bcnhu/textpost_link_comments_with_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2bcokj/textpost_imgur_gallery_link_comments_without_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2bcma6/textpost_link_no_comments/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2cecdc/selftext_dailymotion_video_link_no_comments/' } self.userJSONExternalDownloads = set() self.userJSONRedditSubmissions = { 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8w9y/minus_gif_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8nag/imgur_album_hashtag/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8380/imgur_single_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2bcnhu/textpost_link_comments_with_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2bcokj/textpost_imgur_gallery_link_comments_without_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8s5r/imgur_single_gif/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9cru/vidble_gif_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9dm4/vidble_jpg_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9cfw/vidble_album/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8wdl/minus_gif_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2bby9l/textpost_no_link_comments_with_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9geu/textpost_no_link_comments_without_links/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b83a2/imgur_single_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8vpe/s3_amazonaws_gif_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b9gbo/textpost_no_link_no_comments/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8uyr/gfycat_gif_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8tbe/gfycat_webm_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2bcma6/textpost_link_no_comments/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2b8vjl/gfycat_gif_hashtag_format/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2cebx6/selftext_no_link_comment_with_video_link/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2vi2g9/youtube_video/', 'https://www.reddit.com/r/reddit_data_extractor/comments/2cecdc/selftext_dailymotion_video_link_no_comments/', 'https://www.reddit.com/r/reddit_data_extractor/comments/3c51k9/imgur_gifv_direct/', 'https://www.reddit.com/r/reddit_data_extractor/comments/3c53r1/imgur_gifv_page/', 'https://www.reddit.com/r/reddit_data_extractor/comments/3c53c6/imgur_gifv_page/' # this one was deleted... may need to remove in future } self.contentFileTypes = [ "*.jpg", "*.jpeg", "*.gif", "*.png", "*.webm", "*.mp4", "*.mkv", "*.flv", "*.gifv" ] self.jsonFileTypes = ["*.txt"]