From 90b7be286c3859af6f40baf6b0c95828c78e29fe Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sat, 4 Mar 2023 16:04:52 -0500 Subject: [PATCH] Move lookup modules to approp app --- tests/scrobbles_tests/test_views.py | 6 +++--- tests/videos_tests/__init__.py | 0 tests/{scrobbles_tests => videos_tests}/test_imdb.py | 2 +- vrobbler/apps/{scrobbles => books}/koreader.py | 0 vrobbler/apps/{scrobbles => music}/lastfm.py | 0 vrobbler/apps/music/models.py | 3 +-- vrobbler/apps/{scrobbles => music}/musicbrainz.py | 0 vrobbler/apps/{scrobbles => music}/theaudiodb.py | 0 vrobbler/apps/music/utils.py | 2 +- vrobbler/apps/scrobbles/models.py | 4 ++-- vrobbler/apps/scrobbles/views.py | 4 ++-- vrobbler/apps/{scrobbles => sports}/thesportsdb.py | 0 vrobbler/apps/{scrobbles => videos}/imdb.py | 0 13 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 tests/videos_tests/__init__.py rename tests/{scrobbles_tests => videos_tests}/test_imdb.py (83%) rename vrobbler/apps/{scrobbles => books}/koreader.py (100%) rename vrobbler/apps/{scrobbles => music}/lastfm.py (100%) rename vrobbler/apps/{scrobbles => music}/musicbrainz.py (100%) rename vrobbler/apps/{scrobbles => music}/theaudiodb.py (100%) rename vrobbler/apps/{scrobbles => sports}/thesportsdb.py (100%) rename vrobbler/apps/{scrobbles => videos}/imdb.py (100%) diff --git a/tests/scrobbles_tests/test_views.py b/tests/scrobbles_tests/test_views.py index bfbc2cf..8c37223 100644 --- a/tests/scrobbles_tests/test_views.py +++ b/tests/scrobbles_tests/test_views.py @@ -3,9 +3,9 @@ import pytest from django.urls import reverse -from scrobbles.models import Scrobble -from music.models import Track -from podcasts.models import Episode +from vrobbler.apps.scrobbles.models import Scrobble +from vrobbler.apps.music.models import Track +from vrobbler.apps.podcasts.models import Episode @pytest.mark.django_db diff --git a/tests/videos_tests/__init__.py b/tests/videos_tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/scrobbles_tests/test_imdb.py b/tests/videos_tests/test_imdb.py similarity index 83% rename from tests/scrobbles_tests/test_imdb.py rename to tests/videos_tests/test_imdb.py index 424fb4b..cbe49b7 100644 --- a/tests/scrobbles_tests/test_imdb.py +++ b/tests/videos_tests/test_imdb.py @@ -1,6 +1,6 @@ import pytest -from vrobbler.apps.scrobbles.imdb import lookup_video_from_imdb +from vrobbler.apps.videos.imdb import lookup_video_from_imdb @pytest.mark.skip(reason="Need to sort out third party API testing") diff --git a/vrobbler/apps/scrobbles/koreader.py b/vrobbler/apps/books/koreader.py similarity index 100% rename from vrobbler/apps/scrobbles/koreader.py rename to vrobbler/apps/books/koreader.py diff --git a/vrobbler/apps/scrobbles/lastfm.py b/vrobbler/apps/music/lastfm.py similarity index 100% rename from vrobbler/apps/scrobbles/lastfm.py rename to vrobbler/apps/music/lastfm.py diff --git a/vrobbler/apps/music/models.py b/vrobbler/apps/music/models.py index 1726889..9f5c03f 100644 --- a/vrobbler/apps/music/models.py +++ b/vrobbler/apps/music/models.py @@ -12,8 +12,7 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ from django_extensions.db.models import TimeStampedModel from scrobbles.mixins import ScrobblableMixin -from scrobbles.theaudiodb import lookup_artist_from_tadb -from vrobbler.apps.scrobbles.theaudiodb import lookup_album_from_tadb +from music.theaudiodb import lookup_artist_from_tadb, lookup_album_from_tadb logger = logging.getLogger(__name__) BNULL = {"blank": True, "null": True} diff --git a/vrobbler/apps/scrobbles/musicbrainz.py b/vrobbler/apps/music/musicbrainz.py similarity index 100% rename from vrobbler/apps/scrobbles/musicbrainz.py rename to vrobbler/apps/music/musicbrainz.py diff --git a/vrobbler/apps/scrobbles/theaudiodb.py b/vrobbler/apps/music/theaudiodb.py similarity index 100% rename from vrobbler/apps/scrobbles/theaudiodb.py rename to vrobbler/apps/music/theaudiodb.py diff --git a/vrobbler/apps/music/utils.py b/vrobbler/apps/music/utils.py index 880b83e..bafd2ad 100644 --- a/vrobbler/apps/music/utils.py +++ b/vrobbler/apps/music/utils.py @@ -3,7 +3,7 @@ import re from musicbrainzngs.caa import musicbrainz -from scrobbles.musicbrainz import ( +from music.musicbrainz import ( lookup_album_dict_from_mb, lookup_artist_from_mb, lookup_track_from_mb, diff --git a/vrobbler/apps/scrobbles/models.py b/vrobbler/apps/scrobbles/models.py index 236ba47..6660469 100644 --- a/vrobbler/apps/scrobbles/models.py +++ b/vrobbler/apps/scrobbles/models.py @@ -9,9 +9,9 @@ from django.db import models from django.urls import reverse from django.utils import timezone from django_extensions.db.models import TimeStampedModel +from music.lastfm import LastFM from music.models import Artist, Track from podcasts.models import Episode -from scrobbles.lastfm import LastFM from scrobbles.utils import check_scrobble_for_finish from sports.models import SportEvent from videos.models import Series, Video @@ -144,7 +144,7 @@ class KoReaderImport(BaseFileImportMixin): sqlite_file = models.FileField(upload_to=get_path, **BNULL) def process(self, force=False): - from scrobbles.koreader import process_koreader_sqlite_file + from books.koreader import process_koreader_sqlite_file if self.processed_finished and not force: logger.info( diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index a567b6e..2948943 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -34,7 +34,6 @@ from scrobbles.constants import ( ) from scrobbles.export import export_scrobbles from scrobbles.forms import ExportScrobbleForm, ScrobbleForm -from scrobbles.imdb import lookup_video_from_imdb from scrobbles.models import ( AudioScrobblerTSVImport, ChartRecord, @@ -55,7 +54,8 @@ from scrobbles.tasks import ( process_lastfm_import, process_tsv_import, ) -from scrobbles.thesportsdb import lookup_event_from_thesportsdb +from sports.thesportsdb import lookup_event_from_thesportsdb +from videos.imdb import lookup_video_from_imdb from vrobbler.apps.music.aggregators import live_charts diff --git a/vrobbler/apps/scrobbles/thesportsdb.py b/vrobbler/apps/sports/thesportsdb.py similarity index 100% rename from vrobbler/apps/scrobbles/thesportsdb.py rename to vrobbler/apps/sports/thesportsdb.py diff --git a/vrobbler/apps/scrobbles/imdb.py b/vrobbler/apps/videos/imdb.py similarity index 100% rename from vrobbler/apps/scrobbles/imdb.py rename to vrobbler/apps/videos/imdb.py