57 lines
2.2 KiB
Go
57 lines
2.2 KiB
Go
package artifacts
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"gitea.maximumdirect.net/eric/narratio/internal/config"
|
|
)
|
|
|
|
// SessionPaths contains canonical local paths for one session work directory.
|
|
type SessionPaths struct {
|
|
WorkspaceRoot string
|
|
Root string
|
|
InputsDir string
|
|
AudioDir string
|
|
TranscriptsDir string
|
|
TranscriptsRawDir string
|
|
TranscriptsTrimmedDir string
|
|
ArtifactsDir string
|
|
ConfigDir string
|
|
LogsDir string
|
|
ManifestPath string
|
|
LockPath string
|
|
}
|
|
|
|
// SessionWorkDir returns the work directory for one session.
|
|
func SessionWorkDir(rootDir, sessionID string) string {
|
|
return filepath.Join(rootDir, config.PathWorkDirSegment, sessionID)
|
|
}
|
|
|
|
// SessionRunWorkDir returns the campaign/session/run scoped local work directory.
|
|
func SessionRunWorkDir(rootDir, campaign, sessionID, runID string) string {
|
|
return filepath.Join(rootDir, config.PathWorkDirSegment, campaign, sessionID, runID)
|
|
}
|
|
|
|
// SessionSpoolAudioDir returns the campaign/session/run scoped local spool audio path.
|
|
func SessionSpoolAudioDir(spoolRoot, campaign, sessionID, runID string) string {
|
|
return filepath.Join(spoolRoot, campaign, sessionID, runID, config.PathAudioDirSegment)
|
|
}
|
|
|
|
func buildSessionPaths(workspaceRoot, sessionID string) SessionPaths {
|
|
root := SessionWorkDir(workspaceRoot, sessionID)
|
|
return SessionPaths{
|
|
WorkspaceRoot: workspaceRoot,
|
|
Root: root,
|
|
InputsDir: filepath.Join(root, config.PathInputsDirSegment),
|
|
AudioDir: filepath.Join(root, config.PathAudioDirSegment),
|
|
TranscriptsDir: filepath.Join(root, config.PathTranscriptsSegment),
|
|
TranscriptsRawDir: filepath.Join(root, filepath.FromSlash(config.PathTranscriptsRaw)),
|
|
TranscriptsTrimmedDir: filepath.Join(root, filepath.FromSlash(config.PathTranscriptsTrimmed)),
|
|
ArtifactsDir: filepath.Join(root, config.PathArtifactsDirSegment),
|
|
ConfigDir: filepath.Join(root, config.PathConfigDirSegment),
|
|
LogsDir: filepath.Join(root, config.PathLogsDirSegment),
|
|
ManifestPath: filepath.Join(root, config.PathManifestFile),
|
|
LockPath: filepath.Join(root, config.PathLockFile),
|
|
}
|
|
}
|