feat: Add Share option for artists, albums, and tracks

This feature is only available on the Subsonic media provider. Using a
Jellyfin server will make Supersonic hide the "Share" option.

* Artists: Option available in grid view and in Artist view.
* Albums: Option available in grid view and in Album view.
* Tracks: Option available in tracklist, when a single track is selected.
This commit is contained in:
Michael Manganiello
2024-03-03 20:44:58 -03:00
parent ee0e18e118
commit 9d3725cb51
16 changed files with 174 additions and 6 deletions
@@ -5,6 +5,7 @@ import (
"image"
"io"
"math"
"net/url"
"strconv"
"strings"
"sync"
@@ -315,6 +316,20 @@ func (s *subsonicMediaProvider) SetRating(params mediaprovider.RatingFavoritePar
return err
}
func (s *subsonicMediaProvider) CreateShareURL(id string) (*url.URL, error) {
share, err := s.client.CreateShare(id, nil)
if err != nil {
return nil, err
}
shareUrl, err := url.Parse(share.Url)
if err != nil {
return nil, err
}
return shareUrl, nil
}
func (s *subsonicMediaProvider) DownloadTrack(trackID string) (io.Reader, error) {
return s.client.Download(trackID)
}