Updating tests to match searching for Channel and Domain names for directories.

This commit is contained in:
Roland 2023-05-03 12:59:47 -06:00
parent 2cbc6e00e0
commit 8de805b6d1
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
4 changed files with 30 additions and 13 deletions

View file

@ -446,7 +446,7 @@ def search_archives(search_str: str, domain: str, limit: int, offset: int, order
@optional_session
def search_domains_by_directory(name: str, limit: int = 5, session: Session = None) -> List[Domain]:
domains = session.query(Domain) \
.filter(Domain.directory.ilike(f'%{name}%')) \
.filter(Domain.domain.ilike(f'%{name}%')) \
.order_by(asc(Domain.domain)) \
.limit(limit) \
.all()

View file

@ -247,7 +247,7 @@ class Video(ModelHelper, Base):
@property
def caption_files(self) -> List[dict]:
return self.file_group.my_files('text/srt') + self.file_group.my_files('text/vtt')
return self.file_group.my_files('text/vtt') + self.file_group.my_files('text/srt')
@property
def caption_paths(self) -> List[pathlib.Path]:
@ -258,14 +258,14 @@ class Video(ModelHelper, Base):
caption_paths = self.caption_paths
# Some SRT files are more supported than others, these are their preferred order.
caption_text = None
if english_srt := [i for i in caption_paths if i.name.endswith('.en.srt')]:
caption_text = read_captions(english_srt[0])
elif srt := [i for i in caption_paths if i.name.endswith('.srt')]:
caption_text = read_captions(srt[0])
elif english_vtt := [i for i in caption_paths if i.name.endswith('.en.vtt')]:
if english_vtt := [i for i in caption_paths if i.name.endswith('.en.vtt')]:
caption_text = read_captions(english_vtt[0])
elif vtt := [i for i in caption_paths if i.name.endswith('.vtt')]:
caption_text = read_captions(vtt[0])
elif english_srt := [i for i in caption_paths if i.name.endswith('.en.srt')]:
caption_text = read_captions(english_srt[0])
elif srt := [i for i in caption_paths if i.name.endswith('.srt')]:
caption_text = read_captions(srt[0])
return caption_text