stash icon indicating copy to clipboard operation
stash copied to clipboard

Audio Backend

Open bob12224 opened this issue 7 months ago • 11 comments

This is a copy-paste setup for the backend to support AUDIO, similar to how Scene's and Images are handled.

Please see the docs/dev/AUDIO.md for the SCOPE and as a place for general discussion.

There is no new design, it copies form SCENES and then removes what is unrelated Exception: FrameRate has been changed to SampleRate (FFPROBE already grabs this)

Relates to: #1258

TODOs that require Reviewer input

└─ stash
   ├─ audio.graphql
   │  ├─ line 11: TODO (audio|AudioCaption): need to update IF AudioCaption required
   │  └─ line 29: TODO (audio|AudioCaption): need to update IF AudioCaption required
   ├─ resolver_model_audio.go
   │  └─ line 119: TODO (audio|AudioCaption): need to update IF AudioCaption required
   ├─ audio.go
   │  └─ line 84: TODO (audio): can we return no urls?
   ├─ config.go
   │  └─ line 857: TODO (audio): update this to AudioFileNamingAlgorithm?
   ├─ fingerprint.go
   │  └─ line 67: TODO (audio): should Audio's also use OSHash instead of md5 for default (if so, then will need to update Audios)
   ├─ manager_tasks.go
   │  └─ line 34: TODO (audio): figure out this IF condition
   ├─ repository.go
   │  └─ line 30: TODO (audio): is this only used for stashbox?
   ├─ delete.go
   │  └─ line 42: TODO (future|audio generated files): add paths here
   ├─ migrate_hash.go
   │  └─ line 1: TODO (audio): should this file be deleted since there are no transcodes?
   ├─ scan.go
   │  └─ line 46: TODO (audio): this PR has no generation
   ├─ browser.go
   │  └─ line 91: TODO (audio): do we need to check ProbeAudioCodec for audio containers? (i.e. can `.mp3` contain a codec we need to transcode for?
   ├─ container.go
   │  └─ line 17: TODO (audio): better way to do this, without suffix this clashes with `Mp3 ProbeAudioCodec`
   ├─ caption.go
   │  └─ line 1: TODO (audio): Can this file be deleted if we utilize VideoCaptions?
   ├─ caption_test.go
   │  └─ line 1: TODO (audio): Can this file be deleted if we utilize audioCaptions?
   ├─ model_audio.go
   │  └─ line 235: TODO (audio): don't know if we need this, using VideoCaption for now due to `pkg/models/repository_file.go` and `FileReader` using
   └─ file.go
      └─ line 27: TODO (audio|AudioCaption): need to update IF AudioCaption required

bob12224 avatar Apr 13 '26 03:04 bob12224

tbh there is no reason why audios should not just be scenes and why there would be a dedicated section for them.

rezreal avatar Apr 16 '26 22:04 rezreal

@Gykes I can see nothing else required for this PR. In your court. Please see my TODO notes that require your input

bob12224 avatar Apr 29 '26 02:04 bob12224

Will give it a gander tomorrow probably. I don't have the brain power right now to look over a 13k addition lol

Gykes avatar Apr 29 '26 03:04 Gykes

Will give it a gander tomorrow probably. I don't have the brain power right now to look over a 13k addition lol

Any luck, haven't seen any PR comments yet

bob12224 avatar May 03 '26 19:05 bob12224

Will give it a gander tomorrow probably. I don't have the brain power right now to look over a 13k addition lol

Any luck, haven't seen any PR comments yet

I have various thoughts lined up. Been thinking on stuff the last few days passively. I will start putting my thoughts in now so you can think on it as well.

Gykes avatar May 03 '26 19:05 Gykes

I see you making review comments. I am currently beginning my move and wont be setup back up fully till around the 16th. I still have my laptop and MAY get to them if I'm bored or have time to kill during transit. I haven't forgotten but just ping me after the 15th if you think I have

Gykes avatar May 08 '26 02:05 Gykes

I have no other things to work on this ticket, so I will work on the audio UI ticket while waiting for more PR comments

bob12224 avatar May 17 '26 22:05 bob12224

Still haven't forgotten. This move has been so much longer and filled with so many roadblocks it's insane. Have had 0 mental capacity to review something this large lately lol

Gykes avatar May 27 '26 20:05 Gykes

Branch has conflicts and build fails.

slick-daddy avatar Jun 14 '26 18:06 slick-daddy

All pr comments addressed. It would be great if they could be marked resolved when the author's get a chance

bob12224 avatar Jun 17 '26 00:06 bob12224

you can have audio support (well mostly, phashes dont work, an that you could hide the filter section - while having an audio normaliaztion filter would be actually nice) with these few lines of js by just using the webm transcode.

PluginApi.patch.instead("ScenePlayer", function (props, params, next) {
console.info(next)
    let scene = props.scene
    if (scene.files.some(file => file.path.endsWith('.mp3') || file.path.endsWith('.m4a'))) {
        scene = {
            ...scene,
            sceneStreams: scene.sceneStreams.filter(ss => ss.label === 'WEBM')
        }
    }
    return next({...props, scene}, params);
});

Audio can be just scenes. You can have (predefined) filters to take them apart. Whats the difference between having audio gone wild or porn clip. You can have groups as container for multi-part audio. code architecture wise I'd see it as a mistake just to "copy everything" is a horrible design choice code wise imo.

rezreal avatar Jun 18 '26 23:06 rezreal