Compare commits

...

6 Commits

Author SHA1 Message Date
Alexander Karpov
5b3631a406
Merge branch 'main' into dependabot/pip/django-colorfield-0.11.0 2023-12-23 19:46:58 +03:00
dependabot[bot]
0f465e40de
Bump rawpy from 0.18.1 to 0.19.0 (#217)
Bumps [rawpy](https://github.com/letmaik/rawpy) from 0.18.1 to 0.19.0.
- [Release notes](https://github.com/letmaik/rawpy/releases)
- [Commits](https://github.com/letmaik/rawpy/compare/v0.18.1...v0.19.0)

---
updated-dependencies:
- dependency-name: rawpy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-23 19:46:32 +03:00
8f19d51410 updated files 2023-12-19 12:51:59 +03:00
07640962fa fixed music 2023-12-18 17:30:47 +03:00
fbddd3c1dc updated compose 2023-12-18 14:54:12 +03:00
79e865bf37 updated author creation 2023-12-18 14:51:24 +03:00
10 changed files with 114 additions and 51 deletions

View File

@ -13,6 +13,11 @@
from ..documents import FileDocument
from .lema import lemmatize_and_remove_stopwords
"""
Calculus on types of searches:
https://new.akarpov.ru/files/FZUTFBIyfbdlDHVzxUNU
"""
class BaseSearch:
def __init__(self, queryset: QuerySet | None = None):

View File

@ -92,9 +92,7 @@ def get_queryset(self):
):
return self.filter(BaseFileItem.objects.none())
return self.filter(
BaseFileItem.objects.cache().filter(
user=self.request.user, parent__isnull=True
)
BaseFileItem.objects.filter(user=self.request.user, parent__isnull=True)
)

View File

@ -0,0 +1,31 @@
# Generated by Django 4.2.8 on 2023-12-18 11:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("music", "0012_album_meta_author_albums_author_meta"),
]
operations = [
migrations.RemoveField(
model_name="author",
name="albums",
),
migrations.AddField(
model_name="album",
name="authors",
field=models.ManyToManyField(related_name="albums", to="music.album"),
),
migrations.AlterField(
model_name="album",
name="name",
field=models.CharField(max_length=200, unique=True),
),
migrations.AlterField(
model_name="author",
name="name",
field=models.CharField(max_length=200, unique=True),
),
]

View File

@ -0,0 +1,17 @@
# Generated by Django 4.2.8 on 2023-12-18 14:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("music", "0013_remove_author_albums_album_authors_alter_album_name_and_more"),
]
operations = [
migrations.AlterField(
model_name="album",
name="authors",
field=models.ManyToManyField(related_name="albums", to="music.author"),
),
]

View File

@ -8,10 +8,9 @@
class Author(BaseImageModel, ShortLinkModel):
name = models.CharField(max_length=200)
name = models.CharField(max_length=200, unique=True)
link = models.URLField(blank=True)
meta = models.JSONField(blank=True, null=True)
albums = models.ManyToManyField("Album", related_name="authors")
def get_absolute_url(self):
return reverse("music:author", kwargs={"slug": self.slug})
@ -21,9 +20,10 @@ def __str__(self):
class Album(BaseImageModel, ShortLinkModel):
name = models.CharField(max_length=200)
name = models.CharField(max_length=200, unique=True)
link = models.URLField(blank=True)
meta = models.JSONField(blank=True, null=True)
authors = models.ManyToManyField("Author", related_name="albums")
def get_absolute_url(self):
return reverse("music:album", kwargs={"slug": self.slug})

View File

@ -27,16 +27,28 @@ def load_track(
if album and type(album) is str and album.startswith("['"):
album = album.replace("['", "").replace("']", "")
re_authors = []
if authors:
authors = [Author.objects.get_or_create(name=x)[0] for x in authors if authors]
else:
authors = []
for x in authors:
try:
re_authors.append(Author.objects.get(name=x))
except Author.DoesNotExist:
re_authors.append(Author.objects.create(name=x))
authors = re_authors
album_name = None
if album:
if type(album) is str:
album = Album.objects.get_or_create(name=album)[0]
album_name = album
elif type(album) is list:
album = Album.objects.get_or_create(name=album[0])[0]
album_name = album[0]
else:
album_name = None
if album_name:
try:
album = Album.objects.get(name=album_name)
except Album.DoesNotExist:
album = Album.objects.create(name=album_name)
if not album_name:
album = None
if sng := Song.objects.filter(
@ -101,7 +113,7 @@ def load_track(
album.save()
if authors:
song.authors.set(authors)
song.authors.set([x.id for x in authors])
# set music meta
tag = MutagenFile(song.file.path)

View File

@ -126,25 +126,26 @@ def update_album_info(album: AlbumModel) -> None:
"description": search_album.description,
"type": search_album.type,
}
authors = []
if search_album.artists:
for x in search_album.artists:
try:
authors.append(Author.objects.get_or_create(name=x.name)[0])
except Author.MultipleObjectsReturned:
authors.append(Author.objects.filter(name=x.name).first())
album.authors.set(authors)
album.meta = data
image_path = str(settings.MEDIA_ROOT + f"/_{str(randint(10000, 99999))}.png")
if not search_album.cover_uri:
album.save()
return
if search_album.cover_uri:
search_album.download_cover(filename=image_path)
with open(image_path, "rb") as f:
album.image = File(f, name=image_path.split("/")[-1])
album.save()
os.remove(image_path)
authors = []
if search_album.artists:
for x in search_album.artists:
try:
authors.append(Author.objects.get(name=x.name))
except Author.DoesNotExist:
authors.append(Author.objects.create(name=x.name))
album.authors.set([x.id for x in authors])
album.save()
def update_author_info(author: Author) -> None:
client = login()

View File

@ -3,7 +3,6 @@
set -o errexit
set -o nounset
python manage.py makemigrations
python manage.py migrate
rm -f './celerybeat.pid'
celery -A config.celery_app beat -l INFO

42
poetry.lock generated
View File

@ -4973,31 +4973,31 @@ files = [
[[package]]
name = "rawpy"
version = "0.18.1"
version = "0.19.0"
description = "RAW image processing for Python, a wrapper for libraw"
optional = false
python-versions = "*"
files = [
{file = "rawpy-0.18.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30f5a7f3b80db8aa18876831b73b5cf0530da3f2dd8be9870cc1bae271b5fdb0"},
{file = "rawpy-0.18.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c6cdb86817f4740c3252d4797e0b5926d499330b46da1255d56d6a401a34c3ec"},
{file = "rawpy-0.18.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c0a040c33fe3b14a6bd9d81a8c2d6cb49657530ede982ca1585108229fec651"},
{file = "rawpy-0.18.1-cp310-cp310-win_amd64.whl", hash = "sha256:bc2fc6e346278ea3fc0fe76b704984551055914905e6187be7844fecfc756b22"},
{file = "rawpy-0.18.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e836ff1a0f7d8eb24665f4f230a41f14eda66a86445b372b906c2cf8651a5d17"},
{file = "rawpy-0.18.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0f3b352da1316f5ac9a41e418f6247587420ff9966441b95f2aa6cefdb167c51"},
{file = "rawpy-0.18.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fac80b3aa1cec375345c14a63c1c0360520ef34b7f1150478cf453e43585c1c"},
{file = "rawpy-0.18.1-cp311-cp311-win_amd64.whl", hash = "sha256:fff49c7529f3c06aff2daa9d61a092a0f13ca30fdf722b6d12ca5cff9e21180a"},
{file = "rawpy-0.18.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:296bb1bcc397de4a9e018cb4136c395f7c49547eae9e3de1b5e785db2b23657a"},
{file = "rawpy-0.18.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:08160b50b4b63a9150334c79a30c2c24c69824386c3a92fa2d8c66a2a29680f6"},
{file = "rawpy-0.18.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6effc4a49f64acaa01e35ec42b7c29f2e7453b8f010dbcf4aacd0f1394c186c"},
{file = "rawpy-0.18.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a4f4f51d55e073394340cb52f5fcb4bb2d1c596884666ee85e61c15b9c2eef59"},
{file = "rawpy-0.18.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:710fdaf4af31171d847eae4dc4bbd717a951d75d159cdcc27a9ee8b046354447"},
{file = "rawpy-0.18.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:18171458cff40f968797fac4681aed6ec9bf3b2278b2235d39b09f987d2470b8"},
{file = "rawpy-0.18.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cfd92c94eae2f8bdde4b249007f8207e74f0bc8f3f5998e6784eaf1e9b67dd7a"},
{file = "rawpy-0.18.1-cp38-cp38-win_amd64.whl", hash = "sha256:d37c144ac4922ce20acccf93bb97b2d5a3e06ab782de58d9630bd77733962cb6"},
{file = "rawpy-0.18.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:be306f686039dc2e2f7374ba15ce64b4392f10ca586f6ca6dd3252777588e750"},
{file = "rawpy-0.18.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:10cea749fc9d8cf1ae716172dd09b36accfd1de576351ce6a650b5b30f9dc6f8"},
{file = "rawpy-0.18.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f1a6437ebdac9c3ce09932d752eac7acfda6e56a7996b211ac2a625b80168dad"},
{file = "rawpy-0.18.1-cp39-cp39-win_amd64.whl", hash = "sha256:139715d16ff64c47f53972e6b07576ce5c47cef899a187b149750855d08ef557"},
{file = "rawpy-0.19.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:663766ad644e771491c31b597671cf4780da8449289492fd4cfc3689aefe47dc"},
{file = "rawpy-0.19.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c094ca1a0b892e6b9fb8f8bf177a92d94af4218dee8ee6496488a309b7015dd6"},
{file = "rawpy-0.19.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5eee1379200325171f976518918930357722d21b4241476c8537ac6884ed3f16"},
{file = "rawpy-0.19.0-cp310-cp310-win_amd64.whl", hash = "sha256:ece54693d92416d91b149e6ee50f479dd0be81858ac78e7c5e1047e19115c328"},
{file = "rawpy-0.19.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e575d5bfa0168bbded845bde921dcde03bb7ffc66190a902fbf6b8a7473e87a1"},
{file = "rawpy-0.19.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fa3e5b275c49f77d4ba9d177851e5d499ad34389b509b9f64b4fec2ffcece337"},
{file = "rawpy-0.19.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f6bfc5b9126de96b1f67cda7d39bbb28a9af1ed8b91c5a1fd9417f4d6327749"},
{file = "rawpy-0.19.0-cp311-cp311-win_amd64.whl", hash = "sha256:80cb145a8710fdeded60a79bcdf8224c8349c26e7addb7253604dbb36e3bc0b0"},
{file = "rawpy-0.19.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:064e657c478b330a4460c5b58f5565dea6b2003013e036ca3058386bc3521fe1"},
{file = "rawpy-0.19.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe6b7fc7d1d53ed06962a46aa723b09d593bbf70d23c5cb4b1a6a3fb64276cd6"},
{file = "rawpy-0.19.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be0e4e49ebdbb6d4d1f6ec7b93406b4da53372123f0ee13ec1682bdcf20b238f"},
{file = "rawpy-0.19.0-cp312-cp312-win_amd64.whl", hash = "sha256:285ef8f89b59826344513c01d66e7e1e7d07e968e21a41908eec5593368fc88a"},
{file = "rawpy-0.19.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:696612059fab1c1f5b62605aa217248bfd1639906f665f6b9e7e17b78f67d119"},
{file = "rawpy-0.19.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b0c6a829ef472f0c8684ed2d650aedab4c8a8713da54bfa94e479a5e483b3ae4"},
{file = "rawpy-0.19.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21bb29104425fbaeb7269acf33ca5dd286f7fc913515c4abe4c4ff004ed860be"},
{file = "rawpy-0.19.0-cp38-cp38-win_amd64.whl", hash = "sha256:e53b6f2a85fa6c2bea64ea0c82242b6d62b725f837d30825869f877ffbe3323c"},
{file = "rawpy-0.19.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bd562fc1882405eca01515642caab773dfec5e54cd4c10fe3f4ef39d8526aea8"},
{file = "rawpy-0.19.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9da7fec99d2403f01ab3dc13b510313cb42eb76e0f1307d861bdf165fd1c467"},
{file = "rawpy-0.19.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4120e8f22dd147abba331fc14f51ea20b62758dee46b76f893c59afeb636c7cd"},
{file = "rawpy-0.19.0-cp39-cp39-win_amd64.whl", hash = "sha256:5ca0ecf879de387f5c47d8d7308a0afaa259e63ff18c032637255879083a0102"},
]
[package.dependencies]

View File

@ -77,7 +77,7 @@ pydub = "^0.25.1"
python-mpd2 = "^3.0.5"
yandex-music = "^2.1.1"
pyjwt = "^2.8.0"
rawpy = "^0.18.1"
rawpy = "^0.19.0"
xvfbwrapper = "^0.2.9"
vtk = "^9.2.6"
ffmpeg-python = "^0.2.0"