Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f0d5ad7f4 | |||
| 2b81b28bff |
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "vrobbler"
|
name = "vrobbler"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Colin Powell <colin@unbl.ink>"]
|
authors = ["Colin Powell <colin@unbl.ink>"]
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,35 @@
|
|||||||
|
# Generated by Django 4.1.5 on 2023-01-11 03:13
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('music', '0003_album_uuid_artist_uuid_track_uuid'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='artist',
|
||||||
|
options={},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='album',
|
||||||
|
name='musicbrainz_id',
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=255, null=True, unique=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='track',
|
||||||
|
name='musicbrainz_id',
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=255, null=True, unique=True
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='artist',
|
||||||
|
unique_together={('name', 'musicbrainz_id')},
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -1,25 +0,0 @@
|
|||||||
# Generated by Django 4.1.5 on 2023-01-09 16:19
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('music', '0003_album_uuid_artist_uuid_track_uuid'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='track',
|
|
||||||
name='thumbs',
|
|
||||||
field=models.IntegerField(
|
|
||||||
choices=[
|
|
||||||
(-1, 'Thumbs down'),
|
|
||||||
(0, 'No opinion'),
|
|
||||||
(1, 'Thumbs up'),
|
|
||||||
],
|
|
||||||
default=0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@ -16,7 +16,7 @@ class Album(TimeStampedModel):
|
|||||||
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
|
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
year = models.IntegerField(**BNULL)
|
year = models.IntegerField(**BNULL)
|
||||||
musicbrainz_id = models.CharField(max_length=255, **BNULL)
|
musicbrainz_id = models.CharField(max_length=255, unique=True, **BNULL)
|
||||||
musicbrainz_releasegroup_id = models.CharField(max_length=255, **BNULL)
|
musicbrainz_releasegroup_id = models.CharField(max_length=255, **BNULL)
|
||||||
musicbrainz_albumartist_id = models.CharField(max_length=255, **BNULL)
|
musicbrainz_albumartist_id = models.CharField(max_length=255, **BNULL)
|
||||||
|
|
||||||
@ -33,6 +33,9 @@ class Artist(TimeStampedModel):
|
|||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
musicbrainz_id = models.CharField(max_length=255, **BNULL)
|
musicbrainz_id = models.CharField(max_length=255, **BNULL)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together=[['name', 'musicbrainz_id']]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
@ -51,10 +54,10 @@ class Track(TimeStampedModel):
|
|||||||
title = models.CharField(max_length=255, **BNULL)
|
title = models.CharField(max_length=255, **BNULL)
|
||||||
artist = models.ForeignKey(Artist, on_delete=models.DO_NOTHING)
|
artist = models.ForeignKey(Artist, on_delete=models.DO_NOTHING)
|
||||||
album = models.ForeignKey(Album, on_delete=models.DO_NOTHING, **BNULL)
|
album = models.ForeignKey(Album, on_delete=models.DO_NOTHING, **BNULL)
|
||||||
musicbrainz_id = models.CharField(max_length=255, **BNULL)
|
musicbrainz_id = models.CharField(max_length=255, unique=True, **BNULL)
|
||||||
run_time = models.CharField(max_length=8, **BNULL)
|
run_time = models.CharField(max_length=8, **BNULL)
|
||||||
run_time_ticks = models.PositiveBigIntegerField(**BNULL)
|
run_time_ticks = models.PositiveBigIntegerField(**BNULL)
|
||||||
thumbs = models.IntegerField(default=Opinion.NEUTRAL, choices=Opinion.choices)
|
# thumbs = models.IntegerField(default=Opinion.NEUTRAL, choices=Opinion.choices)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.title} by {self.artist}"
|
return f"{self.title} by {self.artist}"
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
# Generated by Django 4.1.5 on 2023-01-11 03:23
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('videos', '0004_series_uuid_video_uuid'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='video',
|
||||||
|
options={},
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='video',
|
||||||
|
unique_together={('title', 'imdb_id')},
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -58,7 +58,8 @@ class Video(TimeStampedModel):
|
|||||||
imdb_id = models.CharField(max_length=20, **BNULL)
|
imdb_id = models.CharField(max_length=20, **BNULL)
|
||||||
tvrage_id = models.CharField(max_length=20, **BNULL)
|
tvrage_id = models.CharField(max_length=20, **BNULL)
|
||||||
|
|
||||||
# Metadata fields from TMDB
|
class Meta:
|
||||||
|
unique_together = [['title', 'imdb_id']]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.video_type == self.VideoType.TV_EPISODE:
|
if self.video_type == self.VideoType.TV_EPISODE:
|
||||||
@ -107,6 +108,7 @@ class Video(TimeStampedModel):
|
|||||||
video_dict["season_number"] = data_dict.get("SeasonNumber", "")
|
video_dict["season_number"] = data_dict.get("SeasonNumber", "")
|
||||||
|
|
||||||
video, created = cls.objects.get_or_create(**video_dict)
|
video, created = cls.objects.get_or_create(**video_dict)
|
||||||
|
|
||||||
if created:
|
if created:
|
||||||
logger.debug(f"Created new video: {video}")
|
logger.debug(f"Created new video: {video}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user