replaygain: Prepare song model for rg retrieval

This commit is contained in:
Daan Sprenkels
2017-09-16 13:15:35 +02:00
parent 7c69c71392
commit 9c03c9bdc5
3 changed files with 38 additions and 2 deletions

View File

@ -8,7 +8,9 @@ def song_to_dict(song, hash=False, user=False):
'id': song.id,
'artist': song.artist,
'title': song.title,
'duration': song.duration
'duration': song.duration,
'rg_gain': song.rg_gain,
'rg_peak': song.rg_peak,
}
if hash:

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-18 12:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('songs', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='song',
name='rg_gain',
field=models.DecimalField(blank=True, decimal_places=6, help_text='replaygain gain level', max_digits=9, null=True),
),
migrations.AddField(
model_name='song',
name='rg_peak',
field=models.DecimalField(blank=True, decimal_places=6, help_text='replaygain peak level', max_digits=9, null=True),
),
migrations.AlterField(
model_name='song',
name='duration',
field=models.IntegerField(help_text='track duration in seconds'),
),
]

View File

@ -12,7 +12,11 @@ class Song(models.Model):
artist = models.TextField()
title = models.TextField()
hash = models.TextField()
duration = models.IntegerField()
duration = models.IntegerField(help_text="track duration in seconds")
rg_gain = models.DecimalField(max_digits=9, decimal_places=6,
blank=True, null=True, help_text="replaygain gain level")
rg_peak = models.DecimalField(max_digits=9, decimal_places=6,
blank=True, null=True, help_text="replaygain peak level")
old_id = models.TextField(blank=True, null=True, default=None)
deleted = models.BooleanField(default=False)