Skip to content

feat(importer): expand ISO contents in RAR/7zip, keep only largest file - #366

Merged
javi11 merged 2 commits into
mainfrom
feat/iso-expand-keep-largest-only
Feb 27, 2026
Merged

feat(importer): expand ISO contents in RAR/7zip, keep only largest file#366
javi11 merged 2 commits into
mainfrom
feat/iso-expand-keep-largest-only

Conversation

@javi11

@javi11 javi11 commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • When a RAR or 7zip archive contains an ISO, the ISO is now expanded at import time and only the largest media stream (main feature) is kept; smaller streams (e.g. bonus M2TS tracks) are silently discarded.
  • The kept file is renamed to releaseName.ext (no index suffix) using the NZB basename.
  • Introduces internal/importer/archive/iso package with ISO analysis logic.
  • Threads maxDownloadPrefetch and readTimeout through Processor and both ProcessArchive functions so the ISO reader has the required Usenet segment parameters.

Changes

  • internal/importer/archive/iso/ — new package: ISO filesystem traversal and media file analysis
  • internal/importer/archive/rar/types.go — add ISOExpansionIndex field to Content
  • internal/importer/archive/rar/aggregator.go — add expandISOContents, wire into ProcessArchive, rename expanded file
  • internal/importer/archive/sevenzip/types.go — same ISOExpansionIndex addition
  • internal/importer/archive/sevenzip/aggregator.go — same expandISOContents + wiring
  • internal/importer/processor.go — store and forward maxDownloadPrefetch / readTimeout

Test plan

  • Single-stream ISO inside RAR → one file named releaseName.M2TS
  • Multi-stream ISO (e.g. 3 M2TS files) inside RAR → only the largest appended, named releaseName.M2TS
  • Non-ISO RAR/7zip → expandISOContents skips non-ISO entries, behavior unchanged
  • ISO analysis failure → original ISO Content kept as-is (non-fatal warn)
  • go build ./internal/importer/archive/... passes with no errors

🤖 Generated with Claude Code

javi11 and others added 2 commits February 27, 2026 15:56
…gest file

When an ISO inside a RAR or 7zip archive is expanded, only the largest
media stream (main feature) is retained; smaller streams (e.g. bonus
M2TS tracks) are silently discarded.

- Add `ISOExpansionIndex` field to RAR and 7zip `Content` types
- Add `expandISOContents` helper to both aggregators; sorts ISO files by
  size descending, appends only `isoFiles[0]`
- Rename kept file to `releaseName.ext` (no index suffix) using the NZB
  basename
- Thread `maxDownloadPrefetch` and `readTimeout` through `Processor` and
  `ProcessArchive` so the ISO reader has the required Usenet parameters
- Introduce `internal/importer/archive/iso` package with ISO analysis

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ray_iso

Add `expand_bluray_iso *bool` to `ImportConfig` (defaults to true when nil,
preserving existing behaviour). The flag is threaded from config → service →
processor → rar/sevenzip ProcessArchive → expandISOContents, where a false
value short-circuits the expansion and keeps the original ISO entry unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javi11
javi11 merged commit e954a64 into main Feb 27, 2026
1 check passed
@javi11
javi11 deleted the feat/iso-expand-keep-largest-only branch February 27, 2026 20:26
yoshitaka420 pushed a commit to yoshitaka420/altmount that referenced this pull request Jun 1, 2026
…le (kipsilabs#366)

* feat(importer): expand ISO contents in RAR/7zip and keep only the largest file

When an ISO inside a RAR or 7zip archive is expanded, only the largest
media stream (main feature) is retained; smaller streams (e.g. bonus
M2TS tracks) are silently discarded.

- Add `ISOExpansionIndex` field to RAR and 7zip `Content` types
- Add `expandISOContents` helper to both aggregators; sorts ISO files by
  size descending, appends only `isoFiles[0]`
- Rename kept file to `releaseName.ext` (no index suffix) using the NZB
  basename
- Thread `maxDownloadPrefetch` and `readTimeout` through `Processor` and
  `ProcessArchive` so the ISO reader has the required Usenet parameters
- Introduce `internal/importer/archive/iso` package with ISO analysis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant