Login About Gallery
CSV to Playlists
COMMENT
This shortcut is my answer to https://www.reddit.com/r/shortcuts/comments/a1ebk8/spreadsheet_to_apple_music/ The CSV part is trivial, but the music search seemed an interesting challenge. It ended being a bit longer than expected, but only the 1s delay at the end made me think. — @atnbueno (2018-11-30)
TEXT
Basia,The Best of Basia New York Voices,Sing (The Songs of Paul Simon) Alanis Morissette,Jagged Little Pill Fleetwood Mac,Rumours Jerome Moross,The Big Country Lake Street Dive,Side Pony
COMMENT
The text above imitates a CSV file with two items per line, first Artist, then Album, separated by a comma without spaces around it. Neither Artist nor Album must include a comma. Some countries use a different separator for CSV files. If this is the case, The user must change it in the second "Split Text" action below.
TEXT
Split
Text
by
New Lines
SCRIPTING
Repeat with each item in
Input
TEXT
Split
Text
by
Custom
,
SCRIPTING
Get
First Item
from
List
VARIABLES
Set variable
Artist
to
Input
VARIABLES
SCRIPTING
Get
Last Item
from
List
VARIABLES
Set variable
Album
to
Input
COMMENT
"
Album
-
Artist
" is the default format string for the playlists. The user can change it at will, but to use details of the found album, these actions (from here to the first End If) must be moved after the definition of the "Album Match" variable.
TEXT
Album
-
Artist
VARIABLES
Set variable
Playlist Title
to
Input
COMMENT
Before anything else, check if a playlist named "
Playlist Title
" already exists. If it does, give the user a chance to avoid having multiple playlists with the same title.
MUSIC
Get songs in
Playlist Title
SCRIPTING
If
Input
Condition
SCRIPTING
Show alert
CSV to Playlists
Title
CSV to Playlists
Show Cancel Button
End If
COMMENT
Look for albums named "
Album
".
ITUNES STORE
Search iTunes Store for
Album
Category
Music
Search By
Album
Results
Albums
Region
Region
COMMENT
There is no filter for iTunes products, so I have to look for "
Artist
" myself.
SCRIPTING
Repeat with each item in
Input
ITUNES STORE
Get
Artist
from
iTunes product
SCRIPTING
If
Input
Condition
VARIABLES
Get
Repeat Item 2
Otherwise
NOTHING
Nothing
End If
End Repeat
VARIABLES
Set variable
Album Matches
to
Input
SCRIPTING
Count
Items
in
Input
SCRIPTING
If
Input
Condition
COMMENT
No album match. Show a warning about it, and give the user a chance to stop at this point.
SCRIPTING
Show alert
CSV to Playlists
Title
CSV to Playlists
Show Cancel Button
NOTHING
Nothing
Otherwise
SCRIPTING
If
Input
Condition
COMMENT
Single album match.
VARIABLES
Get
Album Matches
Otherwise
COMMENT
Multiple album matches. Ask the user to pick which one to import as a playlist.
VARIABLES
Get
Album Matches
SCRIPTING
Choose from
Input
Prompt
Multiple album matches for "
Artist
" and "
Album
". Please pick one.
Select Multiple
End If
VARIABLES
Set variable
Album Match
to
Input
COMMENT
Time to create the playlist. The default playlist's author name is set to "Playlist from CSV". This can't be changed once the playlist has been created. The user can change it below if that is not acceptable.
MUSIC
Create playlist
Playlist Title
with
Music
Author
Playlist from CSV
Description
All my favorites
VARIABLES
Get
Album
COMMENT
Not sure why, but without a small pause, the playlist ends up empty.
SCRIPTING
Wait
1 second
MUSIC
Add
Music
to
Playlist Title
MUSIC
Get songs in
Playlist Title
SCRIPTING
Count
Items
in
Input
SCRIPTING
Show alert
CSV to Playlists
Title
CSV to Playlists
Show Cancel Button
End If
End Repeat

Showcuts

Magic Vars

Screenshot

Submitted Anonymously a month ago

This is an old shortcut, so some variables might be missing!

Visit iCloud (iOS)

Copy iCloud Link

Scan QR Code

0