chore: fixes after libretime_api rename

This commit is contained in:
jo 2021-12-24 00:04:30 +01:00 committed by Kyle Robbertze
parent 6de242db65
commit e84137a8ee
14 changed files with 50 additions and 50 deletions

View File

@ -119,7 +119,7 @@ If you are a developer seeking to add new columns to the database here are the s
2. Run `dev_tools/propel_generate.sh` 2. Run `dev_tools/propel_generate.sh`
3. Update the upgrade.sql under `legacy/application/controllers/upgrade_sql/VERSION` for example 3. Update the upgrade.sql under `legacy/application/controllers/upgrade_sql/VERSION` for example
`ALTER TABLE imported_podcast ADD COLUMN album_override boolean default 'f' NOT NULL;` `ALTER TABLE imported_podcast ADD COLUMN album_override boolean default 'f' NOT NULL;`
4. Update the models under `api/libretimeapi/models/` to reflect the new 4. Update the models under `api/libretime_api/models/` to reflect the new
changes. changes.
## Documentation and financial contributions ## Documentation and financial contributions

View File

@ -3,8 +3,8 @@ all: lint
include ../tools/python.mk include ../tools/python.mk
PIP_INSTALL := --editable .[dev] PIP_INSTALL := --editable .[dev]
PYLINT_ARG := libretimeapi PYLINT_ARG := libretime_api
MYPY_ARG := libretimeapi MYPY_ARG := libretime_api
format: .format format: .format
lint: .format-check .pylint .mypy lint: .format-check .pylint .mypy
@ -12,4 +12,4 @@ clean: .clean
test: $(VENV) test: $(VENV)
source $(VENV)/bin/activate source $(VENV)/bin/activate
LIBRETIME_DEBUG=True $(VENV)/bin/libretime-api test libretimeapi LIBRETIME_DEBUG=True $(VENV)/bin/libretime-api test libretime_api

View File

@ -36,12 +36,12 @@ sudo -u www-data LIBRETIME_DEBUG=True libretime-api runserver 0.0.0.0:8081
Unit tests can be run in the vagrant environment using Unit tests can be run in the vagrant environment using
``` ```
sudo -u www-data LIBRETIME_DEBUG=True libretime-api test libretimeapi sudo -u www-data LIBRETIME_DEBUG=True libretime-api test libretime_api
``` ```
## 3rd Party Licences ## 3rd Party Licences
`libretimeapi/tests/resources/song.mp3`: Steps - Tears On The Dancefloor (Album `libretime_api/tests/resources/song.mp3`: Steps - Tears On The Dancefloor (Album
Teaser) by mceyedol. Downloaded from Teaser) by mceyedol. Downloaded from
https://soundcloud.com/mceyedol/steps-tears-on-the-dancefloor-album-teaser https://soundcloud.com/mceyedol/steps-tears-on-the-dancefloor-album-teaser
released under a Creative Commons Licence released under a Creative Commons Licence

View File

@ -3,6 +3,6 @@ from django.db.models.signals import pre_save
class LibreTimeAPIConfig(AppConfig): class LibreTimeAPIConfig(AppConfig):
name = "libretimeapi" name = "libretime_api"
verbose_name = "LibreTime API" verbose_name = "LibreTime API"
default_auto_field = "django.db.models.AutoField" default_auto_field = "django.db.models.AutoField"

View File

@ -6,7 +6,7 @@ import sys
def main(): def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretimeapi.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretime_api.settings")
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc:

View File

@ -5,8 +5,8 @@ from django.contrib.auth.models import AbstractBaseUser, Permission
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.db import models from django.db import models
from libretimeapi.managers import UserManager from libretime_api.managers import UserManager
from libretimeapi.permission_constants import GROUPS from libretime_api.permission_constants import GROUPS
from .user_constants import ADMIN, USER_TYPES from .user_constants import ADMIN, USER_TYPES

View File

@ -33,7 +33,7 @@ ALLOWED_HOSTS = ["*"]
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
"libretimeapi.apps.LibreTimeAPIConfig", "libretime_api.apps.LibreTimeAPIConfig",
"django.contrib.admin", "django.contrib.admin",
"django.contrib.auth", "django.contrib.auth",
"django.contrib.contenttypes", "django.contrib.contenttypes",
@ -55,7 +55,7 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
] ]
ROOT_URLCONF = "libretimeapi.urls" ROOT_URLCONF = "libretime_api.urls"
TEMPLATES = [ TEMPLATES = [
{ {
@ -73,7 +73,7 @@ TEMPLATES = [
}, },
] ]
WSGI_APPLICATION = "libretimeapi.wsgi.application" WSGI_APPLICATION = "libretime_api.wsgi.application"
# Database # Database
@ -115,7 +115,7 @@ REST_FRAMEWORK = {
"rest_framework.authentication.BasicAuthentication", "rest_framework.authentication.BasicAuthentication",
), ),
"DEFAULT_PERMISSION_CLASSES": [ "DEFAULT_PERMISSION_CLASSES": [
"libretimeapi.permissions.IsSystemTokenOrUser", "libretime_api.permissions.IsSystemTokenOrUser",
], ],
"DEFAULT_FILTER_BACKENDS": [ "DEFAULT_FILTER_BACKENDS": [
"django_filters.rest_framework.DjangoFilterBackend", "django_filters.rest_framework.DjangoFilterBackend",
@ -146,9 +146,9 @@ STATIC_URL = "/api/static/"
if not DEBUG: if not DEBUG:
STATIC_ROOT = os.getenv("LIBRETIME_STATIC_ROOT", "/usr/share/airtime/api") STATIC_ROOT = os.getenv("LIBRETIME_STATIC_ROOT", "/usr/share/airtime/api")
AUTH_USER_MODEL = "libretimeapi.User" AUTH_USER_MODEL = "libretime_api.User"
TEST_RUNNER = "libretimeapi.tests.runners.ManagedModelTestRunner" TEST_RUNNER = "libretime_api.tests.runners.ManagedModelTestRunner"
LOGGING = { LOGGING = {
"version": 1, "version": 1,
@ -185,7 +185,7 @@ LOGGING = {
"level": "INFO", "level": "INFO",
"propagate": True, "propagate": True,
}, },
"libretimeapi": { "libretime_api": {
"handlers": ["file", "console"], "handlers": ["file", "console"],
"level": "INFO", "level": "INFO",
"propagate": True, "propagate": True,

View File

@ -2,7 +2,7 @@ from datetime import datetime, timedelta
from django.test import TestCase from django.test import TestCase
from libretimeapi.models import Schedule, ShowInstance from libretime_api.models import Schedule, ShowInstance
class TestSchedule(TestCase): class TestSchedule(TestCase):

View File

@ -2,9 +2,9 @@ from django.apps import apps
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from rest_framework.test import APITestCase from rest_framework.test import APITestCase
from libretimeapi.models import User from libretime_api.models import User
from libretimeapi.models.user_constants import DJ, GUEST from libretime_api.models.user_constants import DJ, GUEST
from libretimeapi.permission_constants import GROUPS from libretime_api.permission_constants import GROUPS
class TestUserManager(APITestCase): class TestUserManager(APITestCase):

View File

@ -6,13 +6,13 @@ from django.contrib.auth.models import AnonymousUser
from model_bakery import baker from model_bakery import baker
from rest_framework.test import APIRequestFactory, APITestCase from rest_framework.test import APIRequestFactory, APITestCase
from libretimeapi.models.user_constants import ADMIN, DJ, GUEST, PROGRAM_MANAGER from libretime_api.models.user_constants import ADMIN, DJ, GUEST, PROGRAM_MANAGER
from libretimeapi.permission_constants import ( from libretime_api.permission_constants import (
DJ_PERMISSIONS, DJ_PERMISSIONS,
GUEST_PERMISSIONS, GUEST_PERMISSIONS,
PROGRAM_MANAGER_PERMISSIONS, PROGRAM_MANAGER_PERMISSIONS,
) )
from libretimeapi.permissions import IsSystemTokenOrUser from libretime_api.permissions import IsSystemTokenOrUser
class TestIsSystemTokenOrUser(APITestCase): class TestIsSystemTokenOrUser(APITestCase):
@ -109,7 +109,7 @@ class TestPermissions(APITestCase):
first_name="test", first_name="test",
last_name="user", last_name="user",
) )
f = baker.make("libretimeapi.File", owner=user) f = baker.make("libretime_api.File", owner=user)
model = "files/{}".format(f.id) model = "files/{}".format(f.id)
path = self.path.format(model) path = self.path.format(model)
self.client.login(username="test-dj", password="test") self.client.login(username="test-dj", password="test")
@ -125,7 +125,7 @@ class TestPermissions(APITestCase):
first_name="test", first_name="test",
last_name="user", last_name="user",
) )
f = baker.make("libretimeapi.File") f = baker.make("libretime_api.File")
model = "files/{}".format(f.id) model = "files/{}".format(f.id)
path = self.path.format(model) path = self.path.format(model)
self.client.login(username="test-dj", password="test") self.client.login(username="test-dj", password="test")

View File

@ -7,7 +7,7 @@ from django.utils import dateparse
from model_bakery import baker from model_bakery import baker
from rest_framework.test import APIRequestFactory, APITestCase from rest_framework.test import APIRequestFactory, APITestCase
from libretimeapi.views import FileViewSet from libretime_api.views import FileViewSet
class TestFileViewSet(APITestCase): class TestFileViewSet(APITestCase):
@ -30,11 +30,11 @@ class TestFileViewSet(APITestCase):
def test_exists(self): def test_exists(self):
music_dir = baker.make( music_dir = baker.make(
"libretimeapi.MusicDir", "libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"), directory=os.path.join(os.path.dirname(__file__), "resources"),
) )
f = baker.make( f = baker.make(
"libretimeapi.File", "libretime_api.File",
directory=music_dir, directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath="song.mp3", filepath="song.mp3",
@ -53,11 +53,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_full_length(self): def test_schedule_item_full_length(self):
music_dir = baker.make( music_dir = baker.make(
"libretimeapi.MusicDir", "libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"), directory=os.path.join(os.path.dirname(__file__), "resources"),
) )
f = baker.make( f = baker.make(
"libretimeapi.File", "libretime_api.File",
directory=music_dir, directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath="song.mp3", filepath="song.mp3",
@ -66,12 +66,12 @@ class TestScheduleViewSet(APITestCase):
cueout=timedelta(seconds=40.8131), cueout=timedelta(seconds=40.8131),
) )
show = baker.make( show = baker.make(
"libretimeapi.ShowInstance", "libretime_api.ShowInstance",
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5), starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5), ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5),
) )
scheduleItem = baker.make( scheduleItem = baker.make(
"libretimeapi.Schedule", "libretime_api.Schedule",
starts=datetime.now(tz=timezone.utc), starts=datetime.now(tz=timezone.utc),
ends=datetime.now(tz=timezone.utc) + f.length, ends=datetime.now(tz=timezone.utc) + f.length,
cue_out=f.cueout, cue_out=f.cueout,
@ -87,11 +87,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_trunc(self): def test_schedule_item_trunc(self):
music_dir = baker.make( music_dir = baker.make(
"libretimeapi.MusicDir", "libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"), directory=os.path.join(os.path.dirname(__file__), "resources"),
) )
f = baker.make( f = baker.make(
"libretimeapi.File", "libretime_api.File",
directory=music_dir, directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath="song.mp3", filepath="song.mp3",
@ -100,12 +100,12 @@ class TestScheduleViewSet(APITestCase):
cueout=timedelta(seconds=40.8131), cueout=timedelta(seconds=40.8131),
) )
show = baker.make( show = baker.make(
"libretimeapi.ShowInstance", "libretime_api.ShowInstance",
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5), starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
ends=datetime.now(tz=timezone.utc) + timedelta(seconds=20), ends=datetime.now(tz=timezone.utc) + timedelta(seconds=20),
) )
scheduleItem = baker.make( scheduleItem = baker.make(
"libretimeapi.Schedule", "libretime_api.Schedule",
starts=datetime.now(tz=timezone.utc), starts=datetime.now(tz=timezone.utc),
ends=datetime.now(tz=timezone.utc) + f.length, ends=datetime.now(tz=timezone.utc) + f.length,
instance=show, instance=show,
@ -124,11 +124,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_invalid(self): def test_schedule_item_invalid(self):
music_dir = baker.make( music_dir = baker.make(
"libretimeapi.MusicDir", "libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"), directory=os.path.join(os.path.dirname(__file__), "resources"),
) )
f = baker.make( f = baker.make(
"libretimeapi.File", "libretime_api.File",
directory=music_dir, directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath="song.mp3", filepath="song.mp3",
@ -137,12 +137,12 @@ class TestScheduleViewSet(APITestCase):
cueout=timedelta(seconds=40.8131), cueout=timedelta(seconds=40.8131),
) )
show = baker.make( show = baker.make(
"libretimeapi.ShowInstance", "libretime_api.ShowInstance",
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5), starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5), ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5),
) )
scheduleItem = baker.make( scheduleItem = baker.make(
"libretimeapi.Schedule", "libretime_api.Schedule",
starts=datetime.now(tz=timezone.utc), starts=datetime.now(tz=timezone.utc),
ends=datetime.now(tz=timezone.utc) + f.length, ends=datetime.now(tz=timezone.utc) + f.length,
cue_out=f.cueout, cue_out=f.cueout,
@ -150,7 +150,7 @@ class TestScheduleViewSet(APITestCase):
file=f, file=f,
) )
invalidScheduleItem = baker.make( invalidScheduleItem = baker.make(
"libretimeapi.Schedule", "libretime_api.Schedule",
starts=show.ends + timedelta(minutes=1), starts=show.ends + timedelta(minutes=1),
ends=show.ends + timedelta(minutes=1) + f.length, ends=show.ends + timedelta(minutes=1) + f.length,
cue_out=f.cueout, cue_out=f.cueout,
@ -168,11 +168,11 @@ class TestScheduleViewSet(APITestCase):
def test_schedule_item_range(self): def test_schedule_item_range(self):
music_dir = baker.make( music_dir = baker.make(
"libretimeapi.MusicDir", "libretime_api.MusicDir",
directory=os.path.join(os.path.dirname(__file__), "resources"), directory=os.path.join(os.path.dirname(__file__), "resources"),
) )
f = baker.make( f = baker.make(
"libretimeapi.File", "libretime_api.File",
directory=music_dir, directory=music_dir,
mime="audio/mp3", mime="audio/mp3",
filepath="song.mp3", filepath="song.mp3",
@ -183,12 +183,12 @@ class TestScheduleViewSet(APITestCase):
filter_point = datetime.now(tz=timezone.utc) filter_point = datetime.now(tz=timezone.utc)
show = baker.make( show = baker.make(
"libretimeapi.ShowInstance", "libretime_api.ShowInstance",
starts=filter_point - timedelta(minutes=5), starts=filter_point - timedelta(minutes=5),
ends=filter_point + timedelta(minutes=5), ends=filter_point + timedelta(minutes=5),
) )
schedule_item = baker.make( schedule_item = baker.make(
"libretimeapi.Schedule", "libretime_api.Schedule",
starts=filter_point, starts=filter_point,
ends=filter_point + f.length, ends=filter_point + f.length,
cue_out=f.cueout, cue_out=f.cueout,
@ -196,7 +196,7 @@ class TestScheduleViewSet(APITestCase):
file=f, file=f,
) )
previous_item = baker.make( previous_item = baker.make(
"libretimeapi.Schedule", "libretime_api.Schedule",
starts=filter_point - timedelta(minutes=5), starts=filter_point - timedelta(minutes=5),
ends=filter_point - timedelta(minutes=5) + f.length, ends=filter_point - timedelta(minutes=5) + f.length,
cue_out=f.cueout, cue_out=f.cueout,

View File

@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretimeapi.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretime_api.settings")
application = get_wsgi_application() application = get_wsgi_application()

View File

@ -22,7 +22,7 @@ setup(
python_requires=">=3.6", python_requires=">=3.6",
entry_points={ entry_points={
"console_scripts": [ "console_scripts": [
"libretime-api=libretimeapi.cli:main", "libretime-api=libretime_api.cli:main",
] ]
}, },
install_requires=[ install_requires=[

View File

@ -1,5 +1,5 @@
[uwsgi] [uwsgi]
module = libretimeapi.wsgi module = libretime_api.wsgi
master = true master = true
plugin = python3 plugin = python3