SubmarinerApp / Submariner

A Subsonic client for macOS
https://submarinerapp.com
BSD 3-Clause "New" or "Revised" License
133 stars 4 forks source link

Failed to import flac file locally #91

Open BigNerdCoding opened 1 year ago

BigNerdCoding commented 1 year ago
 private func initializeAudioToolbox(URL: NSURL) throws {
        let asset = AVURLAsset.init(url: URL as URL);
        let matadata = asset.commonMetadata;

        var err: OSStatus
        var af: AudioFileID!
        err = AudioFileOpenURL(URL, .readPermission, 0, &af)
        if (err != noErr) {
            throw NSError(domain: NSOSStatusErrorDomain, code: Int(err))
        }
        defer {
            AudioFileClose(af)
        }

       ....

this will alway failed , maybe we need some other tools to read id3 tag like : https://github.com/eni9889/TagLib-ObjC

one more thing:

[NSURL temporaryFileURL]

The current temporary path is not under the user path, and a more reasonable location should be ~/music/Submariner/temp/uuid

NattyNarwhal commented 1 year ago

this will alway failed , maybe we need some other tools to read id3 tag like : https://github.com/eni9889/TagLib-ObjC

Yeah, the current thing was a stopgap until I could figure out a reasonable way to include TagLib or something (There are a few Objective-C wrappers around it, but I don't know what one is best maintained.). The system audio metadata APIs aren't very robust, though I'm curious what the failure is.

The current temporary path is not under the user path, and a more reasonable location should be ~/music/Submariner/temp/uuid

Reading SBImportOperation, it seems path is just used as a temporary thing, and the files are actually either linked by their normal name, or given a reasonably human-readable filename in ~/Music/Submariner. It's odd that it's even copying the files twice, IMHO - I'm wondering why it can't just use aPath directly?