From 4d9a30c5f5be22233ecccd83d0651f1b0e4c2056 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 1 Sep 2022 16:17:36 +0300 Subject: [PATCH] Download and update datasets script --- fmn_bot.py | 4 +--- update_imdb_database.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 update_imdb_database.py diff --git a/fmn_bot.py b/fmn_bot.py index bc8e30e..a6ace1c 100644 --- a/fmn_bot.py +++ b/fmn_bot.py @@ -5,11 +5,9 @@ import logging def main(): - # imdb_datasets_worker.convert_datasets_to_db() - logging.basicConfig(level=logger_default_level) - #listener_mention.run_scan_notif() # Слушаем упоминания в фоне + listener_mention.run_scan_notif() # Слушаем упоминания в фоне listener_context.scan_context_thread() # Слушаем тред на новые предложения фильмов diff --git a/update_imdb_database.py b/update_imdb_database.py new file mode 100644 index 0000000..e3e5b5b --- /dev/null +++ b/update_imdb_database.py @@ -0,0 +1,19 @@ +from src import imdb_datasets_worker +import requests + + +def download_imdb_datasets(): + print('Downloading title.basics.tsv.gz ...') + r = requests.get('https://datasets.imdbws.com/title.basics.tsv.gz') + with open('title.basics.tsv.gz', 'wb') as basics: + basics.write(r.content) + del r + print('Downloading title.akas.tsv.gz ...') + r = requests.get('https://datasets.imdbws.com/title.akas.tsv.gz') + with open('title.akas.tsv.gz', 'wb') as akas: + akas.write(r.content) + del r + + +download_imdb_datasets() +imdb_datasets_worker.convert_datasets_to_db()