mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 14:36:34 +00:00
Merge pull request #746 from tcely/patch-2
Some checks are pending
Run Django tests for TubeSync / test (3.10) (push) Waiting to run
Run Django tests for TubeSync / test (3.11) (push) Waiting to run
Run Django tests for TubeSync / test (3.12) (push) Waiting to run
Run Django tests for TubeSync / test (3.7) (push) Waiting to run
Run Django tests for TubeSync / test (3.8) (push) Waiting to run
Run Django tests for TubeSync / test (3.9) (push) Waiting to run
Run Django tests for TubeSync / containerise (push) Waiting to run
Some checks are pending
Run Django tests for TubeSync / test (3.10) (push) Waiting to run
Run Django tests for TubeSync / test (3.11) (push) Waiting to run
Run Django tests for TubeSync / test (3.12) (push) Waiting to run
Run Django tests for TubeSync / test (3.7) (push) Waiting to run
Run Django tests for TubeSync / test (3.8) (push) Waiting to run
Run Django tests for TubeSync / test (3.9) (push) Waiting to run
Run Django tests for TubeSync / containerise (push) Waiting to run
Select a combined format if nothing else is available
This commit is contained in:
commit
570a150150
@ -822,6 +822,25 @@ class Media(models.Model):
|
|||||||
if audio_format and video_format:
|
if audio_format and video_format:
|
||||||
return f'{video_format}+{audio_format}'
|
return f'{video_format}+{audio_format}'
|
||||||
else:
|
else:
|
||||||
|
# last resort: any combined format
|
||||||
|
fallback_hd_cutoff = getattr(settings, 'VIDEO_HEIGHT_IS_HD', 500)
|
||||||
|
|
||||||
|
for fmt in reversed(list(self.iter_formats())):
|
||||||
|
select_fmt = (
|
||||||
|
fmt.get('id') and
|
||||||
|
fmt.get('acodec') and
|
||||||
|
fmt.get('vcodec') and
|
||||||
|
self.source.can_fallback and
|
||||||
|
(
|
||||||
|
(self.source.fallback == Val(Fallback.NEXT_BEST)) or
|
||||||
|
(
|
||||||
|
self.source.fallback == Val(Fallback.NEXT_BEST_HD) and
|
||||||
|
(fmt.get('height') or 0) >= fallback_hd_cutoff
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if select_fmt:
|
||||||
|
return str(fmt.get('id'))
|
||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user