mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
add video subtitles and description to full-text index
This commit is contained in:
parent
1e3c1e3c83
commit
193df5c8d3
3 changed files with 15 additions and 1 deletions
|
@ -126,6 +126,7 @@ CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = {
|
||||||
'--write-sub',
|
'--write-sub',
|
||||||
'--all-subs',
|
'--all-subs',
|
||||||
'--write-auto-sub',
|
'--write-auto-sub',
|
||||||
|
'--convert-subs=srt',
|
||||||
'--yes-playlist',
|
'--yes-playlist',
|
||||||
'--continue',
|
'--continue',
|
||||||
'--ignore-errors',
|
'--ignore-errors',
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Tag(models.Model):
|
||||||
Based on django-taggit model
|
Based on django-taggit model
|
||||||
"""
|
"""
|
||||||
id = models.AutoField(primary_key=True, serialize=False, verbose_name='ID')
|
id = models.AutoField(primary_key=True, serialize=False, verbose_name='ID')
|
||||||
|
|
||||||
name = models.CharField(unique=True, blank=False, max_length=100)
|
name = models.CharField(unique=True, blank=False, max_length=100)
|
||||||
|
|
||||||
# slug is autoset on save from name, never set it manually
|
# slug is autoset on save from name, never set it manually
|
||||||
|
|
|
@ -70,11 +70,24 @@ def save_media(link: Link, out_dir: Optional[Path]=None, timeout: int=MEDIA_TIME
|
||||||
finally:
|
finally:
|
||||||
timer.end()
|
timer.end()
|
||||||
|
|
||||||
|
# add video description and subtitles to full-text index
|
||||||
|
index_texts = [
|
||||||
|
text_file.read_text(encoding='utf-8').strip()
|
||||||
|
for text_file in (
|
||||||
|
*output_path.glob('*.description'),
|
||||||
|
*output_path.glob('*.srt'),
|
||||||
|
*output_path.glob('*.vtt'),
|
||||||
|
*output_path.glob('*.lrc'),
|
||||||
|
*output_path.glob('*.lrc'),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=str(out_dir),
|
pwd=str(out_dir),
|
||||||
cmd_version=YOUTUBEDL_VERSION,
|
cmd_version=YOUTUBEDL_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
|
index_texts=index_texts,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue