Ability to download tracks

- Adding the option to download the selected track or tracks.
When the download is clicked it opens a dialog that lets you choose where
you want to save the track and the file name (by default
the file name is the track number, the track name and the extension, example "03 - my song.mp3")
If there are many tracks selected it will open one dialog for each track
- Next steps: download an album and a playlist using zip
This commit is contained in:
natilou
2023-06-15 10:12:53 -03:00
parent 7b15fe95e4
commit f190aaf732
6 changed files with 81 additions and 8 deletions
+6 -1
View File
@@ -1,6 +1,9 @@
package mediaprovider
import "image"
import (
"image"
"io"
)
type AlbumFilter struct {
MinYear int
@@ -83,4 +86,6 @@ type MediaProvider interface {
DeletePlaylist(id string) error
Scrobble(trackID string, submission bool) error
DownloadTrack(trackID string) (io.Reader, error)
}
@@ -3,6 +3,7 @@ package subsonic
import (
"errors"
"image"
"io"
"math"
"strconv"
"sync"
@@ -249,6 +250,10 @@ func (s *subsonicMediaProvider) SetRating(params mediaprovider.RatingFavoritePar
return err
}
func (s *subsonicMediaProvider) DownloadTrack(trackID string) (io.Reader, error) {
return s.client.Download(trackID)
}
func toTrack(ch *subsonic.Child) *mediaprovider.Track {
if ch == nil {
return nil