Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,15 @@ See [sofie MEGAREPO-ASSETS-FETCH.md](https://github.com/tojemoc/sofie/blob/main/

### Media ingest layout

Stage clips under:
Stage media under the ingest/Caspar media root (two levels only):

```
<INGEST_MEDIA_ROOT>/spravy/<rundownId>/clips/<file>.mp4
```text
<INGEST_MEDIA_ROOT>/clips/<file>.mp4
<INGEST_MEDIA_ROOT>/loops/<file>
<INGEST_MEDIA_ROOT>/wipes/<file>
```

Set `INGEST_MEDIA_ROOT` in `backend/.env`, or override it in **Settings → Connection**. Paths in piece payloads use POSIX form: `spravy/<rundownId>/clips/<file>.mp4`.
Set `INGEST_MEDIA_ROOT` in `backend/.env`, or override it in **Settings → Connection**. Paths in piece payloads use POSIX form: `clips/<file>.mp4`.

### GFX preview

Expand Down
2 changes: 1 addition & 1 deletion backend/src/background/api/pieces.export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('mutatePieceForExport', () => {
makePiece({
pieceType: 'video',
start: 12,
payload: { fileName: 'spravy/demo/clips/vo.mp4' }
payload: { fileName: 'clips/vo.mp4' }
})
)

Expand Down
2 changes: 1 addition & 1 deletion backend/src/background/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export interface PayloadManifest {
label: string
type: ManifestFieldType
includeInName?: boolean
/** Subfolder under spravy/<rundownId>/ for mediaPick fields (default: clips) */
/** Subfolder under the ingest/media root for mediaPick fields (default: clips) */
subdir?: string
/** Fixed choices for string fields (rendered as radio buttons when set) */
options?: string[]
Expand Down
18 changes: 9 additions & 9 deletions backend/src/background/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ export function getPreviewBaseUrl(): string {
return DEFAULT_PREVIEW_BASE_URL
}

function resolveIngestSubdir(rundownId: string, subdir: string): string {
function resolveIngestSubdir(subdir: string): string {
const ingestRoot = path.resolve(getIngestMediaRoot())
const targetDir = path.resolve(ingestRoot, 'spravy', rundownId, subdir)
const safeSubdir = subdir.replace(/[/\\]/g, '')
const targetDir = path.resolve(ingestRoot, safeSubdir)

if (!targetDir.startsWith(ingestRoot + path.sep) && targetDir !== ingestRoot) {
throw new Error('Invalid media path')
Expand All @@ -39,14 +40,13 @@ function resolveIngestSubdir(rundownId: string, subdir: string): string {
return targetDir
}

function getRundownMediaFolder(rundownId: string, subdir: string = DEFAULT_SUBDIR): string {
const safeSubdir = subdir.replace(/[/\\]/g, '')
return resolveIngestSubdir(rundownId, safeSubdir)
function getRundownMediaFolder(_rundownId: string, subdir: string = DEFAULT_SUBDIR): string {
return resolveIngestSubdir(subdir)
}

function getRelativeRundownMediaFolder(rundownId: string, subdir: string): string {
function getRelativeRundownMediaFolder(_rundownId: string, subdir: string): string {
const safeSubdir = subdir.replace(/[/\\]/g, '')
return path.posix.join('spravy', rundownId, safeSubdir)
return safeSubdir
}

export function resolveMediaAbsolutePath(relativePath: string): string {
Expand Down Expand Up @@ -259,9 +259,9 @@ export async function probeRelativeMediaDurationSeconds(

export interface RundownMediaListing {
files: MediaFileEntry[]
/** Path relative to ingest root, e.g. spravy/<rundownId>/clips */
/** Path relative to ingest root, e.g. clips */
folderPath: string
/** Absolute filesystem path for the rundown clips folder */
/** Absolute filesystem path for the media subfolder */
absoluteFolderPath: string
folderExists: boolean
ingestMediaRoot: string
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/rundown/mediaPickerField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function MediaPickerField({
}
}, [applyListing, rundownId, subdir])

const logicalFolderPath = folderPath ?? `spravy/${rundownId}/${subdir}`
const logicalFolderPath = folderPath ?? subdir
const absolutePath =
absoluteFolderPath ??
(ingestMediaRoot ? `${ingestMediaRoot.replace(/[/\\]+$/, '')}/${logicalFolderPath}` : null)
Expand All @@ -178,7 +178,7 @@ export function MediaPickerField({
name={name}
list={datalistId}
value={value ?? ''}
placeholder="e.g. spravy/my-rundown/clips/clip.mp4"
placeholder={`e.g. ${subdir}/clip.mp4`}
disabled={initialLoading}
onBlur={() => {
onBlur()
Expand Down Expand Up @@ -244,7 +244,7 @@ export function MediaPickerField({
at <code>{logicalFolderPath}</code>
</>
)}
. Paths are relative to the ingest root (same tree Softie Package Manager uses). You can
. Paths are relative to the ingest root (same tree Sofie Package Manager uses). You can
still type a path above.
</Form.Text>
<Button
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/settings/coreConnectionSettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ export function CoreConnectionSettingsForm({ settings }: { settings: Application
<Form.Text className="text-muted">
Clips are listed from{' '}
<code>
&lt;ingest root&gt;/spravy/&lt;rundownId&gt;/clips/
</code>
. File name / ILU clip fields also accept any path typed relative to this
root (same layout Softie Package Manager expects). Overrides{' '}
<code>INGEST_MEDIA_ROOT</code> in backend <code>.env</code> when set. In Docker
this is often <code>/app/ingest</code> — mount your media tree there or change
this setting.
&lt;ingest root&gt;/clips/
</code>{' '}
(also <code>loops/</code>, <code>wipes/</code>). File name / ILU clip fields
use two-level paths like <code>clips/foo.mp4</code> — same layout Sofie Package
Manager expects. Overrides <code>INGEST_MEDIA_ROOT</code> in backend{' '}
<code>.env</code> when set. In Docker this is often <code>/app/ingest</code> —
mount your media tree there or change this setting.
</Form.Text>
</Form.Group>
<FieldInfo field={field} />
Expand Down