Started the big refactor to extract common logic from engine package (Subsonic only) to core package (more generic)

This commit is contained in:
Deluan 2020-07-10 12:45:58 -04:00
parent 5418a6b6b1
commit 5620c58a30
25 changed files with 118 additions and 52 deletions

View file

@ -0,0 +1,22 @@
package core
import "github.com/deluan/navidrome/model"
type mockTranscodingRepository struct {
model.TranscodingRepository
}
func (m *mockTranscodingRepository) Get(id string) (*model.Transcoding, error) {
return &model.Transcoding{ID: id, TargetFormat: "mp3", DefaultBitRate: 160}, nil
}
func (m *mockTranscodingRepository) FindByFormat(format string) (*model.Transcoding, error) {
switch format {
case "mp3":
return &model.Transcoding{ID: "mp31", TargetFormat: "mp3", DefaultBitRate: 160}, nil
case "oga":
return &model.Transcoding{ID: "oga1", TargetFormat: "oga", DefaultBitRate: 128}, nil
default:
return nil, model.ErrNotFound
}
}