fabiofalci / sconsify

A spotify console application
https://fabiofalci.github.io/sconsify
Apache License 2.0
566 stars 26 forks source link

Album display, in correct order. #76

Open msm-code opened 7 years ago

msm-code commented 7 years ago

I'll start with saying that sconsify is really great idea in principle, congratulations.

I'd love to use it exclusively, but I just can't get used to some things. For example, I mainly listen to whole albums. In spotify, when you enter artist page, songs are grouped in albums, and you can easily listen to whole albums (that's main way I listen to music). You can also search for specific albums, and results are ordered correctly. I realise that it's possible to search by artist/album, but usually results are in wrong order and/or mixed between albums.

Is it possible to easily open only one album in correct order currently (I guess no)? Would that be very hard to implement (I don't like go, but If you're open to pull requests maybe I could help)?

fabiofalci commented 7 years ago

I started something in this sense but haven't finished yet. It's released but I didn't publish in the release notes.

If you type i it will load a kind of "more info" about the artist you are current on. That includes top tracks and top albums. You can then go to each album and load the tracks from that album (not sure about the track order though). But as you'll see it duplicates albums, don't remember why exactly, that's the reason we didn't officially add to release notes (and the UI gets in a mess as well, not sure if is the right thing to do UI wise).

But that doesn't solve your issue, it only shows that we can potentially fix it, as it doesn't load all the albums, only the top ones.

I believe the proper fix for you would be, when searching for Album, instead of doing a general search, search for that particular album and then get the tracks. That should be possible to do as spotify web api has an endpoint for that:

https://developer.spotify.com/web-api/get-album/

If that would be hard to implement, I don't know, but it'd need to first find the Album ID to use the endpoint. So, in fact, it'd be 2 calls, one to get the Album ID based on a name and the second one to get the albums.

Not sure how to get an Album ID from a name, needs some researching in the web api.

msm-code commented 7 years ago

This... this is actually really good (not perfectly user friendly, because if I want to get to albums I have to search two times, but it's a minor problem.

Except, as you said, it duplicates some albums and aren't showing others. Is it by design (showing only top albums, duplication is obviously a bug), or something that can be changed?

Oh, and pressing 'i' three times in a row crashes whole application for some reason ;)

╭─msm@mercury /home/msm                                                                                                                                                                                                                        
╰─$ ./sconsify 
Sconsify - your awesome Spotify music service in a text-mode interface.
Premium account username: msm2e4d534d
Password: ********
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for 4294967295, skipping unlock
Loaded 24 from 24 playlists
panic: runtime error: index out of range

goroutine 36 [running]:
panic(0x8055c0, 0xc42000c140)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/fabiofalci/sconsify/ui/simple.artistAlbums(0xc420089000, 0xc4204d8180, 0x0, 0xcb06e0)
        /go/src/github.com/fabiofalci/sconsify/ui/simple/cui_actions.go:393 +0xa7
github.com/fabiofalci/sconsify/ui/simple.keyPressed(0x69, 0xc420089000, 0xc4204d8180, 0x2, 0x2)
        /go/src/github.com/fabiofalci/sconsify/ui/simple/cui_actions.go:315 +0x2b5
github.com/fabiofalci/sconsify/ui/simple.keybindings.func1(0xc420089000, 0xc4204d8180, 0xc42002e800, 0x45a1e0)
        /go/src/github.com/fabiofalci/sconsify/ui/simple/cui_actions.go:204 +0x3c
github.com/fabiofalci/sconsify/ui/simple.keybindings.func6(0xc420089000, 0xc4204d8180, 0x41aecd, 0xc420181ee8)
        /go/src/github.com/fabiofalci/sconsify/ui/simple/cui_actions.go:283 +0x3d
github.com/fabiofalci/sconsify/vendor/github.com/jroimartin/gocui.(*Gui).onKey(0xc420089000, 0xc420181e00, 0x627c45, 0x18)
        /go/src/github.com/fabiofalci/sconsify/vendor/github.com/jroimartin/gocui/gui.go:569 +0x144
github.com/fabiofalci/sconsify/vendor/github.com/jroimartin/gocui.(*Gui).handleEvent(0xc420089000, 0xc420181e00, 0xc420181df8, 0x1)
        /go/src/github.com/fabiofalci/sconsify/vendor/github.com/jroimartin/gocui/gui.go:312 +0x40
github.com/fabiofalci/sconsify/vendor/github.com/jroimartin/gocui.(*Gui).MainLoop(0xc420089000, 0x8b35b0, 0xc42001aaf0)
        /go/src/github.com/fabiofalci/sconsify/vendor/github.com/jroimartin/gocui/gui.go:271 +0x19a
github.com/fabiofalci/sconsify/ui/simple.(*Gui).startGui(0xc42001aaf0)
        /go/src/github.com/fabiofalci/sconsify/ui/simple/cui.go:196 +0x21b
created by github.com/fabiofalci/sconsify/ui/simple.(*ConsoleUserInterface).NewPlaylists
        /go/src/github.com/fabiofalci/sconsify/ui/simple/cui.go:114 +0xa9

I believe the proper fix for you would be, when searching for Album, instead of doing a general search, search for that particular album and then get the tracks. That should be possible to do as spotify web api has an endpoint for that:

That'd be great, but probably raises some implementation problems (like, what if there are two albums with the same name? And it happens sometimes). Spotify implements it in interesting way - when you search for something, you get top songs matching query, and around 3 top artists and 3 top albums. And you can either start playing right away, or enter album/artist page. This is probably perfect solution, but implementation would take some time.