Merge branch 'meeb:main' into main-delete-files-on-disk
This commit is contained in:
commit
9c18115032
|
@ -1241,7 +1241,6 @@ class Media(models.Model):
|
||||||
acodec = self.downloaded_audio_codec
|
acodec = self.downloaded_audio_codec
|
||||||
if acodec is None:
|
if acodec is None:
|
||||||
raise TypeError() # nothing here.
|
raise TypeError() # nothing here.
|
||||||
|
|
||||||
acodec = acodec.lower()
|
acodec = acodec.lower()
|
||||||
if acodec == "mp4a":
|
if acodec == "mp4a":
|
||||||
return "audio/mp4"
|
return "audio/mp4"
|
||||||
|
@ -1250,7 +1249,6 @@ class Media(models.Model):
|
||||||
else:
|
else:
|
||||||
# fall-fall-back.
|
# fall-fall-back.
|
||||||
return 'audio/ogg'
|
return 'audio/ogg'
|
||||||
|
|
||||||
vcodec = vcodec.lower()
|
vcodec = vcodec.lower()
|
||||||
if vcodec == 'vp9':
|
if vcodec == 'vp9':
|
||||||
return 'video/webm'
|
return 'video/webm'
|
||||||
|
@ -1286,7 +1284,8 @@ class Media(models.Model):
|
||||||
nfo.append(season)
|
nfo.append(season)
|
||||||
# episode = number of video in the year
|
# episode = number of video in the year
|
||||||
episode = nfo.makeelement('episode', {})
|
episode = nfo.makeelement('episode', {})
|
||||||
episode.text = str(self.calculate_episode_number()) # Remplacez par la logique de calcul
|
episode_number = self.calculate_episode_number()
|
||||||
|
episode.text = str(episode_number) if episode_number else ''
|
||||||
episode.tail = '\n '
|
episode.tail = '\n '
|
||||||
nfo.append(episode)
|
nfo.append(episode)
|
||||||
# ratings = media metadata youtube rating
|
# ratings = media metadata youtube rating
|
||||||
|
@ -1420,7 +1419,6 @@ class Media(models.Model):
|
||||||
self_year = self.upload_date.year if self.upload_date else self.created.year
|
self_year = self.upload_date.year if self.upload_date else self.created.year
|
||||||
filtered_media = Media.objects.filter(source=self.source, published__year=self_year)
|
filtered_media = Media.objects.filter(source=self.source, published__year=self_year)
|
||||||
sorted_media = sorted(filtered_media, key=lambda x: (x.upload_date, x.key))
|
sorted_media = sorted(filtered_media, key=lambda x: (x.upload_date, x.key))
|
||||||
|
|
||||||
position_counter = 1
|
position_counter = 1
|
||||||
for media in sorted_media:
|
for media in sorted_media:
|
||||||
if media == self:
|
if media == self:
|
||||||
|
|
|
@ -661,8 +661,8 @@ class MediaTestCase(TestCase):
|
||||||
'<episodedetails>',
|
'<episodedetails>',
|
||||||
' <title>no fancy stuff title</title>',
|
' <title>no fancy stuff title</title>',
|
||||||
' <showtitle>testname</showtitle>',
|
' <showtitle>testname</showtitle>',
|
||||||
' <season>2020</season>',
|
' <season>2017</season>',
|
||||||
' <episode>1</episode>',
|
' <episode></episode>',
|
||||||
' <ratings>',
|
' <ratings>',
|
||||||
' <rating default="True" max="5" name="youtube">',
|
' <rating default="True" max="5" name="youtube">',
|
||||||
' <value>1.2345</value>',
|
' <value>1.2345</value>',
|
||||||
|
|
Loading…
Reference in New Issue