Merge branch 'main' into feature/new-playlist-btn
This commit is contained in:
@@ -348,7 +348,7 @@ func (j *jellyfinMediaProvider) SetFavorite(params mediaprovider.RatingFavoriteP
|
||||
}
|
||||
|
||||
numBatches := int(math.Ceil(float64(len(allIDs)) / float64(batchSize)))
|
||||
for i := 0; i < numBatches; i++ {
|
||||
for i := range numBatches {
|
||||
var wg sync.WaitGroup
|
||||
batchSetFavorite(i*batchSize, &wg)
|
||||
wg.Wait()
|
||||
@@ -434,6 +434,8 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track {
|
||||
coverArtID = ch.Id
|
||||
}
|
||||
|
||||
lastPlayed, _ := time.Parse(time.RFC3339Nano, ch.UserData.LastPlayedDate)
|
||||
|
||||
t := &mediaprovider.Track{
|
||||
ID: ch.Id,
|
||||
CoverArtID: coverArtID,
|
||||
@@ -442,7 +444,7 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track {
|
||||
Duration: time.Duration(ch.RunTimeTicks/runTimeTicksPerMicrosecond) * time.Microsecond,
|
||||
TrackNumber: ch.IndexNumber,
|
||||
DiscNumber: ch.DiscNumber,
|
||||
//Genre: ch.Genres,
|
||||
// Genre: ch.Genres,
|
||||
ArtistIDs: artistIDs,
|
||||
ArtistNames: artistNames,
|
||||
Album: ch.Album,
|
||||
@@ -451,6 +453,7 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track {
|
||||
Rating: ch.UserData.Rating,
|
||||
Favorite: ch.UserData.IsFavorite,
|
||||
PlayCount: ch.UserData.PlayCount,
|
||||
LastPlayed: lastPlayed,
|
||||
}
|
||||
if len(ch.MediaSources) > 0 {
|
||||
t.FilePath = ch.MediaSources[0].Path
|
||||
|
||||
@@ -32,9 +32,11 @@ type MediaIterator[M any] interface {
|
||||
Next() *M
|
||||
}
|
||||
|
||||
type ArtistIterator = MediaIterator[Artist]
|
||||
type AlbumIterator = MediaIterator[Album]
|
||||
type TrackIterator = MediaIterator[Track]
|
||||
type (
|
||||
ArtistIterator = MediaIterator[Artist]
|
||||
AlbumIterator = MediaIterator[Album]
|
||||
TrackIterator = MediaIterator[Track]
|
||||
)
|
||||
|
||||
type MediaFilter[M, F any] interface {
|
||||
Options() F
|
||||
|
||||
@@ -22,11 +22,8 @@ func (s *subsonicMediaProvider) ArtistSortOrders() []string {
|
||||
}
|
||||
}
|
||||
|
||||
func filterArtistMatches(f mediaprovider.ArtistFilter, artist *subsonic.ArtistID3) bool {
|
||||
if artist == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
func filterArtistMatches(_ mediaprovider.ArtistFilter, artist *subsonic.ArtistID3) bool {
|
||||
return artist != nil
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) IterateArtists(sortOrder string, filter mediaprovider.ArtistFilter) mediaprovider.ArtistIterator {
|
||||
@@ -176,9 +173,7 @@ func (s *subsonicMediaProvider) artistFetchFnFromStandardSort(sortFn func([]*sub
|
||||
}
|
||||
var artists []*subsonic.ArtistID3
|
||||
for _, idx := range idxs.Index {
|
||||
for _, ar := range idx.Artist {
|
||||
artists = append(artists, ar)
|
||||
}
|
||||
artists = append(artists, idx.Artist...)
|
||||
}
|
||||
artists = sortFn(artists)
|
||||
return artists, nil
|
||||
|
||||
@@ -319,7 +319,8 @@ func (s *subsonicMediaProvider) ClientDecidesScrobble() bool { return true }
|
||||
func (s *subsonicMediaProvider) TrackBeganPlayback(trackID string) error {
|
||||
return s.client.Scrobble(trackID, map[string]string{
|
||||
"time": strconv.FormatInt(time.Now().UnixMilli(), 10),
|
||||
"submission": "false"})
|
||||
"submission": "false",
|
||||
})
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) TrackEndedPlayback(trackID string, _ int, submission bool) error {
|
||||
@@ -328,7 +329,8 @@ func (s *subsonicMediaProvider) TrackEndedPlayback(trackID string, _ int, submis
|
||||
}
|
||||
return s.client.Scrobble(trackID, map[string]string{
|
||||
"time": strconv.FormatInt(time.Now().UnixMilli(), 10),
|
||||
"submission": "true"})
|
||||
"submission": "true",
|
||||
})
|
||||
}
|
||||
|
||||
func (s *subsonicMediaProvider) SetFavorite(params mediaprovider.RatingFavoriteParameters, favorite bool) error {
|
||||
@@ -363,7 +365,7 @@ func (s *subsonicMediaProvider) SetRating(params mediaprovider.RatingFavoritePar
|
||||
}
|
||||
|
||||
numBatches := int(math.Ceil(float64(len(params.TrackIDs)) / float64(batchSize)))
|
||||
for i := 0; i < numBatches; i++ {
|
||||
for i := range numBatches {
|
||||
var wg sync.WaitGroup
|
||||
batchSetRating(i*batchSize, &wg)
|
||||
wg.Wait()
|
||||
|
||||
Reference in New Issue
Block a user