Add default series source
This commit is contained in:
@ -168,12 +168,14 @@ def jellyfin_scrobble_video(data_dict: dict, user_id: Optional[int]):
|
|||||||
def manual_scrobble_video(imdb_id: str, user_id: int):
|
def manual_scrobble_video(imdb_id: str, user_id: int):
|
||||||
video = Video.find_or_create({"imdb_id": imdb_id})
|
video = Video.find_or_create({"imdb_id": imdb_id})
|
||||||
|
|
||||||
# TODO allow series to be marked with a source id
|
# When manually scrobbling, try finding a source from the series
|
||||||
|
if video.tv_series:
|
||||||
|
source = video.tv_series.preferred_source or "Vrobbler"
|
||||||
scrobble_dict = {
|
scrobble_dict = {
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
"timestamp": timezone.now(),
|
"timestamp": timezone.now(),
|
||||||
"playback_position_seconds": 0,
|
"playback_position_seconds": 0,
|
||||||
"source": "Vrobbler",
|
"source": source,
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scrobble.create_or_update(video, user_id, scrobble_dict)
|
return Scrobble.create_or_update(video, user_id, scrobble_dict)
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.5 on 2023-03-15 18:41
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("videos", "0013_video_next_imdb_id"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="series",
|
||||||
|
name="preferred_source",
|
||||||
|
field=models.CharField(blank=True, max_length=100, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -25,6 +25,7 @@ class Series(TimeStampedModel):
|
|||||||
imdb_id = models.CharField(max_length=20, **BNULL)
|
imdb_id = models.CharField(max_length=20, **BNULL)
|
||||||
imdb_rating = models.FloatField(**BNULL)
|
imdb_rating = models.FloatField(**BNULL)
|
||||||
cover_image = models.ImageField(upload_to="videos/series/", **BNULL)
|
cover_image = models.ImageField(upload_to="videos/series/", **BNULL)
|
||||||
|
preferred_source = models.CharField(max_length=100, **BNULL)
|
||||||
|
|
||||||
genre = TaggableManager(through=ObjectWithGenres)
|
genre = TaggableManager(through=ObjectWithGenres)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user