chore: fixes after libretime_api rename
This commit is contained in:
parent
6de242db65
commit
e84137a8ee
|
@ -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`
|
||||
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;`
|
||||
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.
|
||||
|
||||
## Documentation and financial contributions
|
||||
|
|
|
@ -3,8 +3,8 @@ all: lint
|
|||
include ../tools/python.mk
|
||||
|
||||
PIP_INSTALL := --editable .[dev]
|
||||
PYLINT_ARG := libretimeapi
|
||||
MYPY_ARG := libretimeapi
|
||||
PYLINT_ARG := libretime_api
|
||||
MYPY_ARG := libretime_api
|
||||
|
||||
format: .format
|
||||
lint: .format-check .pylint .mypy
|
||||
|
@ -12,4 +12,4 @@ clean: .clean
|
|||
|
||||
test: $(VENV)
|
||||
source $(VENV)/bin/activate
|
||||
LIBRETIME_DEBUG=True $(VENV)/bin/libretime-api test libretimeapi
|
||||
LIBRETIME_DEBUG=True $(VENV)/bin/libretime-api test libretime_api
|
||||
|
|
|
@ -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
|
||||
|
||||
```
|
||||
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
|
||||
|
||||
`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
|
||||
https://soundcloud.com/mceyedol/steps-tears-on-the-dancefloor-album-teaser
|
||||
released under a Creative Commons Licence
|
||||
|
|
|
@ -3,6 +3,6 @@ from django.db.models.signals import pre_save
|
|||
|
||||
|
||||
class LibreTimeAPIConfig(AppConfig):
|
||||
name = "libretimeapi"
|
||||
name = "libretime_api"
|
||||
verbose_name = "LibreTime API"
|
||||
default_auto_field = "django.db.models.AutoField"
|
||||
|
|
|
@ -6,7 +6,7 @@ import sys
|
|||
|
||||
|
||||
def main():
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretimeapi.settings")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "libretime_api.settings")
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
|
|
|
@ -5,8 +5,8 @@ from django.contrib.auth.models import AbstractBaseUser, Permission
|
|||
from django.core.exceptions import PermissionDenied
|
||||
from django.db import models
|
||||
|
||||
from libretimeapi.managers import UserManager
|
||||
from libretimeapi.permission_constants import GROUPS
|
||||
from libretime_api.managers import UserManager
|
||||
from libretime_api.permission_constants import GROUPS
|
||||
|
||||
from .user_constants import ADMIN, USER_TYPES
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ ALLOWED_HOSTS = ["*"]
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"libretimeapi.apps.LibreTimeAPIConfig",
|
||||
"libretime_api.apps.LibreTimeAPIConfig",
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
|
@ -55,7 +55,7 @@ MIDDLEWARE = [
|
|||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = "libretimeapi.urls"
|
||||
ROOT_URLCONF = "libretime_api.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ TEMPLATES = [
|
|||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "libretimeapi.wsgi.application"
|
||||
WSGI_APPLICATION = "libretime_api.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
|
@ -115,7 +115,7 @@ REST_FRAMEWORK = {
|
|||
"rest_framework.authentication.BasicAuthentication",
|
||||
),
|
||||
"DEFAULT_PERMISSION_CLASSES": [
|
||||
"libretimeapi.permissions.IsSystemTokenOrUser",
|
||||
"libretime_api.permissions.IsSystemTokenOrUser",
|
||||
],
|
||||
"DEFAULT_FILTER_BACKENDS": [
|
||||
"django_filters.rest_framework.DjangoFilterBackend",
|
||||
|
@ -146,9 +146,9 @@ STATIC_URL = "/api/static/"
|
|||
if not DEBUG:
|
||||
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 = {
|
||||
"version": 1,
|
||||
|
@ -185,7 +185,7 @@ LOGGING = {
|
|||
"level": "INFO",
|
||||
"propagate": True,
|
||||
},
|
||||
"libretimeapi": {
|
||||
"libretime_api": {
|
||||
"handlers": ["file", "console"],
|
||||
"level": "INFO",
|
||||
"propagate": True,
|
||||
|
|
|
@ -2,7 +2,7 @@ from datetime import datetime, timedelta
|
|||
|
||||
from django.test import TestCase
|
||||
|
||||
from libretimeapi.models import Schedule, ShowInstance
|
||||
from libretime_api.models import Schedule, ShowInstance
|
||||
|
||||
|
||||
class TestSchedule(TestCase):
|
||||
|
|
|
@ -2,9 +2,9 @@ from django.apps import apps
|
|||
from django.contrib.auth.models import Group
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from libretimeapi.models import User
|
||||
from libretimeapi.models.user_constants import DJ, GUEST
|
||||
from libretimeapi.permission_constants import GROUPS
|
||||
from libretime_api.models import User
|
||||
from libretime_api.models.user_constants import DJ, GUEST
|
||||
from libretime_api.permission_constants import GROUPS
|
||||
|
||||
|
||||
class TestUserManager(APITestCase):
|
||||
|
|
|
@ -6,13 +6,13 @@ from django.contrib.auth.models import AnonymousUser
|
|||
from model_bakery import baker
|
||||
from rest_framework.test import APIRequestFactory, APITestCase
|
||||
|
||||
from libretimeapi.models.user_constants import ADMIN, DJ, GUEST, PROGRAM_MANAGER
|
||||
from libretimeapi.permission_constants import (
|
||||
from libretime_api.models.user_constants import ADMIN, DJ, GUEST, PROGRAM_MANAGER
|
||||
from libretime_api.permission_constants import (
|
||||
DJ_PERMISSIONS,
|
||||
GUEST_PERMISSIONS,
|
||||
PROGRAM_MANAGER_PERMISSIONS,
|
||||
)
|
||||
from libretimeapi.permissions import IsSystemTokenOrUser
|
||||
from libretime_api.permissions import IsSystemTokenOrUser
|
||||
|
||||
|
||||
class TestIsSystemTokenOrUser(APITestCase):
|
||||
|
@ -109,7 +109,7 @@ class TestPermissions(APITestCase):
|
|||
first_name="test",
|
||||
last_name="user",
|
||||
)
|
||||
f = baker.make("libretimeapi.File", owner=user)
|
||||
f = baker.make("libretime_api.File", owner=user)
|
||||
model = "files/{}".format(f.id)
|
||||
path = self.path.format(model)
|
||||
self.client.login(username="test-dj", password="test")
|
||||
|
@ -125,7 +125,7 @@ class TestPermissions(APITestCase):
|
|||
first_name="test",
|
||||
last_name="user",
|
||||
)
|
||||
f = baker.make("libretimeapi.File")
|
||||
f = baker.make("libretime_api.File")
|
||||
model = "files/{}".format(f.id)
|
||||
path = self.path.format(model)
|
||||
self.client.login(username="test-dj", password="test")
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.utils import dateparse
|
|||
from model_bakery import baker
|
||||
from rest_framework.test import APIRequestFactory, APITestCase
|
||||
|
||||
from libretimeapi.views import FileViewSet
|
||||
from libretime_api.views import FileViewSet
|
||||
|
||||
|
||||
class TestFileViewSet(APITestCase):
|
||||
|
@ -30,11 +30,11 @@ class TestFileViewSet(APITestCase):
|
|||
|
||||
def test_exists(self):
|
||||
music_dir = baker.make(
|
||||
"libretimeapi.MusicDir",
|
||||
"libretime_api.MusicDir",
|
||||
directory=os.path.join(os.path.dirname(__file__), "resources"),
|
||||
)
|
||||
f = baker.make(
|
||||
"libretimeapi.File",
|
||||
"libretime_api.File",
|
||||
directory=music_dir,
|
||||
mime="audio/mp3",
|
||||
filepath="song.mp3",
|
||||
|
@ -53,11 +53,11 @@ class TestScheduleViewSet(APITestCase):
|
|||
|
||||
def test_schedule_item_full_length(self):
|
||||
music_dir = baker.make(
|
||||
"libretimeapi.MusicDir",
|
||||
"libretime_api.MusicDir",
|
||||
directory=os.path.join(os.path.dirname(__file__), "resources"),
|
||||
)
|
||||
f = baker.make(
|
||||
"libretimeapi.File",
|
||||
"libretime_api.File",
|
||||
directory=music_dir,
|
||||
mime="audio/mp3",
|
||||
filepath="song.mp3",
|
||||
|
@ -66,12 +66,12 @@ class TestScheduleViewSet(APITestCase):
|
|||
cueout=timedelta(seconds=40.8131),
|
||||
)
|
||||
show = baker.make(
|
||||
"libretimeapi.ShowInstance",
|
||||
"libretime_api.ShowInstance",
|
||||
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
|
||||
ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5),
|
||||
)
|
||||
scheduleItem = baker.make(
|
||||
"libretimeapi.Schedule",
|
||||
"libretime_api.Schedule",
|
||||
starts=datetime.now(tz=timezone.utc),
|
||||
ends=datetime.now(tz=timezone.utc) + f.length,
|
||||
cue_out=f.cueout,
|
||||
|
@ -87,11 +87,11 @@ class TestScheduleViewSet(APITestCase):
|
|||
|
||||
def test_schedule_item_trunc(self):
|
||||
music_dir = baker.make(
|
||||
"libretimeapi.MusicDir",
|
||||
"libretime_api.MusicDir",
|
||||
directory=os.path.join(os.path.dirname(__file__), "resources"),
|
||||
)
|
||||
f = baker.make(
|
||||
"libretimeapi.File",
|
||||
"libretime_api.File",
|
||||
directory=music_dir,
|
||||
mime="audio/mp3",
|
||||
filepath="song.mp3",
|
||||
|
@ -100,12 +100,12 @@ class TestScheduleViewSet(APITestCase):
|
|||
cueout=timedelta(seconds=40.8131),
|
||||
)
|
||||
show = baker.make(
|
||||
"libretimeapi.ShowInstance",
|
||||
"libretime_api.ShowInstance",
|
||||
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
|
||||
ends=datetime.now(tz=timezone.utc) + timedelta(seconds=20),
|
||||
)
|
||||
scheduleItem = baker.make(
|
||||
"libretimeapi.Schedule",
|
||||
"libretime_api.Schedule",
|
||||
starts=datetime.now(tz=timezone.utc),
|
||||
ends=datetime.now(tz=timezone.utc) + f.length,
|
||||
instance=show,
|
||||
|
@ -124,11 +124,11 @@ class TestScheduleViewSet(APITestCase):
|
|||
|
||||
def test_schedule_item_invalid(self):
|
||||
music_dir = baker.make(
|
||||
"libretimeapi.MusicDir",
|
||||
"libretime_api.MusicDir",
|
||||
directory=os.path.join(os.path.dirname(__file__), "resources"),
|
||||
)
|
||||
f = baker.make(
|
||||
"libretimeapi.File",
|
||||
"libretime_api.File",
|
||||
directory=music_dir,
|
||||
mime="audio/mp3",
|
||||
filepath="song.mp3",
|
||||
|
@ -137,12 +137,12 @@ class TestScheduleViewSet(APITestCase):
|
|||
cueout=timedelta(seconds=40.8131),
|
||||
)
|
||||
show = baker.make(
|
||||
"libretimeapi.ShowInstance",
|
||||
"libretime_api.ShowInstance",
|
||||
starts=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
|
||||
ends=datetime.now(tz=timezone.utc) + timedelta(minutes=5),
|
||||
)
|
||||
scheduleItem = baker.make(
|
||||
"libretimeapi.Schedule",
|
||||
"libretime_api.Schedule",
|
||||
starts=datetime.now(tz=timezone.utc),
|
||||
ends=datetime.now(tz=timezone.utc) + f.length,
|
||||
cue_out=f.cueout,
|
||||
|
@ -150,7 +150,7 @@ class TestScheduleViewSet(APITestCase):
|
|||
file=f,
|
||||
)
|
||||
invalidScheduleItem = baker.make(
|
||||
"libretimeapi.Schedule",
|
||||
"libretime_api.Schedule",
|
||||
starts=show.ends + timedelta(minutes=1),
|
||||
ends=show.ends + timedelta(minutes=1) + f.length,
|
||||
cue_out=f.cueout,
|
||||
|
@ -168,11 +168,11 @@ class TestScheduleViewSet(APITestCase):
|
|||
|
||||
def test_schedule_item_range(self):
|
||||
music_dir = baker.make(
|
||||
"libretimeapi.MusicDir",
|
||||
"libretime_api.MusicDir",
|
||||
directory=os.path.join(os.path.dirname(__file__), "resources"),
|
||||
)
|
||||
f = baker.make(
|
||||
"libretimeapi.File",
|
||||
"libretime_api.File",
|
||||
directory=music_dir,
|
||||
mime="audio/mp3",
|
||||
filepath="song.mp3",
|
||||
|
@ -183,12 +183,12 @@ class TestScheduleViewSet(APITestCase):
|
|||
filter_point = datetime.now(tz=timezone.utc)
|
||||
|
||||
show = baker.make(
|
||||
"libretimeapi.ShowInstance",
|
||||
"libretime_api.ShowInstance",
|
||||
starts=filter_point - timedelta(minutes=5),
|
||||
ends=filter_point + timedelta(minutes=5),
|
||||
)
|
||||
schedule_item = baker.make(
|
||||
"libretimeapi.Schedule",
|
||||
"libretime_api.Schedule",
|
||||
starts=filter_point,
|
||||
ends=filter_point + f.length,
|
||||
cue_out=f.cueout,
|
||||
|
@ -196,7 +196,7 @@ class TestScheduleViewSet(APITestCase):
|
|||
file=f,
|
||||
)
|
||||
previous_item = baker.make(
|
||||
"libretimeapi.Schedule",
|
||||
"libretime_api.Schedule",
|
||||
starts=filter_point - timedelta(minutes=5),
|
||||
ends=filter_point - timedelta(minutes=5) + f.length,
|
||||
cue_out=f.cueout,
|
||||
|
|
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
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()
|
||||
|
|
|
@ -22,7 +22,7 @@ setup(
|
|||
python_requires=">=3.6",
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"libretime-api=libretimeapi.cli:main",
|
||||
"libretime-api=libretime_api.cli:main",
|
||||
]
|
||||
},
|
||||
install_requires=[
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[uwsgi]
|
||||
module = libretimeapi.wsgi
|
||||
module = libretime_api.wsgi
|
||||
|
||||
master = true
|
||||
plugin = python3
|
||||
|
|
Loading…
Reference in New Issue