Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49889ae297 | |||
| 4d573bc934 | |||
| bdd0f19161 |
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "vrobbler"
|
||||
version = "0.1.8"
|
||||
version = "0.1.9"
|
||||
description = ""
|
||||
authors = ["Colin Powell <colin@unbl.ink>"]
|
||||
|
||||
|
||||
25
vrobbler/apps/music/migrations/0004_track_thumbs.py
Normal file
25
vrobbler/apps/music/migrations/0004_track_thumbs.py
Normal file
@ -0,0 +1,25 @@
|
||||
# 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,
|
||||
),
|
||||
),
|
||||
]
|
||||
@ -42,6 +42,11 @@ class Artist(TimeStampedModel):
|
||||
|
||||
|
||||
class Track(TimeStampedModel):
|
||||
class Opinion(models.IntegerChoices):
|
||||
DOWN = -1, 'Thumbs down'
|
||||
NEUTRAL = 0, 'No opinion'
|
||||
UP = 1, 'Thumbs up'
|
||||
|
||||
uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)
|
||||
title = models.CharField(max_length=255, **BNULL)
|
||||
artist = models.ForeignKey(Artist, on_delete=models.DO_NOTHING)
|
||||
@ -49,6 +54,7 @@ class Track(TimeStampedModel):
|
||||
musicbrainz_id = models.CharField(max_length=255, **BNULL)
|
||||
run_time = models.CharField(max_length=8, **BNULL)
|
||||
run_time_ticks = models.PositiveBigIntegerField(**BNULL)
|
||||
thumbs = models.IntegerField(default=Opinion.NEUTRAL, choices=Opinion.choices)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title} by {self.artist}"
|
||||
|
||||
@ -103,15 +103,6 @@ class Scrobble(TimeStampedModel):
|
||||
.order_by('-modified')
|
||||
.first()
|
||||
)
|
||||
# Check if playback_position_ticks has changed from this scrobble
|
||||
scrobble_changed = (
|
||||
scrobble
|
||||
and scrobble.playback_position_ticks
|
||||
!= jellyfin_data['playback_position_ticks']
|
||||
)
|
||||
if not scrobble_changed:
|
||||
logger.info('Scrobble playback has not changed, not scrobbling')
|
||||
return
|
||||
|
||||
# Backoff is how long until we consider this a new scrobble
|
||||
backoff = timezone.now() + timedelta(minutes=VIDEO_BACKOFF)
|
||||
|
||||
Reference in New Issue
Block a user