Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9554c8f783 | ||
|
|
e36a42f356 | ||
|
|
9d1960232c | ||
|
|
d3547544bf | ||
|
|
9cb42606ba | ||
|
|
7772afce1c | ||
|
|
10e76257c6 | ||
|
|
9235ab6414 | ||
|
|
59356f0029 | ||
|
|
9ae14015a1 | ||
|
|
0b131e91c1 | ||
|
|
77b12eafde | ||
|
|
050778460d | ||
|
|
28bc9c1d4f | ||
|
|
5e7aaa667b | ||
|
|
1afc495920 | ||
|
|
cf7d877714 | ||
|
|
81831da67a | ||
|
|
fcd2fcae67 | ||
|
|
1c33b0aea8 | ||
|
|
fc06163b5a | ||
|
|
72f0a6fb66 | ||
|
|
6f5a322927 | ||
|
|
a7f8e4ee2b | ||
|
|
0850872b0f | ||
|
|
1d886156d5 | ||
|
|
faa2a978c0 | ||
|
|
38faffa907 | ||
|
|
65a792be3a | ||
|
|
876354e58e | ||
|
|
14b33bc34d | ||
|
|
9044aa8740 | ||
|
|
07ac14f810 |
4
.github/workflows/build.yml
vendored
@@ -11,10 +11,10 @@ jobs:
|
||||
os: [macOS-latest, ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- name: Set up Go 1.13
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.13
|
||||
go-version: 1.14
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
|
||||
4
.github/workflows/release.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 13
|
||||
node-version: 13.10
|
||||
- name: Build UI
|
||||
run: |
|
||||
cd ui
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
- name: Fetch tags
|
||||
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||
- name: Run GoReleaser
|
||||
uses: docker://bepsays/ci-goreleaser:latest
|
||||
uses: docker://bepsays/ci-goreleaser:1.14-1
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -2,11 +2,58 @@
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- apt-get update
|
||||
- apt-get install -y gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu
|
||||
- go get -u github.com/go-bindata/go-bindata/...
|
||||
- go-bindata -fs -prefix ui/build -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/...
|
||||
- git checkout .
|
||||
|
||||
builds:
|
||||
- id: navidrome_linux_amd64
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
flags:
|
||||
- -tags=embed
|
||||
ldflags:
|
||||
- "-extldflags '-static'"
|
||||
- -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
|
||||
|
||||
- id: navidrome_linux_arm
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
- CC=arm-linux-gnueabi-gcc
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- arm
|
||||
goarm:
|
||||
- 6
|
||||
- 7
|
||||
flags:
|
||||
- -tags=embed
|
||||
ldflags:
|
||||
- "-extldflags '-static'"
|
||||
- "-extld=$CC"
|
||||
- -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
|
||||
|
||||
- id: navidrome_linux_arm64
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
- CC=aarch64-linux-gnu-gcc
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- arm64
|
||||
flags:
|
||||
- -tags=embed
|
||||
ldflags:
|
||||
- "-extldflags '-static'"
|
||||
- -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
|
||||
|
||||
- id: navidrome_darwin
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
@@ -21,19 +68,6 @@ builds:
|
||||
ldflags:
|
||||
- -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
|
||||
|
||||
- id: navidrome_linux
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
flags:
|
||||
- -tags=embed
|
||||
ldflags:
|
||||
- "-extldflags '-static'"
|
||||
- -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}}
|
||||
|
||||
- id: navidrome_windows_i686
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
@@ -69,8 +103,15 @@ archives:
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
replacements:
|
||||
darwin: macOS
|
||||
linux: Linux
|
||||
windows: Windows
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
name_template: '{{ .ProjectName }}_checksums.txt'
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
|
||||
@@ -10,7 +10,7 @@ Navidrome and Subsonic:
|
||||
* Right now, Navidrome only works with a single Music Library (Music Folder)
|
||||
* Navidrome does not mark songs as played by calls to `stream`, only when
|
||||
`scrobble` is called with `submission=true`
|
||||
* Next features to be implemented: Playlists (WIP), MultiUser (WIP), Jukebox, Sharing, Podcasts, Bookmarks, Internet Radio.
|
||||
* Next features to be implemented: Last.FM integration, Jukebox, Sharing, Bookmarks, Podcasts, Internet Radio.
|
||||
|
||||
Navidrome is actively being tested with:
|
||||
[DSub](http://www.subsonic.org/pages/apps.jsp#dsub),
|
||||
@@ -54,7 +54,7 @@ Navidrome is actively being tested with:
|
||||
| `deletePlaylist` | |
|
||||
| ||
|
||||
| _MEDIA RETRIEVAL_ ||
|
||||
| `stream` | No Transcoding/Downsampling support (for now)|
|
||||
| `stream` | Experimental Transcoding/Downsampling support available |
|
||||
| `download` | |
|
||||
| `getCoverArt` | Only gets embedded artwork |
|
||||
| `getAvatar` | Always returns the same image |
|
||||
@@ -62,7 +62,7 @@ Navidrome is actively being tested with:
|
||||
| _MEDIA ANNOTATION_ ||
|
||||
| `star` | |
|
||||
| `unstar` | |
|
||||
| `setRating` | Doesn't work with artists |
|
||||
| `setRating` | |
|
||||
| `scrobble` | No Last.FM support yet. It is used to update play count and last played |
|
||||
| ||
|
||||
| _USER MANAGEMENT_ ||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#####################################################
|
||||
### Build UI bundles
|
||||
FROM node:13.7-alpine AS jsbuilder
|
||||
FROM node:13.10-alpine AS jsbuilder
|
||||
WORKDIR /src
|
||||
COPY ui/package.json ui/package-lock.json ./
|
||||
RUN npm ci
|
||||
@@ -10,7 +10,7 @@ RUN npm run build
|
||||
|
||||
#####################################################
|
||||
### Build executable
|
||||
FROM golang:1.13-alpine AS gobuilder
|
||||
FROM golang:1.14-alpine AS gobuilder
|
||||
|
||||
# Download build tools
|
||||
RUN mkdir -p /src/ui/build
|
||||
|
||||
8
Makefile
@@ -1,5 +1,5 @@
|
||||
GO_VERSION=1.13
|
||||
NODE_VERSION=v13.7.0
|
||||
GO_VERSION=$(shell grep -e "^go " go.mod | cut -f 2 -d ' ')
|
||||
NODE_VERSION=$(shell cat .nvmrc)
|
||||
|
||||
GIT_SHA=$(shell git rev-parse --short HEAD)
|
||||
|
||||
@@ -51,7 +51,7 @@ check_env: check_go_env check_node_env
|
||||
.PHONY: check_go_env
|
||||
check_go_env:
|
||||
@(hash go) || (echo "\nERROR: GO environment not setup properly!\n"; exit 1)
|
||||
@go version | grep -q $(GO_VERSION) || (echo "\nERROR: Please upgrade your GO version\n"; exit 1)
|
||||
@go version | grep -q $(GO_VERSION) || (echo "\nERROR: Please upgrade your GO version\nThis project requires version $(GO_VERSION)"; exit 1)
|
||||
|
||||
.PHONY: check_node_env
|
||||
check_node_env:
|
||||
@@ -79,4 +79,4 @@ release:
|
||||
|
||||
.PHONY: dist
|
||||
dist:
|
||||
docker run -it -v $(PWD):/github/workspace -w /github/workspace bepsays/ci-goreleaser:1.13-4 goreleaser release --rm-dist --skip-publish --snapshot
|
||||
docker run -it -v $(PWD):/github/workspace -w /github/workspace bepsays/ci-goreleaser:1.14-1 goreleaser release --rm-dist --skip-publish --snapshot
|
||||
|
||||
@@ -34,7 +34,6 @@ This project is being actively worked on. Expect a more polished experience and
|
||||
on a frequent basis. Some upcoming features planned:
|
||||
|
||||
- Last.FM integration
|
||||
- Pre-build binaries for Raspberry Pi
|
||||
- Smart/dynamic playlists (similar to iTunes)
|
||||
- Support for audiobooks (bookmarking)
|
||||
- Jukebox mode
|
||||
@@ -49,7 +48,8 @@ Various options are available:
|
||||
### Pre-built executables
|
||||
|
||||
Just head to the [releases page](https://github.com/deluan/navidrome/releases) and download the latest version for you
|
||||
platform. There are builds available for Linux, macOS and Windows (32 and 64 bits).
|
||||
platform. There are builds available for Linux (amd64 and arm), macOS and Windows (32 and 64 bits).
|
||||
For Raspberry Pi (tested with Raspbian Buster on Pi 4), use the Linux arm builds.
|
||||
|
||||
Remember to install [ffmpeg](https://ffmpeg.org/download.html) in your system, a requirement for Navidrome to work properly.
|
||||
You may find the latest static build for your platform here: https://johnvansickle.com/ffmpeg/
|
||||
@@ -86,7 +86,7 @@ To get the cutting-edge, latest version from master, use the image `deluan/navid
|
||||
|
||||
### Build from source
|
||||
|
||||
You will need to install [Go 1.13](https://golang.org/dl/) and [Node 13.7.0](http://nodejs.org).
|
||||
You will need to install [Go 1.14](https://golang.org/dl/) and [Node 13.10.1](http://nodejs.org).
|
||||
You'll also need [ffmpeg](https://ffmpeg.org) installed in your system. The setup is very strict, and
|
||||
the steps bellow only work with these specific versions (enforced in the Makefile)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ type nd struct {
|
||||
|
||||
EnableDownsampling bool `default:"false"`
|
||||
MaxBitRate int `default:"0"`
|
||||
MaxTranscodingCacheSize int64 `default:"100000000"` // 100MB
|
||||
MaxTranscodingCacheSize int64 `default:"100"` // in MB
|
||||
DownsampleCommand string `default:"ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -"`
|
||||
ProbeCommand string `default:"ffmpeg -i %s -f ffmetadata"`
|
||||
|
||||
@@ -83,7 +83,7 @@ func LoadFromFile(confFile string, skipFlags ...bool) {
|
||||
os.Exit(2)
|
||||
}
|
||||
if Server.DbPath == "" {
|
||||
Server.DbPath = filepath.Join(Server.DataFolder, "navidrome.db")
|
||||
Server.DbPath = filepath.Join(Server.DataFolder, consts.DefaultDbPath)
|
||||
}
|
||||
if os.Getenv("PORT") != "" {
|
||||
Server.Port = os.Getenv("PORT")
|
||||
|
||||
@@ -6,6 +6,7 @@ const (
|
||||
AppName = "navidrome"
|
||||
|
||||
LocalConfigFile = "./navidrome.toml"
|
||||
DefaultDbPath = "navidrome.db?cache=shared&_busy_timeout=15000&_journal_mode=WAL"
|
||||
InitialSetupFlagKey = "InitialSetup"
|
||||
|
||||
JWTSecretKey = "JWTSecret"
|
||||
|
||||
@@ -8,7 +8,6 @@ func init() {
|
||||
".ogg": "audio/ogg",
|
||||
".oga": "audio/ogg",
|
||||
".opus": "audio/ogg",
|
||||
".ogx": "application/ogg",
|
||||
".aac": "audio/mp4",
|
||||
".m4a": "audio/mp4",
|
||||
".m4b": "audio/mp4",
|
||||
@@ -18,20 +17,8 @@ func init() {
|
||||
".ape": "audio/x-monkeys-audio",
|
||||
".mpc": "audio/x-musepack",
|
||||
".shn": "audio/x-shn",
|
||||
".flv": "video/x-flv",
|
||||
".avi": "video/avi",
|
||||
".mpg": "video/mpeg",
|
||||
".mpeg": "video/mpeg",
|
||||
".mp4": "video/mp4",
|
||||
".m4v": "video/x-m4v",
|
||||
".mkv": "video/x-matroska",
|
||||
".mov": "video/quicktime",
|
||||
".wmv": "video/x-ms-wmv",
|
||||
".ogv": "video/ogg",
|
||||
".divx": "video/divx",
|
||||
".m2ts": "video/MP2T",
|
||||
".ts": "video/MP2T",
|
||||
".webm": "video/webm",
|
||||
".aif": "audio/x-aiff",
|
||||
".aiff": "audio/x-aiff",
|
||||
".gif": "image/gif",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
|
||||
24
db/db.go
@@ -13,32 +13,36 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
once sync.Once
|
||||
Driver = "sqlite3"
|
||||
Path string
|
||||
)
|
||||
|
||||
func Init() {
|
||||
var (
|
||||
once sync.Once
|
||||
db *sql.DB
|
||||
)
|
||||
|
||||
func Db() *sql.DB {
|
||||
once.Do(func() {
|
||||
var err error
|
||||
Path = conf.Server.DbPath
|
||||
if Path == ":memory:" {
|
||||
Path = "file::memory:?cache=shared"
|
||||
conf.Server.DbPath = Path
|
||||
}
|
||||
log.Debug("Opening DataBase", "dbPath", Path, "driver", Driver)
|
||||
db, err = sql.Open(Driver, Path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
return db
|
||||
}
|
||||
|
||||
func EnsureLatestVersion() {
|
||||
Init()
|
||||
db, err := sql.Open(Driver, Path)
|
||||
defer db.Close()
|
||||
if err != nil {
|
||||
log.Error("Failed to open DB", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
db := Db()
|
||||
|
||||
err = goose.SetDialect(Driver)
|
||||
err := goose.SetDialect(Driver)
|
||||
if err != nil {
|
||||
log.Error("Invalid DB driver", "driver", Driver, err)
|
||||
os.Exit(1)
|
||||
|
||||
@@ -2,7 +2,7 @@ package migration
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"github.com/deluan/navidrome/log"
|
||||
|
||||
"github.com/pressly/goose"
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ func init() {
|
||||
}
|
||||
|
||||
func Up20200220143731(tx *sql.Tx) error {
|
||||
log.Warn("This migration will force the next scan to be a full rescan!")
|
||||
notice(tx, "This migration will force the next scan to be a full rescan!")
|
||||
_, err := tx.Exec(`
|
||||
create table media_file_dg_tmp
|
||||
(
|
||||
|
||||
21
db/migration/20200310171621_enable_search_by_albumartist.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/pressly/goose"
|
||||
)
|
||||
|
||||
func init() {
|
||||
goose.AddMigration(Up20200310171621, Down20200310171621)
|
||||
}
|
||||
|
||||
func Up20200310171621(tx *sql.Tx) error {
|
||||
notice(tx, "A full rescan will be performed to enable search by Album Artist!")
|
||||
return forceFullRescan(tx)
|
||||
}
|
||||
|
||||
func Down20200310171621(tx *sql.Tx) error {
|
||||
// This code is executed when the migration is rolled back.
|
||||
return nil
|
||||
}
|
||||
55
db/migration/migration.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/deluan/navidrome/consts"
|
||||
)
|
||||
|
||||
// Use this in migrations that need to communicate something important (braking changes, forced reindexes, etc...)
|
||||
func notice(tx *sql.Tx, msg string) {
|
||||
if isDBInitialized(tx) {
|
||||
fmt.Printf(`
|
||||
*************************************************************************************
|
||||
NOTICE: %s
|
||||
*************************************************************************************
|
||||
|
||||
`, msg)
|
||||
}
|
||||
}
|
||||
|
||||
// Call this in migrations that requires a full rescan
|
||||
func forceFullRescan(tx *sql.Tx) error {
|
||||
_, err := tx.Exec(`
|
||||
delete from property where id like 'LastScan%';
|
||||
update media_file set updated_at = '0001-01-01';
|
||||
`)
|
||||
return err
|
||||
}
|
||||
|
||||
var once sync.Once
|
||||
|
||||
func isDBInitialized(tx *sql.Tx) (initialized bool) {
|
||||
once.Do(func() {
|
||||
rows, err := tx.Query("select count(*) from property where id='" + consts.InitialSetupFlagKey + "'")
|
||||
checkErr(err)
|
||||
initialized = checkCount(rows) > 0
|
||||
})
|
||||
return initialized
|
||||
}
|
||||
|
||||
func checkCount(rows *sql.Rows) (count int) {
|
||||
for rows.Next() {
|
||||
err := rows.Scan(&count)
|
||||
checkErr(err)
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
func checkErr(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func (ms *mediaStreamer) NewStream(ctx context.Context, id string, maxBitRate in
|
||||
log.Error(ctx, "Error starting transcoder", "id", mf.ID, err)
|
||||
return nil, os.ErrInvalid
|
||||
}
|
||||
go copyAndClose(ctx, w, out)()
|
||||
go copyAndClose(ctx, w, out)
|
||||
}
|
||||
|
||||
// If it is in the cache, check if the stream is done being written. If so, return a ReaderSeeker
|
||||
@@ -100,20 +100,18 @@ func (ms *mediaStreamer) NewStream(ctx context.Context, id string, maxBitRate in
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func copyAndClose(ctx context.Context, w io.WriteCloser, r io.ReadCloser) func() {
|
||||
return func() {
|
||||
_, err := io.Copy(w, r)
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error copying data to cache", err)
|
||||
}
|
||||
err = r.Close()
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error closing transcode output", err)
|
||||
}
|
||||
err = w.Close()
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error closing cache", err)
|
||||
}
|
||||
func copyAndClose(ctx context.Context, w io.WriteCloser, r io.ReadCloser) {
|
||||
_, err := io.Copy(w, r)
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error copying data to cache", err)
|
||||
}
|
||||
err = r.Close()
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error closing transcode output", err)
|
||||
}
|
||||
err = w.Close()
|
||||
if err != nil {
|
||||
log.Error(ctx, "Error closing cache", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +170,7 @@ func getFinalCachedSize(r fscache.ReadAtCloser) int64 {
|
||||
}
|
||||
|
||||
func NewTranscodingCache() (fscache.Cache, error) {
|
||||
lru := fscache.NewLRUHaunter(0, conf.Server.MaxTranscodingCacheSize, 10*time.Minute)
|
||||
lru := fscache.NewLRUHaunter(0, conf.Server.MaxTranscodingCacheSize*1024*1024, 10*time.Minute)
|
||||
h := fscache.NewLRUHaunterStrategy(lru)
|
||||
cacheFolder := filepath.Join(conf.Server.DataFolder, consts.CacheDir)
|
||||
fs, err := fscache.NewFs(cacheFolder, 0755)
|
||||
|
||||
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/deluan/navidrome
|
||||
|
||||
go 1.13
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.1 // indirect
|
||||
|
||||
@@ -22,6 +22,7 @@ type UserRepository interface {
|
||||
CountAll(...QueryOptions) (int64, error)
|
||||
Get(id string) (*User, error)
|
||||
Put(*User) error
|
||||
// FindByUsername must be case-insensitive
|
||||
FindByUsername(username string) (*User, error)
|
||||
UpdateLastLoginAt(id string) error
|
||||
UpdateLastAccessAt(id string) error
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/deluan/navidrome/log"
|
||||
"github.com/deluan/navidrome/model"
|
||||
"github.com/deluan/rest"
|
||||
"github.com/dhowden/tag/mbz"
|
||||
)
|
||||
|
||||
type albumRepository struct {
|
||||
@@ -37,7 +36,7 @@ func (r *albumRepository) Put(a *model.Album) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return r.index(a.ID, a.Name, a.Artist, mbz.AlbumArtist)
|
||||
return r.index(a.ID, a.Name, a.Artist, a.AlbumArtist)
|
||||
}
|
||||
|
||||
func (r *albumRepository) selectAlbum(options ...model.QueryOptions) SelectBuilder {
|
||||
@@ -71,12 +70,7 @@ func (r *albumRepository) GetAll(options ...model.QueryOptions) (model.Albums, e
|
||||
// TODO Keep order when paginating
|
||||
func (r *albumRepository) GetRandom(options ...model.QueryOptions) (model.Albums, error) {
|
||||
sq := r.selectAlbum(options...)
|
||||
switch r.ormer.Driver().Type() {
|
||||
case orm.DRMySQL:
|
||||
sq = sq.OrderBy("RAND()")
|
||||
default:
|
||||
sq = sq.OrderBy("RANDOM()")
|
||||
}
|
||||
sq = sq.OrderBy("RANDOM()")
|
||||
results := model.Albums{}
|
||||
err := r.queryAll(sq, &results)
|
||||
return results, err
|
||||
|
||||
@@ -100,12 +100,7 @@ func (r mediaFileRepository) GetStarred(options ...model.QueryOptions) (model.Me
|
||||
// TODO Keep order when paginating
|
||||
func (r mediaFileRepository) GetRandom(options ...model.QueryOptions) (model.MediaFiles, error) {
|
||||
sq := r.selectMediaFile(options...)
|
||||
switch r.ormer.Driver().Type() {
|
||||
case orm.DRMySQL:
|
||||
sq = sq.OrderBy("RAND()")
|
||||
default:
|
||||
sq = sq.OrderBy("RANDOM()")
|
||||
}
|
||||
sq = sq.OrderBy("RANDOM()")
|
||||
results := model.MediaFiles{}
|
||||
err := r.queryAll(sq, &results)
|
||||
return results, err
|
||||
|
||||
@@ -20,65 +20,62 @@ type SQLStore struct {
|
||||
}
|
||||
|
||||
func New() model.DataStore {
|
||||
once.Do(func() {
|
||||
err := orm.RegisterDataBase("default", db.Driver, db.Path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
return &SQLStore{}
|
||||
}
|
||||
|
||||
func (db *SQLStore) Album(ctx context.Context) model.AlbumRepository {
|
||||
return NewAlbumRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) Album(ctx context.Context) model.AlbumRepository {
|
||||
return NewAlbumRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) Artist(ctx context.Context) model.ArtistRepository {
|
||||
return NewArtistRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) Artist(ctx context.Context) model.ArtistRepository {
|
||||
return NewArtistRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) MediaFile(ctx context.Context) model.MediaFileRepository {
|
||||
return NewMediaFileRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) MediaFile(ctx context.Context) model.MediaFileRepository {
|
||||
return NewMediaFileRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) MediaFolder(ctx context.Context) model.MediaFolderRepository {
|
||||
return NewMediaFolderRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) MediaFolder(ctx context.Context) model.MediaFolderRepository {
|
||||
return NewMediaFolderRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) Genre(ctx context.Context) model.GenreRepository {
|
||||
return NewGenreRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) Genre(ctx context.Context) model.GenreRepository {
|
||||
return NewGenreRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) Playlist(ctx context.Context) model.PlaylistRepository {
|
||||
return NewPlaylistRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) Playlist(ctx context.Context) model.PlaylistRepository {
|
||||
return NewPlaylistRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) Property(ctx context.Context) model.PropertyRepository {
|
||||
return NewPropertyRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) Property(ctx context.Context) model.PropertyRepository {
|
||||
return NewPropertyRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) User(ctx context.Context) model.UserRepository {
|
||||
return NewUserRepository(ctx, db.getOrmer())
|
||||
func (s *SQLStore) User(ctx context.Context) model.UserRepository {
|
||||
return NewUserRepository(ctx, s.getOrmer())
|
||||
}
|
||||
|
||||
func (db *SQLStore) Resource(ctx context.Context, m interface{}) model.ResourceRepository {
|
||||
func (s *SQLStore) Resource(ctx context.Context, m interface{}) model.ResourceRepository {
|
||||
switch m.(type) {
|
||||
case model.User:
|
||||
return db.User(ctx).(model.ResourceRepository)
|
||||
return s.User(ctx).(model.ResourceRepository)
|
||||
case model.Artist:
|
||||
return db.Artist(ctx).(model.ResourceRepository)
|
||||
return s.Artist(ctx).(model.ResourceRepository)
|
||||
case model.Album:
|
||||
return db.Album(ctx).(model.ResourceRepository)
|
||||
return s.Album(ctx).(model.ResourceRepository)
|
||||
case model.MediaFile:
|
||||
return db.MediaFile(ctx).(model.ResourceRepository)
|
||||
return s.MediaFile(ctx).(model.ResourceRepository)
|
||||
}
|
||||
log.Error("Resource no implemented", "model", reflect.TypeOf(m).Name())
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *SQLStore) WithTx(block func(tx model.DataStore) error) error {
|
||||
o := orm.NewOrm()
|
||||
err := o.Begin()
|
||||
func (s *SQLStore) WithTx(block func(tx model.DataStore) error) error {
|
||||
o, err := orm.NewOrmWithDB(db.Driver, "default", db.Db())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = o.Begin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -101,41 +98,45 @@ func (db *SQLStore) WithTx(block func(tx model.DataStore) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *SQLStore) GC(ctx context.Context) error {
|
||||
err := db.Album(ctx).PurgeEmpty()
|
||||
func (s *SQLStore) GC(ctx context.Context) error {
|
||||
err := s.Album(ctx).PurgeEmpty()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = db.Artist(ctx).PurgeEmpty()
|
||||
err = s.Artist(ctx).PurgeEmpty()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = db.MediaFile(ctx).(*mediaFileRepository).cleanSearchIndex()
|
||||
err = s.MediaFile(ctx).(*mediaFileRepository).cleanSearchIndex()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = db.Album(ctx).(*albumRepository).cleanSearchIndex()
|
||||
err = s.Album(ctx).(*albumRepository).cleanSearchIndex()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = db.Artist(ctx).(*artistRepository).cleanSearchIndex()
|
||||
err = s.Artist(ctx).(*artistRepository).cleanSearchIndex()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = db.MediaFile(ctx).(*mediaFileRepository).cleanAnnotations()
|
||||
err = s.MediaFile(ctx).(*mediaFileRepository).cleanAnnotations()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = db.Album(ctx).(*albumRepository).cleanAnnotations()
|
||||
err = s.Album(ctx).(*albumRepository).cleanAnnotations()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return db.Artist(ctx).(*artistRepository).cleanAnnotations()
|
||||
return s.Artist(ctx).(*artistRepository).cleanAnnotations()
|
||||
}
|
||||
|
||||
func (db *SQLStore) getOrmer() orm.Ormer {
|
||||
if db.orm == nil {
|
||||
return orm.NewOrm()
|
||||
func (s *SQLStore) getOrmer() orm.Ormer {
|
||||
if s.orm == nil {
|
||||
o, err := orm.NewOrmWithDB(db.Driver, "default", db.Db())
|
||||
if err != nil {
|
||||
log.Error("Error obtaining new orm instance", err)
|
||||
}
|
||||
return o
|
||||
}
|
||||
return db.orm
|
||||
return s.orm
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ func TestPersistence(t *testing.T) {
|
||||
|
||||
//os.Remove("./test-123.db")
|
||||
//conf.Server.Path = "./test-123.db"
|
||||
conf.Server.DbPath = ":memory:"
|
||||
db.Init()
|
||||
conf.Server.DbPath = "file::memory:?cache=shared"
|
||||
orm.RegisterDataBase("default", db.Driver, conf.Server.DbPath)
|
||||
New()
|
||||
db.EnsureLatestVersion()
|
||||
log.SetLevel(log.LevelCritical)
|
||||
|
||||
@@ -99,8 +99,11 @@ func (r sqlRepository) executeSQL(sq Sqlizer) (int64, error) {
|
||||
return 0, err
|
||||
}
|
||||
start := time.Now()
|
||||
var c int64
|
||||
res, err := r.ormer.Raw(query, args...).Exec()
|
||||
c, _ := res.RowsAffected()
|
||||
if res != nil {
|
||||
c, _ = res.RowsAffected()
|
||||
}
|
||||
r.logSQL(query, args, err, c, start)
|
||||
if err != nil {
|
||||
if err.Error() != "LastInsertId is not supported by this driver" {
|
||||
@@ -157,6 +160,8 @@ func (r sqlRepository) count(countQuery SelectBuilder, options ...model.QueryOpt
|
||||
|
||||
func (r sqlRepository) put(id string, m interface{}) (newId string, err error) {
|
||||
values, _ := toSqlArgs(m)
|
||||
createdAt := values["created_at"]
|
||||
delete(values, "created_at")
|
||||
if id != "" {
|
||||
update := Update(r.tableName).Where(Eq{"id": id}).SetMap(values)
|
||||
count, err := r.executeSQL(update)
|
||||
@@ -173,6 +178,9 @@ func (r sqlRepository) put(id string, m interface{}) (newId string, err error) {
|
||||
id = rand.String()
|
||||
values["id"] = id
|
||||
}
|
||||
if createdAt != nil {
|
||||
values["created_at"] = createdAt
|
||||
}
|
||||
insert := Insert(r.tableName).SetMap(values)
|
||||
_, err = r.executeSQL(insert)
|
||||
return id, err
|
||||
|
||||
@@ -65,6 +65,7 @@ func (r *userRepository) Put(u *model.User) error {
|
||||
}
|
||||
|
||||
func (r *userRepository) FindByUsername(username string) (*model.User, error) {
|
||||
username = strings.ToLower(username)
|
||||
sel := r.newSelect().Columns("*").Where(Eq{"user_name": username})
|
||||
var usr model.User
|
||||
err := r.queryOne(sel, &usr)
|
||||
|
||||
41
persistence/user_repository_test.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package persistence
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/deluan/navidrome/log"
|
||||
"github.com/deluan/navidrome/model"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("UserRepository", func() {
|
||||
var repo model.UserRepository
|
||||
|
||||
BeforeEach(func() {
|
||||
repo = NewUserRepository(log.NewContext(nil), orm.NewOrm())
|
||||
})
|
||||
|
||||
Describe("Put/Get/FindByUsername", func() {
|
||||
usr := model.User{
|
||||
ID: "123",
|
||||
UserName: "AdMiN",
|
||||
Name: "Admin",
|
||||
Email: "admin@admin.com",
|
||||
Password: "wordpass",
|
||||
IsAdmin: true,
|
||||
}
|
||||
It("saves the user to the DB", func() {
|
||||
Expect(repo.Put(&usr)).To(BeNil())
|
||||
})
|
||||
It("returns the newly created user", func() {
|
||||
actual, err := repo.Get("123")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(actual.Name).To(Equal("Admin"))
|
||||
})
|
||||
It("find the user by case-insensitive username", func() {
|
||||
actual, err := repo.FindByUsername("aDmIn")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(actual.Name).To(Equal("Admin"))
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -68,13 +68,12 @@ func (api *Router) routes() http.Handler {
|
||||
H(r, "getIndexes", c.GetIndexes)
|
||||
H(r, "getArtists", c.GetArtists)
|
||||
H(r, "getGenres", c.GetGenres)
|
||||
reqParams := r.With(requiredParams("id"))
|
||||
H(reqParams, "getMusicDirectory", c.GetMusicDirectory)
|
||||
H(reqParams, "getArtist", c.GetArtist)
|
||||
H(reqParams, "getAlbum", c.GetAlbum)
|
||||
H(reqParams, "getSong", c.GetSong)
|
||||
H(reqParams, "getArtistInfo", c.GetArtistInfo)
|
||||
H(reqParams, "getArtistInfo2", c.GetArtistInfo2)
|
||||
H(r, "getMusicDirectory", c.GetMusicDirectory)
|
||||
H(r, "getArtist", c.GetArtist)
|
||||
H(r, "getAlbum", c.GetAlbum)
|
||||
H(r, "getSong", c.GetSong)
|
||||
H(r, "getArtistInfo", c.GetArtistInfo)
|
||||
H(r, "getArtistInfo2", c.GetArtistInfo2)
|
||||
})
|
||||
r.Group(func(r chi.Router) {
|
||||
c := initAlbumListController(api)
|
||||
|
||||
@@ -89,18 +89,3 @@ func authenticate(users engine.Users) func(next http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func requiredParams(params ...string) func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
for _, p := range params {
|
||||
_, err := RequiredParamString(r, p, fmt.Sprintf("%s parameter is required", p))
|
||||
if err != nil {
|
||||
SendError(w, r, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DevDisableAuthentication = false
|
||||
User = "deluan"
|
||||
Password = "wordpass"
|
||||
DbPath = ":memory:"
|
||||
DbPath = "file::memory:?cache=shared"
|
||||
MusicFolder = "./tests/itunes-library.xml"
|
||||
DownsampleCommand = "ffmpeg -i %s -b:a %bk mp3 -"
|
||||
|
||||
1596
ui/package-lock.json
generated
@@ -3,20 +3,20 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.0.2",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
"@testing-library/user-event": "^8.0.4",
|
||||
"@testing-library/jest-dom": "^5.1.1",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^10.0.0",
|
||||
"deepmerge": "^4.2.2",
|
||||
"jwt-decode": "^2.2.0",
|
||||
"md5-hex": "^3.0.1",
|
||||
"prop-types": "^15.7.2",
|
||||
"ra-data-json-server": "^3.1.2",
|
||||
"react": "^16.12.0",
|
||||
"react-admin": "^3.1.2",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-jinke-music-player": "^4.7.2",
|
||||
"react-redux": "^7.1.0",
|
||||
"react-scripts": "3.3.0"
|
||||
"ra-data-json-server": "^3.2.3",
|
||||
"react": "^16.13.0",
|
||||
"react-admin": "^3.2.3",
|
||||
"react-dom": "^16.13.0",
|
||||
"react-jinke-music-player": "^4.10.1",
|
||||
"react-redux": "^7.2.0",
|
||||
"react-scripts": "^3.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
||||
BIN
ui/public/android-icon-144x144.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
ui/public/android-icon-192x192.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
ui/public/android-icon-36x36.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
ui/public/android-icon-48x48.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
ui/public/android-icon-72x72.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
ui/public/android-icon-96x96.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
ui/public/apple-icon-114x114.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
ui/public/apple-icon-120x120.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
ui/public/apple-icon-144x144.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
ui/public/apple-icon-152x152.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
ui/public/apple-icon-180x180.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
ui/public/apple-icon-57x57.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
ui/public/apple-icon-60x60.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
ui/public/apple-icon-72x72.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
ui/public/apple-icon-76x76.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
ui/public/apple-icon-precomposed.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
ui/public/apple-icon.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
2
ui/public/browserconfig.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig>
|
||||
BIN
ui/public/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
ui/public/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
ui/public/favicon-96x96.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -2,14 +2,30 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Navidrome Music Server"
|
||||
/>
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="%PUBLIC_URL%/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="%PUBLIC_URL%/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="%PUBLIC_URL%/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="%PUBLIC_URL%/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="%PUBLIC_URL%/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="%PUBLIC_URL%/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="%PUBLIC_URL%/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="%PUBLIC_URL%/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="%PUBLIC_URL%/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="%PUBLIC_URL%/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png">
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||
<meta name="msapplication-TileColor" content="#ffffff">
|
||||
<meta name="msapplication-TileImage" content="%PUBLIC_URL%/ms-icon-144x144.png">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Navidrome Music Server"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
|
||||
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
@@ -1,25 +1,41 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
"name": "App",
|
||||
"icons": [
|
||||
{
|
||||
"src": "\/android-icon-36x36.png",
|
||||
"sizes": "36x36",
|
||||
"type": "image\/png",
|
||||
"density": "0.75"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-48x48.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image\/png",
|
||||
"density": "1.0"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image\/png",
|
||||
"density": "1.5"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image\/png",
|
||||
"density": "2.0"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image\/png",
|
||||
"density": "3.0"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image\/png",
|
||||
"density": "4.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
ui/public/ms-icon-144x144.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
ui/public/ms-icon-150x150.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
ui/public/ms-icon-310x310.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
ui/public/ms-icon-70x70.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
@@ -21,6 +21,13 @@ export const AlbumActions = ({
|
||||
const dispatch = useDispatch()
|
||||
const translate = useTranslate()
|
||||
|
||||
// TODO Not sure why data is accumulating tracks from previous plays... Needs investigation. For now, filter out
|
||||
// the unwanted tracks
|
||||
const filteredData = ids.reduce((acc, id) => {
|
||||
acc[id] = data[id]
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
const shuffle = (data) => {
|
||||
const ids = Object.keys(data)
|
||||
for (let i = ids.length - 1; i > 0; i--) {
|
||||
@@ -37,7 +44,7 @@ export const AlbumActions = ({
|
||||
<Button
|
||||
color={'secondary'}
|
||||
onClick={() => {
|
||||
dispatch(playAlbum(ids[0], data))
|
||||
dispatch(playAlbum(ids[0], filteredData))
|
||||
}}
|
||||
label={translate('resources.album.actions.playAll')}
|
||||
>
|
||||
@@ -46,7 +53,7 @@ export const AlbumActions = ({
|
||||
<Button
|
||||
color={'secondary'}
|
||||
onClick={() => {
|
||||
const shuffled = shuffle(data)
|
||||
const shuffled = shuffle(filteredData)
|
||||
const firstId = Object.keys(shuffled)[0]
|
||||
dispatch(playAlbum(firstId, shuffled))
|
||||
}}
|
||||
|
||||
@@ -2,6 +2,9 @@ import blue from '@material-ui/core/colors/blue'
|
||||
|
||||
export const DarkTheme = {
|
||||
palette: {
|
||||
primary: {
|
||||
main: '#90caf9'
|
||||
},
|
||||
secondary: blue,
|
||||
type: 'dark'
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ const Player = () => {
|
||||
preload: true,
|
||||
autoPlayInitLoadPlayList: true,
|
||||
clearPriorAudioLists: false,
|
||||
showDestroy: false,
|
||||
showDownload: false,
|
||||
showReload: false,
|
||||
glassBg: false,
|
||||
|
||||
@@ -8,6 +8,7 @@ const PLAYER_SCROBBLE = 'PLAYER_SCROBBLE'
|
||||
const PLAYER_PLAY_ALBUM = 'PLAYER_PLAY_ALBUM'
|
||||
|
||||
const mapToAudioLists = (item) => ({
|
||||
id: item.id,
|
||||
name: item.title,
|
||||
singer: item.artist,
|
||||
cover: subsonicUrl('getCoverArt', item.id, { size: 300 }),
|
||||
|
||||