mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-05-23 08:19:50 +02:00
fix: resolve Go staticcheck warnings in audio_metadata.go and qobuz.go
This commit is contained in:
@@ -430,11 +430,12 @@ func extendedHeaderSize(data []byte, version byte) int {
|
||||
return 0
|
||||
}
|
||||
var size int
|
||||
if version == 3 {
|
||||
switch version {
|
||||
case 3:
|
||||
size = int(binary.BigEndian.Uint32(data[:4]))
|
||||
} else if version == 4 {
|
||||
case 4:
|
||||
size = syncsafeToInt(data[:4])
|
||||
} else {
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
if size <= 0 {
|
||||
@@ -624,14 +625,6 @@ func readOggPageWithHeader(file *os.File) (*oggPage, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func readOggPage(file *os.File) ([]byte, error) {
|
||||
page, err := readOggPageWithHeader(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return page.data, nil
|
||||
}
|
||||
|
||||
func collectOggPackets(file *os.File, maxPackets, maxPages int) ([][]byte, error) {
|
||||
const maxPacketSize = 10 * 1024 * 1024
|
||||
var packets [][]byte
|
||||
@@ -930,11 +923,12 @@ func extractMP3CoverArt(filePath string) ([]byte, string, error) {
|
||||
}
|
||||
|
||||
var frameSize int
|
||||
if majorVersion == 2 {
|
||||
switch majorVersion {
|
||||
case 2:
|
||||
frameSize = int(tagData[pos+3])<<16 | int(tagData[pos+4])<<8 | int(tagData[pos+5])
|
||||
} else if majorVersion == 4 {
|
||||
case 4:
|
||||
frameSize = int(tagData[pos+4])<<21 | int(tagData[pos+5])<<14 | int(tagData[pos+6])<<7 | int(tagData[pos+7])
|
||||
} else {
|
||||
default:
|
||||
frameSize = int(tagData[pos+4])<<24 | int(tagData[pos+5])<<16 | int(tagData[pos+6])<<8 | int(tagData[pos+7])
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -764,10 +764,9 @@ type qobuzAPIResult struct {
|
||||
// Qobuz API timeout configuration
|
||||
// Mobile networks are more unstable, so we use longer timeouts
|
||||
const (
|
||||
qobuzAPITimeoutDesktop = 15 * time.Second
|
||||
qobuzAPITimeoutMobile = 25 * time.Second
|
||||
qobuzMaxRetries = 2 // Number of retries per API
|
||||
qobuzRetryDelay = 500 * time.Millisecond
|
||||
qobuzAPITimeoutMobile = 25 * time.Second
|
||||
qobuzMaxRetries = 2 // Number of retries per API
|
||||
qobuzRetryDelay = 500 * time.Millisecond
|
||||
)
|
||||
|
||||
// getQobuzAPITimeout returns appropriate timeout based on platform
|
||||
|
||||
Reference in New Issue
Block a user