mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 15:06:19 -05:00
Ignoring videos with no duration when filtering by min/max duration.
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Some checks failed
CodeQL / Analyze (push) Has been cancelled
This commit is contained in:
parent
eb8124b391
commit
2bca298ed3
1 changed files with 3 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import logging
|
|||
import os.path
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
from abc import ABC
|
||||
from datetime import timedelta
|
||||
|
|
@ -289,9 +290,9 @@ class ChannelDownloader(Downloader, ABC):
|
|||
# Filter videos by their length.
|
||||
try:
|
||||
if minimum_duration := settings.get('minimum_duration'):
|
||||
downloads = [i for i in downloads if int(i['duration']) >= minimum_duration]
|
||||
downloads = [i for i in downloads if (d := i.get('duration')) and int(d) >= minimum_duration]
|
||||
if maximum_duration := settings.get('maximum_duration'):
|
||||
downloads = [i for i in downloads if int(i['duration']) <= maximum_duration]
|
||||
downloads = [i for i in downloads if (d := i.get('duration')) and int(d) <= maximum_duration]
|
||||
except KeyError as e:
|
||||
raise RuntimeError('Unable to filter videos because there is no duration') from e
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue