Run gofumpt on the project
This commit is contained in:
+1
-1
@@ -317,7 +317,7 @@ func (c *Config) WriteConfigFile(filepath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
os.WriteFile(filepath, b, 0644)
|
||||
os.WriteFile(filepath, b, 0o644)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ type ImageCache struct {
|
||||
cache map[string]CacheItem
|
||||
}
|
||||
|
||||
var (
|
||||
ErrNotFound = errors.New("item not found")
|
||||
)
|
||||
var ErrNotFound = errors.New("item not found")
|
||||
|
||||
func (i *ImageCache) Init(ctx context.Context, evictionInterval time.Duration) {
|
||||
i.cache = make(map[string]CacheItem)
|
||||
@@ -238,5 +236,4 @@ func (i *ImageCache) EvictExpired() {
|
||||
delete(i.cache, key)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -130,7 +130,6 @@ func (c *Client) Quit() error {
|
||||
|
||||
func (c *Client) sendRequest(path string) (string, error) {
|
||||
resp, err := c.httpC.Get("http://supersonic/" + path)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track {
|
||||
Duration: time.Duration(ch.RunTimeTicks/runTimeTicksPerMicrosecond) * time.Microsecond,
|
||||
TrackNumber: ch.IndexNumber,
|
||||
DiscNumber: ch.DiscNumber,
|
||||
//Genre: ch.Genres,
|
||||
// Genre: ch.Genres,
|
||||
ArtistIDs: artistIDs,
|
||||
ArtistNames: artistNames,
|
||||
Album: ch.Album,
|
||||
|
||||
@@ -32,9 +32,11 @@ type MediaIterator[M any] interface {
|
||||
Next() *M
|
||||
}
|
||||
|
||||
type ArtistIterator = MediaIterator[Artist]
|
||||
type AlbumIterator = MediaIterator[Album]
|
||||
type TrackIterator = MediaIterator[Track]
|
||||
type (
|
||||
ArtistIterator = MediaIterator[Artist]
|
||||
AlbumIterator = MediaIterator[Album]
|
||||
TrackIterator = MediaIterator[Track]
|
||||
)
|
||||
|
||||
type MediaFilter[M, F any] interface {
|
||||
Options() F
|
||||
|
||||
@@ -298,7 +298,8 @@ func (s *subsonicMediaProvider) ClientDecidesScrobble() bool { return true }
|
||||
func (s *subsonicMediaProvider) TrackBeganPlayback(trackID string) error {
|
||||
return s.client.Scrobble(trackID, map[string]string{
|
||||
"time": strconv.FormatInt(time.Now().UnixMilli(), 10),
|
||||
"submission": "false"})
|
||||
"submission": "false",
|
||||
})
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) TrackEndedPlayback(trackID string, _ int, submission bool) error {
|
||||
@@ -307,7 +308,8 @@ func (s *subsonicMediaProvider) TrackEndedPlayback(trackID string, _ int, submis
|
||||
}
|
||||
return s.client.Scrobble(trackID, map[string]string{
|
||||
"time": strconv.FormatInt(time.Now().UnixMilli(), 10),
|
||||
"submission": "true"})
|
||||
"submission": "true",
|
||||
})
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) SetFavorite(params mediaprovider.RatingFavoriteParameters, favorite bool) error {
|
||||
|
||||
+1
-3
@@ -24,9 +24,7 @@ var (
|
||||
_ types.OrgMprisMediaPlayer2PlayerAdapterLoopStatus = (*MPRISHandler)(nil)
|
||||
)
|
||||
|
||||
var (
|
||||
errNotSupported = errors.New("not supported")
|
||||
)
|
||||
var errNotSupported = errors.New("not supported")
|
||||
|
||||
type MPRISHandler struct {
|
||||
// Function called if the player is requested to quit through MPRIS.
|
||||
|
||||
@@ -109,7 +109,6 @@ func (j *JukeboxPlayer) SetNextTrack(track *mediaprovider.Track) error {
|
||||
}
|
||||
j.queueLength += 1
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (j *JukeboxPlayer) SeekSeconds(secs float64) error {
|
||||
|
||||
@@ -3,6 +3,7 @@ package mpv
|
||||
// #include <mpv/client.h>
|
||||
// int mpv_get_peaks(mpv_handle* handle, double* lPeak, double* rPeak, double* lRMS, double* rRMS);
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"github.com/supersonic-app/go-mpv"
|
||||
)
|
||||
|
||||
@@ -492,7 +492,7 @@ func (p *Player) eventHandler(ctx context.Context) {
|
||||
default:
|
||||
e := p.mpv.WaitEvent(1 /*timeout seconds*/)
|
||||
if e.Event_Id != mpv.EVENT_NONE {
|
||||
//log.Printf("mpv event: %+v\n", e)
|
||||
// log.Printf("mpv event: %+v\n", e)
|
||||
}
|
||||
switch e.Event_Id {
|
||||
case mpv.EVENT_PLAYBACK_RESTART:
|
||||
|
||||
@@ -51,7 +51,7 @@ func SavePlayQueue(serverID string, pm *PlaybackManager, filepath string, server
|
||||
TimePos: stats.TimePos,
|
||||
}
|
||||
b, _ := json.Marshal(saved)
|
||||
err := os.WriteFile(filepath, b, 0644)
|
||||
err := os.WriteFile(filepath, b, 0o644)
|
||||
|
||||
if server != nil {
|
||||
// save to server
|
||||
|
||||
@@ -308,7 +308,7 @@ func analyzeWavFile(ctx context.Context, transcodeFile string, data *waveformDat
|
||||
currentSize := stat.Size()
|
||||
|
||||
// how many bytes can we read without nearing EOF
|
||||
readableBytes := currentSize - int64(samplesPerChunk)*int64(curChunk)*bytesPerSample - 8192 //buffer for safety
|
||||
readableBytes := currentSize - int64(samplesPerChunk)*int64(curChunk)*bytesPerSample - 8192 // buffer for safety
|
||||
|
||||
// Estimate how many samples we can read
|
||||
maxSamples := int(readableBytes / bytesPerSample)
|
||||
@@ -391,7 +391,7 @@ func computePeakAndRMS(chunk []float64) (peak float64, rms float64) {
|
||||
sumSquares += float64(v * v)
|
||||
}
|
||||
rms = math.Sqrt(sumSquares / float64(len(chunk)))
|
||||
return
|
||||
return peak, rms
|
||||
}
|
||||
|
||||
func float64ToByte(val float64) byte {
|
||||
|
||||
@@ -17,8 +17,10 @@ import (
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
type SMTCPlaybackState int
|
||||
type SMTCButton int
|
||||
type (
|
||||
SMTCPlaybackState int
|
||||
SMTCButton int
|
||||
)
|
||||
|
||||
const (
|
||||
// constants from smtc.h in github.com/supersonic-app/smtc-dll
|
||||
|
||||
@@ -4,8 +4,10 @@ package windows
|
||||
|
||||
import "errors"
|
||||
|
||||
type SMTCPlaybackState int
|
||||
type SMTCButton int
|
||||
type (
|
||||
SMTCPlaybackState int
|
||||
SMTCButton int
|
||||
)
|
||||
|
||||
const (
|
||||
// constants from smtc.h in github.com/supersonic-app/smtc-dll
|
||||
|
||||
@@ -10,6 +10,7 @@ package windows
|
||||
extern void goButtonClicked(int);
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"image"
|
||||
|
||||
Reference in New Issue
Block a user