> Good morning,
Good evening!
I've really enjoyed getting to back and forth with you on this.
Considering my other projects at the moment, this is a lovely brain
break of an entirely different flavor.
> Oops! Yeah that's entirely due to the parallelization.
I wondered if that was culprit based on the pattern I was seeing.
> Ouch, you have almost twice as many artists in your library as I have
> *songs* in mine. I don't think loading all albums is the way to go: even
> with all the optimization in the world, this seems wildly inefficient for
> libraries this size.
Whereas most people moved to streaming services, I never really did.
Consequently, I've been rolling my own music collection for decades.
Additionally, I now have multiple housemates who have dumped their music
onto the server.
> I've implemented my first idea, only loading albums when the artist is
> selected. You'll find it in the "delayed-load"[1] branch. Could you try it
> out and tell me what you think? Starting the app should be
> near-instantaneous, and there should be a small delay when you select an
> artist for the first time.
>
> [1]: https://git.sixfoisneuf.fr/termsonic/log/?h=delayed-load
It certainly loaded faster, until it crashed unceremoniously when going
to play an album. I tried twice, and grabbed you the output:
$ ./termsonic
Loading artists...OK
Loading playlists...OK
panic: Get "https://REDACTED-NAVIDROME-SERVER/rest/getMusicDirectory?c=termsonic&f=xml&id=738de9c478aaf7f25ea07c2b9dec4bc1&p=REDACTED_NAVIDROME_PASSWORD&u=REDACTED_NAVIDROME_USER&v=1.8.0": EOF [recovered]
panic: Get "https://REDACTED-NAVIDROME-SERVER/rest/getMusicDirectory?c=termsonic&f=xml&id=738de9c478aaf7f25ea07c2b9dec4bc1&p=REDACTED_NAVIDROME_PASSWORD&u=REDACTED_NAVIDROME_USER&v=1.8.0": EOF
goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/application.go:244 +0x45
panic({0x255fa0?, 0xc00010b8c0?})
/usr/local/go/src/runtime/panic.go:914 +0x21f
git.sixfoisneuf.fr/termsonic/src.(*app).artistsPage.func1(0xc000649b80)
/home/MYUSER/projects/termsonic-72bd149efa008c33c0be810b0f954c20cefffe96/src/page_artists.go:34 +0x319
github.com/rivo/tview.(*TreeView).InputHandler.func1.1()
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/treeview.go:734 +0x2f
github.com/rivo/tview.(*TreeView).InputHandler.func1(0x18?, 0x261e80?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/treeview.go:779 +0xa2
github.com/rivo/tview.(*TreeView).InputHandler.(*Box).WrapInputHandler.func2(0xc0001e6120?, 0xc0000bd2a8?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0xc0000726a0?, 0x0?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/flex.go:251 +0xd7
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc00010b4d0?, 0xc0000bd290?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/box.go:167 +0x50
github.com/rivo/tview.(*Pages).InputHandler.func1(0xc00010b4d0?, 0x1?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/pages.go:311 +0xa2
github.com/rivo/tview.(*Pages).InputHandler.(*Box).WrapInputHandler.func2(0xc00010b440?, 0x252800?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0x52b9c5?, 0x10?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/flex.go:251 +0xd7
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc00010b6b0?, 0xc0007e3b78?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0001e8000)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/application.go:336 +0x4f9
git.sixfoisneuf.fr/termsonic/src.Run(0xc000072580)
/home/MYUSER/projects/termsonic-72bd149efa008c33c0be810b0f954c20cefffe96/src/app.go:115 +0xcde
main.main()
/home/MYUSER/projects/termsonic-72bd149efa008c33c0be810b0f954c20cefffe96/cmd/termsonic/main.go:41 +0x2c8
Second attempt, different album in the collection:
./termsonic
Loading artists...OK
Loading playlists...OK
panic: runtime error: slice bounds out of range [:1] with capacity 0 [recovered]
panic: runtime error: slice bounds out of range [:1] with capacity 0
goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/application.go:244 +0x45
panic({0x27d400?, 0xc000882120?})
/usr/local/go/src/runtime/panic.go:914 +0x21f
git.sixfoisneuf.fr/termsonic/music.(*Queue).Insert(0xc0002cb9c0?, 0x533688?, 0xc0002cb978?)
/home/MYUSER/projects/termsonic-72bd149efa008c33c0be810b0f954c20cefffe96/music/playqueue.go:47 +0x1e5
git.sixfoisneuf.fr/termsonic/src.(*app).artistsPage.(*app).setupKeybindings.func6(0xc000072720?)
/home/MYUSER/projects/termsonic-72bd149efa008c33c0be810b0f954c20cefffe96/src/keybinds.go:78 +0x72f
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc00010b4d0?, 0xc0000ce138?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/box.go:164 +0x37
github.com/rivo/tview.(*Pages).InputHandler.func1(0xc00010b4d0?, 0x1?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/pages.go:311 +0xa2
github.com/rivo/tview.(*Pages).InputHandler.(*Box).WrapInputHandler.func2(0xc00010b440?, 0x252800?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/box.go:167 +0x50
github.com/rivo/tview.(*Flex).InputHandler.func1(0x52b9c5?, 0x10?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/flex.go:251 +0xd7
github.com/rivo/tview.(*Flex).InputHandler.(*Box).WrapInputHandler.func2(0xc00010b6b0?, 0xc0002cbb78?)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0001e8000)
/home/MYUSER/go/pkg/mod/github.com/rivo/tview@v0.0.0-20221128165837-db36428c92d9/application.go:336 +0x4f9
git.sixfoisneuf.fr/termsonic/src.Run(0xc000072600)
/home/MYUSER/projects/termsonic-72bd149efa008c33c0be810b0f954c20cefffe96/src/app.go:115 +0xcde
main.main()
/home/MYUSER/projects/termsonic-72bd149efa008c33c0be810b0f954c20cefffe96/cmd/termsonic/main.go:41 +0x2c8
Hi!
Alright, I'm seeing two different errors here:
> $ ./termsonic
> Loading artists...OK
> Loading playlists...OK
> panic: Get
> "https://REDACTED-NAVIDROME-SERVER/rest/getMusicDirectory?c=termsonic&f=xml&id=738de9c478aaf7f25ea07c2b9dec4bc1&p=REDACTED_NAVIDROME_PASSWORD&u=REDACTED_NAVIDROME_USER&v=1.8.0":
> EOF [recovered] panic: Get
> "https://REDACTED-NAVIDROME-SERVER/rest/getMusicDirectory?c=termsonic&f=xml&id=738de9c478aaf7f25ea07c2b9dec4bc1&p=REDACTED_NAVIDROME_PASSWORD&u=REDACTED_NAVIDROME_USER&v=1.8.0":
> EOF
This one is your Navidrome server cutting the connection short for some
reason. Not sure at all what the reason is: if this happens again,
could you maybe navigate to the URL using your Web browser and see if
you get any sort of error from Navidrome?
> ./termsonic
> Loading artists...OK
> Loading playlists...OK
> panic: runtime error: slice bounds out of range [:1] with capacity 0
> [recovered] panic: runtime error: slice bounds out of range [:1] with
> capacity 0
This one's on me: pressing "n" to add an album to an empty play queue
tries to insert it in position "1", which crashes the application. I
never ran into this because I always press "Enter" on the first song of
an album to play it...I've added a failsafe to the Insert() method,
this should work correctly now (you might have to manually
pause/unpause to force the queue to start playing though).
As for the fact that song playback takes a bit of time to start, I'm
trying to investigate the issue: I believe it might be linked to doing
too many useless requests when adding an album to the play queue. I'm
usually running Termsonic against a local server, so I've never ran
into this issue (but I do see it when using the Navidrome demo server).
Happy holidays,