text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
on clean_name(originalName) | ExportPlaylists.applescript |
set originalNameQuoted to (quoted form of (originalName as string)) | ExportPlaylists.applescript |
set cleanAccents to (do shell script ({"echo ", originalNameQuoted, " | iconv -f UTF-8 -t ASCII//TRANSLIT"} as string)) | ExportPlaylists.applescript |
on error e number 1 | ExportPlaylists.applescript |
display dialog ({"Cannot clean ", originalNameQuoted, return, "Using original name …"} as string) with title myTitle buttons {"OK"} default button 1 with icon iconError giving up after 10 | ExportPlaylists.applescript |
set cleanAccents to originalNameQuoted | ExportPlaylists.applescript |
set AppleScript's text item delimiters to illegalCharacters1 | ExportPlaylists.applescript |
set listName to every text item of cleanAccents | ExportPlaylists.applescript |
set listNameString to (listName as string) | ExportPlaylists.applescript |
set AppleScript's text item delimiters to illegalCharacters2 | ExportPlaylists.applescript |
set listName to every text item of listNameString | ExportPlaylists.applescript |
return listNameString | ExportPlaylists.applescript |
end clean_name | ExportPlaylists.applescript |
on folder_exists(folderPath, newName, mode) | ExportPlaylists.applescript |
set pathToCheck to ({POSIX path of folderPath as string, newName} as string) | ExportPlaylists.applescript |
if ((mode is not "d") and (mode is not "f")) then | ExportPlaylists.applescript |
error ({"Cannot create folder or file ", pathToCheck, return, "The mode specified (", mode, ") is incorrect."} as string) number 1 | ExportPlaylists.applescript |
set found_var to (do shell script ({"if [ -", mode, " \"", pathToCheck, "\" ]; then echo \"FOUND\"; else echo \"NOT FOUND\"; fi"} as string)) | ExportPlaylists.applescript |
if found_var = "FOUND" then | ExportPlaylists.applescript |
end folder_exists | ExportPlaylists.applescript |
on make_dir(folderPath, newName) | ExportPlaylists.applescript |
set newPath to ({POSIX path of folderPath as string, newName} as string) | ExportPlaylists.applescript |
make new folder at (POSIX file folderPath) with properties {name:newName} | ExportPlaylists.applescript |
return ({newPath, "/"} as string) | ExportPlaylists.applescript |
end make_dir | ExportPlaylists.applescript |
on arabic2roman(n) | ExportPlaylists.applescript |
local r, i, n | ExportPlaylists.applescript |
if (n as integer) > 3999 then error "Max number is 3999." number 1 | ExportPlaylists.applescript |
set r to "" | ExportPlaylists.applescript |
repeat with i from 1 to (count (n as string)) | ExportPlaylists.applescript |
set r to item (((item -i of (n as string)) as integer) + 1) of item i of ¬ | ExportPlaylists.applescript |
{{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}, ¬ | ExportPlaylists.applescript |
{"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}, ¬ | ExportPlaylists.applescript |
{"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}, ¬ | ExportPlaylists.applescript |
{"", "M", "MM", "MMM"}} & r | ExportPlaylists.applescript |
error "Can't convert to Roman numeral: " & eMsg number eNum | ExportPlaylists.applescript |
end arabic2roman | ExportPlaylists.applescript |
on get_track_details(thisTrack) | ExportPlaylists.applescript |
if (nameChoice = true) then | ExportPlaylists.applescript |
set thisTrackName to (get name of thisTrack) | ExportPlaylists.applescript |
if ((work of thisTrack) as string) is "" then | ExportPlaylists.applescript |
set thisTrackName to ({(work of thisTrack) as string, ": ", my arabic2roman((movement number of thisTrack) as string), ". ", (movement of thisTrack) as string} as string) | ExportPlaylists.applescript |
if artist of thisTrack = "" then | ExportPlaylists.applescript |
set thisTrackArtist to "Unknown Artist" | ExportPlaylists.applescript |
set thisTrackArtist to (get artist of thisTrack) | ExportPlaylists.applescript |
if album of thisTrack = "" then | ExportPlaylists.applescript |
set thisTrackAlbum to "Unknown Album" | ExportPlaylists.applescript |
set thisTrackAlbum to (get album of thisTrack) | ExportPlaylists.applescript |
set thisTrackDuration to (get duration of thisTrack) | ExportPlaylists.applescript |
if (thisTrackDuration is missing value) then | ExportPlaylists.applescript |
set thisTrackDuration to null | ExportPlaylists.applescript |
set thisTrackDuration to round thisTrackDuration rounding down | ExportPlaylists.applescript |
set thisTrackLocation to (get location of thisTrack) | ExportPlaylists.applescript |
if ((item 2 of attrShow) is true) then | ExportPlaylists.applescript |
if album artist of thisTrack = "" then | ExportPlaylists.applescript |
set thisTrackAlbumArtist to "Unknown Album Artist" | ExportPlaylists.applescript |
set thisTrackAlbumArtist to (get album artist of thisTrack) | ExportPlaylists.applescript |
set thisTrackAlbumArtist to null | ExportPlaylists.applescript |
if ((item 4 of attrShow) is true) then | ExportPlaylists.applescript |
if ((composer of thisTrack) as string) is equal to "" then | ExportPlaylists.applescript |
set thisTrackComposer to "Unknown Composer" | ExportPlaylists.applescript |
set thisTrackComposer to (get composer of thisTrack) | ExportPlaylists.applescript |
set thisTrackComposer to null | ExportPlaylists.applescript |
if ((item 6 of attrShow) is true) then | ExportPlaylists.applescript |
set thisTrackNumber to (get track number of thisTrack) | ExportPlaylists.applescript |
set thisTrackNumber to null | ExportPlaylists.applescript |
if ((item 7 of attrShow) is true) then | ExportPlaylists.applescript |
set thisTrackDisc to (get disc number of thisTrack) | ExportPlaylists.applescript |
set thisTrackDisc to null | ExportPlaylists.applescript |
set thisTrackCompilation to (get compilation of thisTrack) | ExportPlaylists.applescript |
return {thisTrackName, thisTrackArtist, thisTrackAlbum, thisTrackDuration, thisTrackLocation, thisTrackAlbumArtist, thisTrackComposer, thisTrackNumber, thisTrackDisc, thisTrackCompilation} | ExportPlaylists.applescript |
end get_track_details | ExportPlaylists.applescript |
on value_of_attr(folderStructureItem, thisTrackDetails) | ExportPlaylists.applescript |
if folderStructureItem contains "[album]" then | ExportPlaylists.applescript |
return (item 3 of thisTrackDetails) | ExportPlaylists.applescript |
else if folderStructureItem contains "[album artist]" then | ExportPlaylists.applescript |
return (item 6 of thisTrackDetails) | ExportPlaylists.applescript |
else if folderStructureItem contains "[artist]" then | ExportPlaylists.applescript |
return (item 2 of thisTrackDetails) | ExportPlaylists.applescript |
else if folderStructureItem contains "[composer]" then | ExportPlaylists.applescript |
return (item 7 of thisTrackDetails) | ExportPlaylists.applescript |
else if folderStructureItem contains "[track name]" then | ExportPlaylists.applescript |
return (item 1 of thisTrackDetails) | ExportPlaylists.applescript |
else if folderStructureItem contains "[track number]" then | ExportPlaylists.applescript |
set trackNumber to (item 8 of thisTrackDetails) | ExportPlaylists.applescript |
if trackNumber < 10 then | ExportPlaylists.applescript |
return (("0" & trackNumber) as string) | ExportPlaylists.applescript |
return (trackNumber as string) | ExportPlaylists.applescript |
else if folderStructureItem contains "[disc number]" then | ExportPlaylists.applescript |
set discNumber to (item 9 of thisTrackDetails) | ExportPlaylists.applescript |
if discNumber < 10 then | ExportPlaylists.applescript |
return (("0" & discNumber) as string) | ExportPlaylists.applescript |
return (discNumber as string) | ExportPlaylists.applescript |
else if folderStructureItem contains "[playlist order number]" then | ExportPlaylists.applescript |
return folderStructureItem | ExportPlaylists.applescript |
else if folderStructureItem contains "[original file name]" then | ExportPlaylists.applescript |
end value_of_attr | ExportPlaylists.applescript |
on define_from_attributes(newTemplate, thisTrackDetails, thisPlaylistNumberSongs, j, i) | ExportPlaylists.applescript |
set AppleScript's text item delimiters to ("[") | ExportPlaylists.applescript |
set newTemplate_split to every text item of newTemplate | ExportPlaylists.applescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.