extensions
extensions copied to clipboard
Apple Music: Added artwork for tracks, albums, and playlists in grid view.
Description
Added optional grid view for tracks, albums, and playlists. There are options for grid item size as well.
Showing the artwork using AppleScript. However due to performance reasons, I need to :
- Resize some images (this increases loading time)
- Limit the number of shown results.
- Removed the
loadAll
feature for albums.
Let me know if you have any ideas to improve performance. Perhaps another method to resize the images faster.
However, that being said, I still think this is awesome!
Screencast



Checklist
- [x] I read the extension guidelines
- [x] I read the documentation about publishing
- [x] I ran
npm run build
and tested this distribution build in Raycast - [x] I checked that files in the
assets
folder are used by the extension itself - [x] I checked that assets used by the
README
are placed outside of themetadata
folder
Thank you for your contribution! :tada:
🔔 @Rawnly you might want to have a look.
Thank you! This looks dope! I’ll try it in the afternoon 💪
I left a few comments. Feel free to ignore them. These are not hard requirements I can fix those things in a new PR next time!
@Rawnly is it possible to play a track on repeat through applescript? I couldn't get it to work. Also, I am planning to add a push action for playlists, to see the songs of the playlist.
I don't know honestly, there's a website which references a lot of scripts (right now I don't remember the name)
http://dougscripts.com/itunes/index.php
Is this ready to be merged @Rawnly or would you help @yug2005 implement TaskEither first?
Not ready to merge yet. I will add a few features soon.
May I ask what is the reason/advantage of using TaskEither?
Added some awesome new features!
- You can see songs in a playlist.
- However the results still have to be limited.
- The list view is best for seeing more results because the artworks are really small.
- You can see up to 100 results.
- List detail view with a lot of information.
- Preferences for new features in extension configurations
https://user-images.githubusercontent.com/77864399/176850353-93c5b990-b4e1-4edb-b834-01b44c6f1aeb.mov
Added some awesome new features!
Love it!
May I ask what is the reason/advantage of using TaskEither?
Sure! TaskEither
is the composition of 2 types, Task
and Either
.
The Task
type "represents an asynchronous computation that yields a value of type A and never fails". But what about the errors? Here it comes our TaskEither
which is an alias for type TaskEither<E, A> = Task<Either<E, A>>
.
The Either
is a union type that can holds 2 values, an error (left
) and the return value of the function (right
). You might see some similarities with the Result
type in languages like rust
and swift
.
Everything is done to be type-safe. Since the error in the try/catch
cannot be typed.
You can see an example usage in the src/utils/apple-script.ts
file.
This explanation might not be super complete but it should clear the difference between a Promise
and a TaskEither
.
Once you've done your edits, if you want, I can contribute your PR by converting the code (if you're having difficulties with it).
I don't want this to be a problem for new contributors so, is fine for me if you want to learn something new or if you find it interesting. But if not, don't worry 😉
I tried the new updates. I'm having troubles when trying to "start playlist"
Error: Command failed with exit code 1: osascript -e
tell application "Music"
set playlistArtwork to first artwork of first playlist of (every playlist whose id is 4283)
set playlistImage to data of playlistArtwork
end tell
return playlistImage
I would also like to leave the List as default view since the Grid is empty until you don't perform a search. I thinks is a better UX, for example i'm not the kind of user who knows what to listen, and I like to scroll and then pick. So an empty view with the search is not the best for my experience 😅
Hello I haven't been able to reproduce the error for start playlist. Could you see if that playlist does not have any artwork? Maybe running the script in script editor to see what the issue is.
For the previous implementation of the list view, the loadAll
feature was only there for the albums right? I removed that feature because when you started to search for something while loadAll
was running, it would show you the results for the search query but then flicker back to show all songs once loadAll
was complete. List view is default for the playlist tracks view but I do think grid view looks really nice for the other views. Are you thinking about bringing back the loadAll feature for tracks and albums?
For Task Either, if you would like to implement it, please do. I am busy with some other things now.
@yug2005
Hello I haven't been able to reproduce the error for start playlist. Could you see if that playlist does not have any artwork? Maybe running the script in script editor to see what the issue is.
Yes it was caused by a Playlist without artwork. Can you please handle this? (Also for some tracks i'm having the same problems)
@Rawnly fixed the issue.
I'm having trouble when trying to "show tracks" inside "start playlist". Error isn't logged but I believe is with artwork. I'm trying to implement TaskEither so maybe i can fix that too. I'll let you know asap.

Make sure you are not using the id of the track as that sometimes varies (especially with tracks of playlists). That's why I made the switch to using database ID as that is always consistent.
@yug2005 I think too much stuff is going on here. Maybe we should split this PR.. Unfortunately I don't have enough time to implement TaskEither, but i'd like to reintroduce the loadAll maybe with pagination and infinite scrolling. You can do a little trick via onSelectedId
to make it work. Specific code can be found in the Github Gist extension source code
@Rawnly I tried using onSelectedId
but it was difficult to implement and did not work well. I was trying to implement it for the grid view. Fetching the artwork takes a long time and once you have a lot of artworks, unless you resize to something very small, you will run out of memory very quickly.
I guess that it would be doable for the list view if you resized to about 32x32 or smaller but even then it is possible to run out of memory. As for the grid view, its impossible if you want the artwork to look decent.
I think unless TaskEither has performance benefits, it is probably okay to skip for this PR as you could implement in a future one.
What are the status here now? 🙂
What are the status here now? 🙂
@pernielsentikaer
As i said before, the idea is cool but doesn't convince me 100%. Starting from the memory problem (due to images). I'm sorry but I'd wait for a better solution, maybe some other way to fetch images. The current implementation is slower and I don't think that images are worth the lack of speed :/
(i would like to keep the extensions dead simple and fast to use)
Thanks for the update 🔥 I'm converting this to a draft for now 🙂
This issue/pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean. Thanks for your contributions.