if media is downloaded use the downloaded filename and not generated filenames based on metadata parameters for addtional metadata files, resolves, resolves #67, resolves #83, resolves #204
This commit is contained in:
parent
2335ceb2dc
commit
538b3cb319
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.12 on 2022-04-06 06:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('sync', '0011_auto_20220201_1654'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='media',
|
||||
name='downloaded_format',
|
||||
field=models.CharField(blank=True, help_text='Video format (resolution) of the downloaded media', max_length=30, null=True, verbose_name='downloaded format'),
|
||||
),
|
||||
]
|
|
@ -691,7 +691,7 @@ class Media(models.Model):
|
|||
max_length=30,
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text=_('Audio codec of the downloaded media')
|
||||
help_text=_('Video format (resolution) of the downloaded media')
|
||||
)
|
||||
downloaded_height = models.PositiveIntegerField(
|
||||
_('downloaded height'),
|
||||
|
@ -832,6 +832,9 @@ class Media(models.Model):
|
|||
'hdr': hdr,
|
||||
'format': tuple(fmt),
|
||||
}
|
||||
if self.downloaded_format:
|
||||
resolution = self.downloaded_format.lower()
|
||||
elif self.downloaded_height:
|
||||
resolution = f'{self.downloaded_height}p'
|
||||
if self.downloaded_format != 'audio':
|
||||
vcodec = self.downloaded_video_codec.lower()
|
||||
|
@ -1064,6 +1067,9 @@ class Media(models.Model):
|
|||
|
||||
@property
|
||||
def thumbname(self):
|
||||
if self.downloaded and self.media_file:
|
||||
filename = os.path.basename(self.media_file.path)
|
||||
else:
|
||||
filename = self.filename
|
||||
prefix, ext = os.path.splitext(filename)
|
||||
return f'{prefix}.jpg'
|
||||
|
@ -1074,6 +1080,9 @@ class Media(models.Model):
|
|||
|
||||
@property
|
||||
def nfoname(self):
|
||||
if self.downloaded and self.media_file:
|
||||
filename = os.path.basename(self.media_file.path)
|
||||
else:
|
||||
filename = self.filename
|
||||
prefix, ext = os.path.splitext(filename)
|
||||
return f'{prefix}.nfo'
|
||||
|
@ -1084,7 +1093,10 @@ class Media(models.Model):
|
|||
|
||||
@property
|
||||
def jsonname(self):
|
||||
if self.downloaded and self.media_file:
|
||||
filename = os.path.basename(self.media_file.path)
|
||||
else:
|
||||
filename = self.filename
|
||||
prefix, ext = os.path.splitext(filename)
|
||||
return f'{prefix}.info.json'
|
||||
|
||||
|
|
Loading…
Reference in New Issue