beginning of adding Jellyfin support
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package jellyfin
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/dweymouth/go-jellyfin"
|
||||
)
|
||||
|
||||
type jellyfinMediaProvider struct {
|
||||
client *jellyfin.Client
|
||||
prefetchCoverCB func(coverArtID string)
|
||||
}
|
||||
|
||||
func (j *jellyfinMediaProvider) SetPrefetchCoverCallback(cb func(coverArtID string)) {
|
||||
j.prefetchCoverCB = cb
|
||||
}
|
||||
|
||||
func (jellyfinMediaProvider) CreatePlaylist(name string, trackIDs []string) error {
|
||||
return errors.New("unimplemented")
|
||||
}
|
||||
|
||||
func (j *jellyfinMediaProvider) DeletePlaylist(id string) error {
|
||||
return j.client.DeletePlaylist(id)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package mediaprovider
|
||||
|
||||
type Server interface {
|
||||
Ping() bool
|
||||
Login(username, password string) error
|
||||
MediaProvider() MediaProvider
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
subsonicCli "github.com/dweymouth/go-subsonic/subsonic"
|
||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||
)
|
||||
|
||||
type SubsonicServer struct {
|
||||
subsonicCli.Client
|
||||
}
|
||||
|
||||
func (s *SubsonicServer) Login(username, password string) error {
|
||||
s.User = username
|
||||
return s.Client.Authenticate(password)
|
||||
}
|
||||
|
||||
func (s *SubsonicServer) MediaProvider() mediaprovider.MediaProvider {
|
||||
return SubsonicMediaProvider(&s.Client)
|
||||
}
|
||||
Reference in New Issue
Block a user