mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 04:57:37 +03:00
Moved package api
to subsonic
under server
This commit is contained in:
parent
67eeb218c4
commit
7610b42f4b
59 changed files with 41 additions and 41 deletions
|
@ -1,12 +1,12 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
"github.com/cloudsonic/sonic-server/utils"
|
||||
)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
@ -6,15 +6,15 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/conf"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
"github.com/go-chi/chi"
|
||||
)
|
||||
|
||||
const Version = "1.8.0"
|
||||
|
||||
type SubsonicHandler = func(http.ResponseWriter, *http.Request) (*responses.Subsonic, error)
|
||||
type Handler = func(http.ResponseWriter, *http.Request) (*responses.Subsonic, error)
|
||||
|
||||
type Router struct {
|
||||
Browser engine.Browser
|
||||
|
@ -123,7 +123,7 @@ func (api *Router) routes() http.Handler {
|
|||
|
||||
// Add the Subsonic handler, with and without `.view` extension
|
||||
// Ex: if path = `ping` it will create the routes `/ping` and `/ping.view`
|
||||
func H(r chi.Router, path string, f SubsonicHandler) {
|
||||
func H(r chi.Router, path string, f Handler) {
|
||||
handle := func(w http.ResponseWriter, r *http.Request) {
|
||||
res, err := f(w, r)
|
||||
if err != nil {
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -1,15 +1,15 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/conf"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/model"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
"github.com/cloudsonic/sonic-server/utils"
|
||||
)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -7,9 +7,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/model"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
"github.com/cloudsonic/sonic-server/utils"
|
||||
)
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/model"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
)
|
||||
|
||||
type MediaAnnotationController struct {
|
|
@ -1,14 +1,14 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/model"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
)
|
||||
|
||||
type MediaRetrievalController struct {
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"errors"
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -8,9 +8,9 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/conf"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
)
|
||||
|
||||
func checkRequiredParameters(next http.Handler) http.Handler {
|
|
@ -1,4 +1,4 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"net/http"
|
|
@ -1,13 +1,13 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/model"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
)
|
||||
|
||||
type PlaylistsController struct {
|
|
@ -10,7 +10,7 @@ import (
|
|||
"encoding/xml"
|
||||
"time"
|
||||
|
||||
. "github.com/cloudsonic/sonic-server/api/responses"
|
||||
. "github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
|
@ -1,12 +1,12 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
)
|
||||
|
||||
type SearchingController struct {
|
|
@ -1,12 +1,12 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
"github.com/cloudsonic/sonic-server/model"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
"github.com/cloudsonic/sonic-server/utils"
|
||||
)
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
)
|
||||
|
||||
type SystemController struct{}
|
|
@ -1,9 +1,9 @@
|
|||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
)
|
||||
|
||||
type UsersController struct{}
|
|
@ -3,7 +3,7 @@
|
|||
//go:generate wire
|
||||
//+build !wireinject
|
||||
|
||||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
|
@ -1,6 +1,6 @@
|
|||
//+build wireinject
|
||||
|
||||
package api
|
||||
package subsonic
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
|
@ -7,7 +7,7 @@ import (
|
|||
"encoding/xml"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/api/responses"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic/responses"
|
||||
"github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/cloudsonic/sonic-server/api"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/persistence"
|
||||
"github.com/cloudsonic/sonic-server/scanner"
|
||||
"github.com/cloudsonic/sonic-server/server"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic"
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@ func CreateApp(musicFolder string) *server.Server {
|
|||
return serverServer
|
||||
}
|
||||
|
||||
func CreateSubsonicAPIRouter() *api.Router {
|
||||
func CreateSubsonicAPIRouter() *subsonic.Router {
|
||||
dataStore := persistence.New()
|
||||
browser := engine.NewBrowser(dataStore)
|
||||
cover := engine.NewCover(dataStore)
|
||||
|
@ -33,10 +33,10 @@ func CreateSubsonicAPIRouter() *api.Router {
|
|||
ratings := engine.NewRatings(dataStore)
|
||||
scrobbler := engine.NewScrobbler(dataStore, nowPlayingRepository)
|
||||
search := engine.NewSearch(dataStore)
|
||||
router := api.NewRouter(browser, cover, listGenerator, playlists, ratings, scrobbler, search)
|
||||
router := subsonic.NewRouter(browser, cover, listGenerator, playlists, ratings, scrobbler, search)
|
||||
return router
|
||||
}
|
||||
|
||||
// wire_injectors.go:
|
||||
|
||||
var allProviders = wire.NewSet(engine.Set, scanner.New, api.NewRouter, persistence.Set)
|
||||
var allProviders = wire.NewSet(engine.Set, scanner.New, subsonic.NewRouter, persistence.Set)
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/cloudsonic/sonic-server/api"
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/persistence"
|
||||
"github.com/cloudsonic/sonic-server/scanner"
|
||||
"github.com/cloudsonic/sonic-server/server"
|
||||
"github.com/cloudsonic/sonic-server/server/subsonic"
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
var allProviders = wire.NewSet(
|
||||
engine.Set,
|
||||
scanner.New,
|
||||
api.NewRouter,
|
||||
subsonic.NewRouter,
|
||||
persistence.Set,
|
||||
)
|
||||
|
||||
|
@ -25,6 +25,6 @@ func CreateApp(musicFolder string) *server.Server {
|
|||
))
|
||||
}
|
||||
|
||||
func CreateSubsonicAPIRouter() *api.Router {
|
||||
func CreateSubsonicAPIRouter() *subsonic.Router {
|
||||
panic(wire.Build(allProviders))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue