diff --git a/boofilsic/settings.py b/boofilsic/settings.py index 41be0c99..0ee56d36 100644 --- a/boofilsic/settings.py +++ b/boofilsic/settings.py @@ -11,8 +11,7 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os -import requests -import psycopg2.extensions + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -299,7 +298,6 @@ GOOGLE_API_KEY = '***REMOVED***' # IGDB IGDB_CLIENT_ID = 'deadbeef' IGDB_CLIENT_SECRET = 'deadbeef' -IGDB_ACCESS_TOKEN = requests.post(f'https://id.twitch.tv/oauth2/token?client_id={IGDB_CLIENT_ID}&client_secret={IGDB_CLIENT_SECRET}&grant_type=client_credentials').json()['access_token'] # Thumbnail setting # It is possible to optimize the image size even more: https://easy-thumbnails.readthedocs.io/en/latest/ref/optimize/ @@ -361,3 +359,10 @@ TYPESENSE_CONNECTION = { }], 'connection_timeout_seconds': 2 } + +DOWNLOADER_RETRIES = 3 +DOWNLOADER_SAVEDIR = None +ENABLE_NEW_MODEL = os.getenv('new_data_model') +if ENABLE_NEW_MODEL: + INSTALLED_APPS.append('polymorphic') + INSTALLED_APPS.append('catalog.apps.CatalogConfig') diff --git a/catalog/management/commands/cat.py b/catalog/management/commands/cat.py index 1f3ed236..1854c08b 100644 --- a/catalog/management/commands/cat.py +++ b/catalog/management/commands/cat.py @@ -17,6 +17,7 @@ class Command(BaseCommand): self.stdout.write(self.style.ERROR(f'Unknown site for {url}')) return self.stdout.write(f'Fetching from {site}') - resource = site.get_resource_ready(auto_link=False, auto_save=False) + resource = site.scrape() self.stdout.write(self.style.SUCCESS(f'Done.')) pprint.pp(resource.metadata) + pprint.pp(resource.lookup_ids)