text
stringlengths
0
15.7k
source
stringlengths
6
112
display dialog theUtilitiesMYTDLUninstalledLabel buttons {theUtilitiesMYTDLUninstalledByeLabel} default button 1 with icon file MacYTDL_custom_icon_file_Trash giving up after 600
Main.applescript
else if utilities_button_number_returned is 3 then -- About
Main.applescript
my show_about()
Main.applescript
end utilities
Main.applescript
on show_about()
Main.applescript
set theButtonsAbout1Label to (localized string "MacYTDL is a simple AppleScript program for downloading videos from various web sites. It uses the" from table "MacYTDL") & " " & DL_Use_YTDLP & " " & (localized string "Python script as the download engine." from table "MacYTDL")
Main.applescript
set about_text_1 to theButtonsAbout1Label
Main.applescript
set theButtonsAbout2Label to localized string "Please post any questions or suggestions to github.com/section83/MacYTDL/issues" from table "MacYTDL"
Main.applescript
set theButtonsAbout3Label to localized string "Written by © Vincentius, " from table "MacYTDL"
Main.applescript
set theButtonsAbout4Label to localized string "With thanks to Shane Stanley, Adam Albrec, kopurando, Michael Page, Tombs and all MacYTDL users." from table "MacYTDL"
Main.applescript
set about_text_2 to theButtonsAbout2Label & return & return & theButtonsAbout3Label & MacYTDL_date & ". " & theButtonsAbout4Label
Main.applescript
set theButtonsAboutDiagLabel to localized string "About MacYTDL" from table "MacYTDL"
Main.applescript
set about_diag_prompt to theButtonsAboutDiagLabel
Main.applescript
set accViewWidth to 300
Main.applescript
set theButtonsVisitLabel to localized string "Visit Site" from table "MacYTDL"
Main.applescript
set theButtonsEmailLabel to localized string "Send E-Mail" from table "MacYTDL"
Main.applescript
set {theButtons, minWidth} to create buttons {theButtonsVisitLabel, theButtonsEmailLabel, theButtonOKLabel} button keys {"v", "e", ""} default button 3
Main.applescript
set {about_Rule, theTop} to create rule 10 rule width accViewWidth
Main.applescript
set {about_instruct_2, theTop} to create label about_text_2 left inset 5 bottom (theTop + 10) max width accViewWidth aligns left aligned with multiline
Main.applescript
set {about_instruct_1, theTop} to create label about_text_1 left inset 75 bottom (theTop + 10) max width accViewWidth - 75 aligns left aligned with multiline
Main.applescript
set {about_prompt, theTop} to create label about_diag_prompt left inset 0 bottom (theTop) max width minWidth aligns center aligned with bold type
Main.applescript
set about_allControls to {about_Rule, MacYTDL_icon, about_instruct_1, about_instruct_2, about_prompt}
Main.applescript
set {about_button_returned, about_button_number_returned, about_controls_results} to display enhanced window diag_Title buttons theButtons acc view width accViewWidth acc view height theTop acc view controls about_allControls
Main.applescript
if about_button_number_returned is 3 then -- OK
Main.applescript
if about_button_number_returned is 1 then -- Visit Site
Main.applescript
open location "https://github.com/section83/MacYTDL/"
Main.applescript
if about_button_number_returned is 2 then -- Send Email
Main.applescript
open location "mailto:macytdl@gmail.com?subject=MacYTDL%20Feedback%2FQuestion"
Main.applescript
end show_about
Main.applescript
on get_YTDL_credentials()
Main.applescript
set theCredentialsInstructionsLabel to localized string "Enter your user name and password in the boxes below for the next download, skip credentials and continue to download or return to the Main dialog." from table "MacYTDL"
Main.applescript
set theCredentialsDiagPromptLabel to localized string "Credentials for next download" from table "MacYTDL"
Main.applescript
set instructions_text to theCredentialsInstructionsLabel
Main.applescript
set credentials_diag_prompt to theCredentialsDiagPromptLabel
Main.applescript
set accViewWidth to 275
Main.applescript
set theButtonsCredSkipLabel to localized string "Skip" from table "MacYTDL"
Main.applescript
set {theButtons, minWidth} to create buttons {theButtonReturnLabel, theButtonsCredSkipLabel, theButtonOKLabel} button keys {"r", "s", ""} default button 3
Main.applescript
set theButtonsCredPasswordLabel to localized string "Password" from table "MacYTDL"
Main.applescript
set {theField_password, theTop} to create field "" placeholder text theButtonsCredPasswordLabel left inset accViewInset bottom 5 field width accViewWidth
Main.applescript
set theButtonsCredNameLabel to localized string "User name" from table "MacYTDL"
Main.applescript
set {theField_username, theTop} to create field "" placeholder text theButtonsCredNameLabel left inset accViewInset bottom (theTop + 20) field width accViewWidth
Main.applescript
set {utilities_instruct, theTop} to create label instructions_text left inset 75 bottom (theTop + 15) max width (accViewWidth - 75) aligns left aligned with multiline
Main.applescript
set {utilities_prompt, theTop} to create label credentials_diag_prompt left inset 0 bottom (theTop + 10) max width accViewWidth aligns center aligned with bold type
Main.applescript
set credentials_allControls to {theField_username, theField_password, MacYTDL_icon, utilities_instruct, utilities_prompt}
Main.applescript
set {credentials_button_returned, credentialsButtonNumberReturned, credentials_results} to display enhanced window diag_Title buttons theButtons acc view width accViewWidth acc view height theTop acc view controls credentials_allControls
Main.applescript
if credentialsButtonNumberReturned is 3 then
Main.applescript
set theField_username_choice to item 1 of credentials_results -- <= User name
Main.applescript
set theField_password_choice to item 2 of credentials_results -- <= Password
Main.applescript
set YTDL_credentials to "--username " & theField_username_choice & " --password " & theField_password_choice & " "
Main.applescript
return YTDL_credentials
Main.applescript
else if credentialsButtonNumberReturned is 2 then
Main.applescript
end get_YTDL_credentials
Main.applescript
on add_To_Batch(URL_user_entered, download_filename_new, YTDL_remux_format)
Main.applescript
if YTDL_remux_format contains "--recode-video" then
Main.applescript
set all_words to words in YTDL_remux_format
Main.applescript
repeat with i from 1 to the length of all_words
Main.applescript
if item i of all_words is "recode" then exit repeat
Main.applescript
set new_extension to item (i + 2) in all_words
Main.applescript
set the_first_file_name to first paragraph of download_filename_new
Main.applescript
set AppleScript's text item delimiters to {"."}
Main.applescript
set old_extension to last text item of the_first_file_name
Main.applescript
if old_extension is not equal to new_extension then
Main.applescript
set download_filename_new to run_Utilities_handlers's replace_chars(download_filename_new, old_extension, new_extension)
Main.applescript
set download_filename_new to run_Utilities_handlers's replace_chars(download_filename_new, "_", " ")
Main.applescript
if character 1 of URL_user_entered is "'" then
Main.applescript
set URL_user_entered_lines to text 2 thru -2 of URL_user_entered
Main.applescript
set URL_user_entered_lines to URL_user_entered
Main.applescript
set URL_user_entered_lines to text 1 thru end of (run_Utilities_handlers's replace_chars(URL_user_entered_lines, " ", return))
Main.applescript
set count_of_URLs to count of paragraphs in URL_user_entered_lines
Main.applescript
if count_of_URLs is greater than 1 then
Main.applescript
set URL_user_entered_forming to ""
Main.applescript
repeat with i from 1 to count_of_URLs
Main.applescript
set URL_user_entered_forming to URL_user_entered_forming & paragraph i of URL_user_entered_lines & "#" & paragraph i of download_filename_new & "$" & YTDL_remux_format & return
Main.applescript
set download_filename_new to text 1 thru -1 of download_filename_new
Main.applescript
set URL_user_entered_forming to URL_user_entered_lines & "#" & download_filename_new & "$" & YTDL_remux_format & return
Main.applescript
set batch_file to POSIX file (MacYTDL_preferences_path & batch_filename) as «class furl»
Main.applescript
set batch_refNum to missing value
Main.applescript
set batch_refNum to open for access batch_file with write permission
Main.applescript
write URL_user_entered_forming to batch_refNum starting at eof as «class utf8»
Main.applescript
close access batch_refNum
Main.applescript
on error batch_errMsg
Main.applescript
set theBatchErrorLabel to localized string "There was an error: " from table "MacYTDL"
Main.applescript
display dialog theBatchErrorLabel & batch_errMsg
Main.applescript
set theAddedToBatchLabel to localized string "The URL has been added to batch file." from table "MacYTDL"
Main.applescript
display dialog theAddedToBatchLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
end add_To_Batch
Main.applescript
on open_batch_processing(folder_chosen, remux_format_choice, subtitles_choice, YTDL_credentials, YTDL_subtitles, YTDL_STEmbed, YTDL_format, YTDL_remux_format, YTDL_Remux_original, YTDL_description, YTDL_audio_only, YTDL_audio_codec, YTDL_over_writes, YTDL_Thumbnail_Write, YTDL_Thumbnail_Embed, YTDL_metadata, YTDL_limit...
Main.applescript
set batch_tally_number to tally_batch()
Main.applescript
set theBatchFunctionsInstructionLabel to localized string "Choose to download list of URLs in batch file, clear the batch list, edit the batch list, remove last addition to the batch or return to Main dialog." from table "MacYTDL"
Main.applescript
set theBatchFunctionsDiagPromptLabel to localized string "Batch Functions" from table "MacYTDL"
Main.applescript
set instructions_text to theBatchFunctionsInstructionLabel
Main.applescript
set batch_diag_prompt to theBatchFunctionsDiagPromptLabel
Main.applescript
set accViewWidth to 500
Main.applescript
set theButtonsEditLabel to localized string "Edit" from table "MacYTDL"
Main.applescript
set theButtonsClearLabel to localized string "Clear" from table "MacYTDL"
Main.applescript
set theButtonsRemoveLabel to localized string "Remove last item" from table "MacYTDL"
Main.applescript
set {theButtons, minWidth} to create buttons {theButtonReturnLabel, theButtonsEditLabel, theButtonsClearLabel, theButtonsRemoveLabel, theButtonDownloadLabel} button keys {"r", "e", "c", "U", "d"} default button 5
Main.applescript
set {theBatchRule, theTop} to create rule 10 rule width accViewWidth
Main.applescript
set theNumberVideosLabel to localized string "Number of videos in batch: " from table "MacYTDL"
Main.applescript
set {batch_tally, theTop} to create label theNumberVideosLabel & batch_tally_number left inset 25 bottom (theTop + 15) max width 225 aligns left aligned
Main.applescript