Clean up imports
This commit is contained in:
@ -1,11 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from music.models import Track
|
||||||
from vrobbler.apps.scrobbles.models import Scrobble
|
from podcasts.models import Episode
|
||||||
from vrobbler.apps.music.models import Track
|
from scrobbles.models import Scrobble
|
||||||
from vrobbler.apps.podcasts.models import Episode
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from vrobbler.apps.videos.imdb import lookup_video_from_imdb
|
from videos.imdb import lookup_video_from_imdb
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Need to sort out third party API testing")
|
@pytest.mark.skip(reason="Need to sort out third party API testing")
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.db.models import Count, Q, QuerySet
|
from django.db.models import Count, Q, QuerySet
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from music.models import Artist, Track
|
from profiles.utils import now_user_timezone
|
||||||
from scrobbles.models import Scrobble
|
from scrobbles.models import Scrobble
|
||||||
from videos.models import Video
|
from videos.models import Video
|
||||||
from vrobbler.apps.profiles.utils import now_user_timezone
|
|
||||||
|
|
||||||
|
|
||||||
def scrobble_counts(user=None):
|
def scrobble_counts(user=None):
|
||||||
|
|||||||
@ -16,7 +16,7 @@ from scrobbles.utils import check_scrobble_for_finish
|
|||||||
from sports.models import SportEvent
|
from sports.models import SportEvent
|
||||||
from videos.models import Series, Video
|
from videos.models import Series, Video
|
||||||
|
|
||||||
from vrobbler.apps.profiles.utils import (
|
from profiles.utils import (
|
||||||
end_of_day,
|
end_of_day,
|
||||||
end_of_month,
|
end_of_month,
|
||||||
end_of_week,
|
end_of_week,
|
||||||
@ -24,7 +24,7 @@ from vrobbler.apps.profiles.utils import (
|
|||||||
start_of_month,
|
start_of_month,
|
||||||
start_of_week,
|
start_of_week,
|
||||||
)
|
)
|
||||||
from vrobbler.apps.scrobbles.stats import build_charts
|
from scrobbles.stats import build_charts
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|||||||
@ -5,16 +5,16 @@ from dateutil.parser import parse
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from music.constants import JELLYFIN_POST_KEYS
|
from music.constants import JELLYFIN_POST_KEYS
|
||||||
from music.models import Track
|
from music.models import Track
|
||||||
from podcasts.models import Episode
|
from music.utils import (
|
||||||
from scrobbles.models import Scrobble
|
|
||||||
from scrobbles.utils import convert_to_seconds, parse_mopidy_uri
|
|
||||||
from videos.models import Video
|
|
||||||
from sports.models import SportEvent
|
|
||||||
from vrobbler.apps.music.utils import (
|
|
||||||
get_or_create_album,
|
get_or_create_album,
|
||||||
get_or_create_artist,
|
get_or_create_artist,
|
||||||
get_or_create_track,
|
get_or_create_track,
|
||||||
)
|
)
|
||||||
|
from podcasts.models import Episode
|
||||||
|
from scrobbles.models import Scrobble
|
||||||
|
from scrobbles.utils import convert_to_seconds, parse_mopidy_uri
|
||||||
|
from sports.models import SportEvent
|
||||||
|
from videos.models import Video
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,7 @@ from scrobbles.models import (
|
|||||||
KoReaderImport,
|
KoReaderImport,
|
||||||
LastFmImport,
|
LastFmImport,
|
||||||
)
|
)
|
||||||
|
from scrobbles.stats import build_yesterdays_charts_for_user
|
||||||
from vrobbler.apps.scrobbles.stats import build_yesterdays_charts_for_user
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|||||||
@ -17,7 +17,7 @@ from django.views.decorators.csrf import csrf_exempt
|
|||||||
from django.views.generic import DetailView, FormView, TemplateView
|
from django.views.generic import DetailView, FormView, TemplateView
|
||||||
from django.views.generic.edit import CreateView
|
from django.views.generic.edit import CreateView
|
||||||
from django.views.generic.list import ListView
|
from django.views.generic.list import ListView
|
||||||
from music.aggregators import scrobble_counts, week_of_scrobbles
|
from music.aggregators import live_charts, scrobble_counts, week_of_scrobbles
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.decorators import (
|
from rest_framework.decorators import (
|
||||||
api_view,
|
api_view,
|
||||||
@ -57,8 +57,6 @@ from scrobbles.tasks import (
|
|||||||
from sports.thesportsdb import lookup_event_from_thesportsdb
|
from sports.thesportsdb import lookup_event_from_thesportsdb
|
||||||
from videos.imdb import lookup_video_from_imdb
|
from videos.imdb import lookup_video_from_imdb
|
||||||
|
|
||||||
from vrobbler.apps.music.aggregators import live_charts
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -157,6 +157,7 @@ if TESTING:
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": dj_database_url.config(default="sqlite:///testdb.sqlite3")
|
"default": dj_database_url.config(default="sqlite:///testdb.sqlite3")
|
||||||
}
|
}
|
||||||
|
|
||||||
db_str = ""
|
db_str = ""
|
||||||
if 'sqlite' in DATABASES['default']['ENGINE']:
|
if 'sqlite' in DATABASES['default']['ENGINE']:
|
||||||
db_str = f"Connected to sqlite@{DATABASES['default']['NAME']}"
|
db_str = f"Connected to sqlite@{DATABASES['default']['NAME']}"
|
||||||
|
|||||||
Reference in New Issue
Block a user