mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-24 09:55:12 +00:00
feat(import): include cover-art attachments in --export/--import
Export URL-backed attachments per title and rebuild them on import so they ride along into the muxed output. Local font attachments are skipped (not portable).
This commit is contained in:
@@ -18,6 +18,7 @@ from unshackle.core.manifests import DASH, HLS, ISM
|
||||
from unshackle.core.remote_service import RemoteService, _build_title, _resolve_proxy
|
||||
from unshackle.core.titles import Episode, Movies, Series, Title_T, Titles_T, remap_titles
|
||||
from unshackle.core.tracks import Audio, Chapter, Chapters, Tracks, Video
|
||||
from unshackle.core.tracks.attachment import Attachment
|
||||
from unshackle.core.tracks.track import Track
|
||||
|
||||
log = logging.getLogger("import")
|
||||
@@ -166,6 +167,23 @@ class ImportService:
|
||||
track.drm = drm
|
||||
tracks.add(track)
|
||||
|
||||
for attachment in entry.get("attachments") or []:
|
||||
url = attachment.get("url")
|
||||
if not url:
|
||||
continue
|
||||
try:
|
||||
tracks.attachments.append(
|
||||
Attachment.from_url(
|
||||
url,
|
||||
name=attachment.get("name"),
|
||||
mime_type=attachment.get("mime_type"),
|
||||
description=attachment.get("description"),
|
||||
session=self.session,
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
self.log.warning(f"Skipping attachment '{attachment.get('name')}': {e}")
|
||||
|
||||
self.tracks_by_title[title_id] = tracks
|
||||
return tracks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user