Working and up to date. WIP misc manual actions
This commit is contained in:
		| @@ -56,6 +56,7 @@ def file_overview(file_url: str, file_attributes: list, options: dict) -> None: | ||||
|  | ||||
| def send_reaction_to_slack_thread(article, reaction): | ||||
|     """Sends the verification status as a reaction to the associated slack thread. This will significantly decrease load times of the bot""" | ||||
|     thread = article.slack_thread | ||||
|     messages = models.Message.select().where(models.Message.text.contains(article.article_url)) | ||||
|     # TODO rewrite this shit | ||||
|     if len(messages) > 5: | ||||
| @@ -74,6 +75,7 @@ def send_reaction_to_slack_thread(article, reaction): | ||||
|             ) | ||||
|             print("Sent reaction to message") | ||||
|  | ||||
|  | ||||
| def prompt_language(query): | ||||
|     not_set = True | ||||
|     while not_set: | ||||
| @@ -132,27 +134,6 @@ def accept_article(article, last_accepted): | ||||
|     # also update the threads to not be monitored anymore | ||||
|     send_reaction_to_slack_thread(article, "white_check_mark") | ||||
|  | ||||
|     """linked = None | ||||
|     try: | ||||
|         thread = message_models.Thread.get(id = last_accepted.id + 1) | ||||
|         rel = message_models.get_referenced_articles(thread, article_models.ArticleDownload) | ||||
|         assert len(rel) == 1 and rel[0] == article | ||||
|         linked = thread | ||||
|     except: # if the above, naive method (just increment by one), fails, resort to brute search. | ||||
|         print("Bruteforcing search") | ||||
|         for t in message_models.Thread.select(): | ||||
|             rel = message_models.get_referenced_articles(t, article_models.ArticleDownload) | ||||
|             if len(rel) == 1 and rel[0] == article: | ||||
|                 linked = t | ||||
|                 break | ||||
|          | ||||
|     if linked: | ||||
|         linked.initiator_message.is_processed_override = 1 | ||||
|         linked.initiator_message.save() | ||||
|         print("Message overwritten to PROCESSED") | ||||
|  | ||||
|     else: | ||||
|         print("No matching thread found")""" | ||||
|     return "" # linked | ||||
|  | ||||
|  | ||||
| @@ -176,10 +157,13 @@ def verify_unchecked(): | ||||
|             core_info.append(entry) | ||||
|          | ||||
|         try: | ||||
|             # close any previously opened windows: | ||||
|             subprocess.call("killall evince") | ||||
|             # then open a new one | ||||
|             subprocess.Popen(["evince", f"file://{os.path.join(article.save_path, article.file_name)}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||||
|             # supress evince gtk warnings | ||||
|         except Exception as e: | ||||
|             print(str(list((-1, e)))) | ||||
|             print(e) | ||||
|             continue | ||||
|  | ||||
|          | ||||
| @@ -220,66 +204,3 @@ def verify_unchecked(): | ||||
|                 proceed = True | ||||
|             else: | ||||
|                 print("Invalid input") | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| # def verify_bad(): | ||||
| #     b_options = { | ||||
| #         "ENTER":"Accept pdf as fixed", | ||||
| #         "B": "Keep pdf in BAD.", | ||||
| #         "R" : "set related files (prompted multiple times)", | ||||
| #         "C" : "Change the saved file-name and set as verified." | ||||
| #         } | ||||
| #     query = article_models.ArticleDownload.select().where(article_models.ArticleDownload.verified == -1).execute() | ||||
|  | ||||
| #     for q in query: | ||||
| #         pdf = q.file_name | ||||
| #         save_dir = get_save_path(q) | ||||
| #         fname = save_dir + "BAD/" + pdf | ||||
| #         try: | ||||
| #             subprocess.call(["xdg-open", fname]) | ||||
| #         except: | ||||
| #             print(f"[{testvar}██{testvar}] PDF moved:") | ||||
| #             print(fname) | ||||
| #             continue | ||||
|  | ||||
| #         status_pdf = f"{testvar}██{testvar}" | ||||
| #         if "just a moment" in pdf: | ||||
| #             status_pdf = f"{testvar}██{testvar}" | ||||
|          | ||||
| #         language = q.language | ||||
| #         status_language = f"{testvar}██{testvar}" | ||||
| #         if len(language) == 0: | ||||
| #             status_language = f"{testvar}██{testvar}" | ||||
|  | ||||
|  | ||||
| #         print_status_options( | ||||
| #             status=u_status.format( | ||||
| #                 url = q.article_url, | ||||
| #                 status_pdf = status_pdf, | ||||
| #                 pdf = pdf[:80], | ||||
| #                 status_language = status_language, | ||||
| #                 language = language | ||||
| #             ), | ||||
| #             options = b_options) | ||||
|  | ||||
|  | ||||
|  | ||||
| #         proceed = False | ||||
| #         while not proceed: | ||||
| #             proceed = False | ||||
| #             uin = input("Choice? ").lower() | ||||
| #             if uin == "": | ||||
| #                 unreject_article(q) | ||||
| #                 proceed = True | ||||
| #             elif uin == "b": | ||||
| #                 proceed = True | ||||
| #             elif uin == "r": | ||||
| #                 prompt_related(q) | ||||
| #             elif uin == "c": | ||||
| #                 prompt_new_fname(q) | ||||
| #                 proceed = True | ||||
| #             else: | ||||
| #                 print("Invalid input") | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Remy Moll
					Remy Moll