From 8356934bb6c46447056d062497094532a70d18c6 Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 29 Oct 2024 22:32:10 +0300 Subject: [PATCH] undo video migration for posts with snappy on rdrama --- files/helpers/cron.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 795daa9d0..9651ddd73 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -119,6 +119,7 @@ def cron_fn(every_5m, every_1d, every_1mo, every_2mo, manual): if manual: _get_real_sizes() + _undo_video_migration() g.db.commit() except: @@ -533,4 +534,44 @@ def _get_real_sizes(): except FileNotFoundError: for media_usage in media.usages: g.db.delete(media_usage) - g.db.delete(media) \ No newline at end of file + g.db.delete(media) + +def _undo_video_migration(): + body_archiveorg_link_regex = re.compile(r'\* \[archive.org\]\(https://web.archive.org/(.*?)\)', flags=re.A) + body_html_archiveorg_link_regex = re.compile(r'
  • \n?