begin the refactoring - doesnt compile

This commit is contained in:
Drew Weymouth
2023-05-14 19:31:04 -07:00
parent 0ebbf621b1
commit 85042fcbd4
23 changed files with 183 additions and 747 deletions
+5 -7
View File
@@ -1,25 +1,23 @@
package widgets
import (
"github.com/dweymouth/supersonic/backend"
"github.com/dweymouth/go-subsonic/subsonic"
"github.com/dweymouth/supersonic/backend/mediaprovider"
)
// Component that manages lazily loading more tracks into a Tracklist
// as the user scrolls near the bottom.
type TracklistLoader struct {
tracklist *Tracklist
iter backend.TrackIterator
iter mediaprovider.TrackIterator
trackBuffer []*subsonic.Child
trackBuffer []*mediaprovider.Track
fetching bool
done bool
len int
highestShown int
}
func NewTracklistLoader(tracklist *Tracklist, iter backend.TrackIterator) TracklistLoader {
func NewTracklistLoader(tracklist *Tracklist, iter mediaprovider.TrackIterator) TracklistLoader {
t := TracklistLoader{
tracklist: tracklist,
iter: iter,
@@ -44,7 +42,7 @@ func (t *TracklistLoader) loadMoreTracks(num int) {
// repeat fetch task as long as user has scrolled near bottom
for !t.done && t.highestShown >= t.len-25 {
if t.trackBuffer == nil {
t.trackBuffer = make([]*subsonic.Child, 0, num)
t.trackBuffer = make([]*mediaprovider.Track, 0, num)
}
t.trackBuffer = t.trackBuffer[:0]
for i := 0; i < num; i++ {