Last active
August 14, 2023 04:01
-
-
Save ooobo/70927090d8a93a201a28 to your computer and use it in GitHub Desktop.
AppleScript: export songs from Swinsian playlist and rename as numbered files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- great for exporting a playlist from Swinsian to another music playing software, while keeping the order of the playlist. | |
-- to install: open Script Editor.app, paste this, go File > Export, choose File Format: application, save anywhere you like. | |
-- to use: select tracks to export in Swinsian, then run the app you just saved. | |
-- note: doesn't handle those files already existing in selected folder. pads for two-digits, adds artist - title.ext | |
set theFolder to choose folder | |
set text item delimiters to "." | |
tell application "Swinsian" | |
set selected to selection of window 1 | |
-- check that the playlist is not empty | |
if selected is not {} then | |
-- find out how many items in the playlist | |
set c to count of selected's items | |
-- then export tracks | |
repeat with i from 1 to c | |
set trk to POSIX file (location of (item i of selected)) as alias | |
set trkname to name of (item i of selected) | |
set trkartist to artist of (item i of selected) | |
tell application "Finder" | |
set thisFile to trk | |
set newFile to duplicate thisFile to theFolder | |
set ti to text items of (get name of thisFile) | |
set ipad to i as text | |
if the length of ipad is 1 then | |
set ipad to "0" & i | |
else | |
set ipad to i | |
end if | |
if number of ti is 1 then | |
set newName to ipad & " " & trkartist & " - " & trkname & "" | |
else | |
set newName to ipad & " " & trkartist & " - " & trkname & "." & item -1 of ti | |
end if | |
set name of newFile to newName | |
end tell | |
end repeat | |
end if | |
end tell |
the script stops at 10 song complaining about it can be converted to unicode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazing thank you so much!