mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 03:30:39 +03:00
Add option for player to report real paths in Subsonic API. Closes #625
This commit is contained in:
parent
7becc18da9
commit
975579ab26
23
db/migration/20201128100726_add_real-path_option.go
Normal file
23
db/migration/20201128100726_add_real-path_option.go
Normal file
@ -0,0 +1,23 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/pressly/goose"
|
||||
)
|
||||
|
||||
func init() {
|
||||
goose.AddMigration(Up20201128100726, Down20201128100726)
|
||||
}
|
||||
|
||||
func Up20201128100726(tx *sql.Tx) error {
|
||||
_, err := tx.Exec(`
|
||||
alter table player
|
||||
add report_real_path bool default FALSE not null;
|
||||
`)
|
||||
return err
|
||||
}
|
||||
|
||||
func Down20201128100726(tx *sql.Tx) error {
|
||||
return nil
|
||||
}
|
@ -5,15 +5,16 @@ import (
|
||||
)
|
||||
|
||||
type Player struct {
|
||||
ID string `json:"id" orm:"column(id)"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
UserName string `json:"userName"`
|
||||
Client string `json:"client"`
|
||||
IPAddress string `json:"ipAddress"`
|
||||
LastSeen time.Time `json:"lastSeen"`
|
||||
TranscodingId string `json:"transcodingId"`
|
||||
MaxBitRate int `json:"maxBitRate"`
|
||||
ID string `json:"id" orm:"column(id)"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
UserName string `json:"userName"`
|
||||
Client string `json:"client"`
|
||||
IPAddress string `json:"ipAddress"`
|
||||
LastSeen time.Time `json:"lastSeen"`
|
||||
TranscodingId string `json:"transcodingId"`
|
||||
MaxBitRate int `json:"maxBitRate"`
|
||||
ReportRealPath bool `json:"reportRealPath"`
|
||||
}
|
||||
|
||||
type Players []Player
|
||||
|
@ -92,7 +92,8 @@
|
||||
"maxBitRate": "Bitrate máx",
|
||||
"client": "Cliente",
|
||||
"userName": "Usuário",
|
||||
"lastSeen": "Últ. acesso"
|
||||
"lastSeen": "Últ. acesso",
|
||||
"reportRealPath": "Use paths reais"
|
||||
}
|
||||
},
|
||||
"transcoding": {
|
||||
@ -323,4 +324,4 @@
|
||||
"serverUptime": "Uptime do servidor",
|
||||
"serverDown": "DESCONECTADO"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,12 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
|
||||
child.CoverArt = "al-" + mf.AlbumID
|
||||
}
|
||||
child.ContentType = mf.ContentType()
|
||||
child.Path = fmt.Sprintf("%s/%s/%s.%s", realArtistName(mf), mf.Album, mf.Title, mf.Suffix)
|
||||
player, ok := request.PlayerFrom(ctx)
|
||||
if ok && player.ReportRealPath {
|
||||
child.Path = mf.Path
|
||||
} else {
|
||||
child.Path = fmt.Sprintf("%s/%s/%s.%s", realArtistName(mf), mf.Album, mf.Title, mf.Suffix)
|
||||
}
|
||||
child.DiscNumber = mf.DiscNumber
|
||||
child.Created = &mf.CreatedAt
|
||||
child.AlbumId = mf.AlbumID
|
||||
|
@ -92,7 +92,8 @@
|
||||
"maxBitRate": "Max. Bit Rate",
|
||||
"client": "Client",
|
||||
"userName": "Username",
|
||||
"lastSeen": "Last Seen At"
|
||||
"lastSeen": "Last Seen At",
|
||||
"reportRealPath": "Report Real Path"
|
||||
}
|
||||
},
|
||||
"transcoding": {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from 'react'
|
||||
import {
|
||||
TextInput,
|
||||
BooleanInput,
|
||||
TextField,
|
||||
Edit,
|
||||
required,
|
||||
@ -45,6 +46,7 @@ const PlayerEdit = (props) => (
|
||||
{ id: 0, name: '-' },
|
||||
]}
|
||||
/>
|
||||
<BooleanInput source="reportRealPath" fullWidth />
|
||||
<TextField source="client" />
|
||||
<TextField source="userName" />
|
||||
</SimpleForm>
|
||||
|
Loading…
x
Reference in New Issue
Block a user