Fix initial album fetch + cleanup#232
Conversation
Co-authored-by: Huỳnh Thiện Khiêm <42716602+htkhiem@users.noreply.github.com>
c9c7711 to
fd4e589
Compare
|
Hey @htkhiem I added the things you asked. Since the image bytes are written into a separate buffer (due to image format requirements I haven't noticed in the initial impl), from_owned can be used anyways. Please take a look when you get the time, cheers! |
htkhiem
left a comment
There was a problem hiding this comment.
(optional request) I think I've found a way to further optimise the .texture() calls for newly-downloaded images.
|
@ShadiestGoat Do you think we should merge this PR as-is first then apply the above optimisation later? I think your fixes are pretty important and should be on I've given the PR a spin and it seems to work well, including for cold starts (by deleting my cache), so I think it's ready. |
|
Merging now since the optional fix also seems to work well. In case I've done something wrong please open a new PR 🙏. All in all, thanks again & hope you can keep contributing in the future! P.S. May I add your GitHub username & contact email to the About dialog's credit section? |
|
Hey - sorry for no reply for a while, it was a long week at work haha. I'll check it out in main, but if you tested it & it works, then it works! I'd gladly accept getting added to the contributors :) (perhaps just my username though, not email? thanks!) |
This is a fix for #230
The root cause was basically that sometimes some methods would return image names (1234.png), sometimes the full path (/home/name/.cache/euphonica/images/1234.png)
To fix this, I had a bit of a rabbit hole moment and updated a bunch of stuff to all return the same thing - the the image name. Imo its just more robust than the full path. Also, in some instances it'd get the full path, then extract the image name from there so I cleaned that up.
I also extracted some of the image loading parts into a util function, since they all do the same but slightly different. Finally, there was 1 todo in
set_image_internalwhich I resolved in what I hope is a clean mannerOne annoyance that I wanted to resolve but just couldn't figure out the borrow/lifetime thing with is
load_imageis exclusively used with the.external.callwrapper, and despite how much I tried i could not figure out how to make that wrapper be part of the load_image util so ://As with before, I'm not a rust person & am still flying more or less blind so please lmk if there is something wrong!