Fix published paths for transcoded media

This commit is contained in:
Abel Luck 2026-03-31 14:14:46 +02:00
parent 3f33994cdc
commit 89d462e280
9 changed files with 956 additions and 114 deletions

View file

@ -19,7 +19,13 @@ from repub.rss import (
plain_text_summary,
sanitize_html,
)
from repub.utils import FileType, determine_file_type, local_file_path, local_image_path
from repub.utils import (
FileType,
canonical_published_media_path,
determine_file_type,
local_file_path,
local_image_path,
)
class BaseRssFeedSpider(Spider):
@ -51,8 +57,18 @@ class BaseRssFeedSpider(Spider):
local_path = local_image_path(url)
elif file_type == FileType.VIDEO:
file_dir = self.settings["REPUBLISHER_VIDEO_DIR"]
local_path = canonical_published_media_path(
FileType.VIDEO,
url,
self.settings["REPUBLISHER_VIDEO"],
)
elif file_type == FileType.AUDIO:
file_dir = self.settings["REPUBLISHER_AUDIO_DIR"]
local_path = canonical_published_media_path(
FileType.AUDIO,
url,
self.settings["REPUBLISHER_AUDIO"],
)
relative_path = f"{file_dir}/{local_path}"
return self.absolute_feed_url(relative_path)