text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set download_filename_formats to quoted form of download_filename
|
Main.applescript
|
set chosen_formats_list to ""
|
Main.applescript
|
set chosen_formats_list to run_Utilities_handlers's get_formats_list(URL_user_entered, diag_Title, theButtonCancelLabel, theButtonDownloadLabel, X_position, screen_height, MacYTDL_custom_icon_file, MacYTDL_custom_icon_file_posix, theButtonReturnLabel, skip_Main_dialog, path_to_MacYTDL, DL_Use_YTDLP, shellPath, download_filename_formats, YTDL_credentials)
|
Main.applescript
|
set branch_execution to text item 1 of chosen_formats_list
|
Main.applescript
|
set format_id_output_template to ""
|
Main.applescript
|
if branch_execution is "Main" then
|
Main.applescript
|
else if branch_execution is "Download" then
|
Main.applescript
|
set YTDL_formats_to_download to " --format " & text item 2 of chosen_formats_list
|
Main.applescript
|
if YTDL_formats_to_download contains "," then
|
Main.applescript
|
set format_id_output_template to text item 3 of chosen_formats_list -- Contains "%(format_id)s" if user has asked to not merge but to download and retain each format
|
Main.applescript
|
if format_id_output_template is not "" then
|
Main.applescript
|
set YTDL_output_template to run_Utilities_handlers's replace_chars(YTDL_output_template, ".%(ext)s", "." & format_id_output_template & ".%(ext)s")
|
Main.applescript
|
set ytdl_settings to quoted form of (" --ignore-errors --newline " & YTDL_subtitles & YTDL_STEmbed & YTDL_credentials & 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_rate_value & YTDL_verbose & YTDL_Use_Proxy & YTDL_Use_Cookies & YTDL_no_playlist & YTDL_no_part & YTDL_Custom_Settings & YTDL_output_template & " " & YTDL_QT_Compat & " " & YTDL_formats_to_download & " ")
|
Main.applescript
|
if DL_over_writes is true then
|
Main.applescript
|
set downloadsFolder_Path_posix to (POSIX file downloadsFolder_Path)
|
Main.applescript
|
set downloadsFolder_Path_alias to downloadsFolder_Path_posix as alias
|
Main.applescript
|
set search_for_download to {}
|
Main.applescript
|
if ABC_show_indicator is "Yes" then
|
Main.applescript
|
set download_filename_new_plain to run_Utilities_handlers's replace_chars(download_filename_new, "_", " ")
|
Main.applescript
|
repeat with each_filename in (get paragraphs of download_filename_new_plain)
|
Main.applescript
|
set each_filename to each_filename as text
|
Main.applescript
|
if each_filename contains "/" then
|
Main.applescript
|
set offset_to_file_name to last_offset(each_filename, "/") + 2
|
Main.applescript
|
set each_filename to text offset_to_file_name thru end of each_filename
|
Main.applescript
|
set length_each_filename to count words of each_filename
|
Main.applescript
|
if length_each_filename is not 0 then
|
Main.applescript
|
set search_for_download to (name of files in downloadsFolder_Path_alias where name contains each_filename)
|
Main.applescript
|
if search_for_download is not {} then
|
Main.applescript
|
set theABCShowExistsLabel1 to localized string "A file for the ABC show" from table "MacYTDL"
|
Main.applescript
|
set theABCShowExistsLabel2 to localized string "already exists." from table "MacYTDL"
|
Main.applescript
|
set theABCShowExistsLabel3 to localized string "Do you want to continue anyway, download with a different name or stop and return to the main dialog ?" from table "MacYTDL"
|
Main.applescript
|
set theABCShowExistsButtonOverwriteLabel to localized string "Overwrite" from table "MacYTDL"
|
Main.applescript
|
set theABCShowExistsButtonNewnameLabel to localized string "New name" from table "MacYTDL"
|
Main.applescript
|
set overwrite_continue_choice to button returned of (display dialog theABCShowExistsLabel1 & " \"" & each_filename & "\" " & theABCShowExistsLabel2 & return & return & theABCShowExistsLabel3 buttons {theABCShowExistsButtonOverwriteLabel, theABCShowExistsButtonNewnameLabel, theButtonReturnLabel} default button 3 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600)
|
Main.applescript
|
if overwrite_continue_choice is theABCShowExistsButtonOverwriteLabel then
|
Main.applescript
|
set search_for_download to search_for_download as text
|
Main.applescript
|
set file_to_delete to quoted form of (POSIX path of (downloadsFolder_Path & "/" & search_for_download))
|
Main.applescript
|
do shell script "mv " & file_to_delete & " ~/.trash/"
|
Main.applescript
|
set ytdl_settings to quoted form of (" --ignore-errors --newline " & YTDL_subtitles & YTDL_STEmbed & YTDL_credentials & YTDL_format & YTDL_remux_format & YTDL_Remux_original & YTDL_description & YTDL_audio_only & YTDL_audio_codec & YTDL_metadata & YTDL_limit_rate_value & YTDL_verbose & YTDL_Use_Proxy & YTDL_Use_Cookies & YTDL_no_playlist & YTDL_no_part & YTDL_Custom_Settings & YTDL_output_template & " " & YTDL_QT_Compat & " " & YTDL_formats_to_download & " ")
|
Main.applescript
|
else if overwrite_continue_choice is theABCShowExistsButtonNewnameLabel then
|
Main.applescript
|
set YTDL_output_template_new to run_Utilities_handlers's replace_chars(YTDL_output_template, ".%(ext)s", "-2.%(ext)s")
|
Main.applescript
|
set set_new_download_filename to text 1 thru -5 of download_filename_new
|
Main.applescript
|
set download_filename_new to run_Utilities_handlers's replace_chars(download_filename_new, set_new_download_filename, set_new_download_filename & "-2")
|
Main.applescript
|
set ytdl_settings to quoted form of (" --ignore-errors --newline " & YTDL_subtitles & YTDL_STEmbed & YTDL_credentials & YTDL_format & YTDL_remux_format & YTDL_Remux_original & YTDL_description & YTDL_audio_only & YTDL_audio_codec & YTDL_over_writes & YTDL_metadata & YTDL_limit_rate_value & YTDL_verbose & YTDL_Use_Proxy & YTDL_Use_Cookies & YTDL_no_playlist & YTDL_no_part & YTDL_Custom_Settings & YTDL_output_template_new & " " & YTDL_QT_Compat & " " & YTDL_formats_to_download & " ")
|
Main.applescript
|
else if overwrite_continue_choice is theButtonReturnLabel then
|
Main.applescript
|
if DL_auto is false then
|
Main.applescript
|
my main_dialog()
|
Main.applescript
|
if (count of paragraphs of download_filename_new_plain) is greater than 1 then
|
Main.applescript
|
set download_filename_new to ABC_show_name
|
Main.applescript
|
else if SBS_show_indicator is "Yes" then
|
Main.applescript
|
set theShowExistsLabel1 to localized string "A file for the SBS show" from table "MacYTDL"
|
Main.applescript
|
set theShowExistsLabel2 to localized string "already exists." from table "MacYTDL"
|
Main.applescript
|
set theShowExistsLabel3 to localized string "Do you want to continue anyway, download with a different name or stop and return to the main dialog ?" from table "MacYTDL"
|
Main.applescript
|
set theShowExistsButtonOverwriteLabel to localized string "Overwrite" from table "MacYTDL"
|
Main.applescript
|
set theShowExistsButtonNewnameLabel to localized string "New name" from table "MacYTDL"
|
Main.applescript
|
set overwrite_continue_choice to button returned of (display dialog theShowExistsLabel1 & " \"" & each_filename & "\" " & theShowExistsLabel2 & return & return & theShowExistsLabel3 buttons {theShowExistsButtonOverwriteLabel, theShowExistsButtonNewnameLabel, theButtonReturnLabel} default button 3 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600)
|
Main.applescript
|
if overwrite_continue_choice is theShowExistsButtonOverwriteLabel then
|
Main.applescript
|
else if overwrite_continue_choice is theShowExistsButtonNewnameLabel then
|
Main.applescript
|
set download_filename_new to SBS_show_name
|
Main.applescript
|
repeat with each_filename in (get paragraphs of YTDL_simulate_log)
|
Main.applescript
|
set theShowExistsWarningTextLabel1 to localized string "The file" from table "MacYTDL"
|
Main.applescript
|
set theShowExistsWarningTextLabel2 to localized string "already exists." from table "MacYTDL"
|
Main.applescript
|
set theShowExistsWarningTextLabel3 to localized string "Do you want to continue anyway, download with a different name or stop and return to the main dialog ?" from table "MacYTDL"
|
Main.applescript
|
set overwrite_continue_choice to button returned of (display dialog theShowExistsWarningTextLabel1 & " \"" & each_filename & "\" " & theShowExistsWarningTextLabel2 & return & return & theShowExistsWarningTextLabel3 buttons {theShowExistsButtonOverwriteLabel, theShowExistsButtonNewnameLabel, theButtonReturnLabel} default button 3 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600)
|
Main.applescript
|
if SBS_show_indicator is "Yes" then
|
Main.applescript
|
add_To_Batch(URL_user_entered, download_filename_new, YTDL_remux_format)
|
Main.applescript
|
set myMonitorScriptAsString to quoted form of ((POSIX path of path_to_MacYTDL) & "Contents/Resources/Scripts/Monitor.scpt")
|
Main.applescript
|
try -- In a try block to catch error of nil pids returned
|
Main.applescript
|
set monitor_dialogs_list to do shell script "pgrep -f osascript"
|
Main.applescript
|
set monitor_dialog_position to ((count of paragraphs in monitor_dialogs_list) / 2) + 1
|
Main.applescript
|
set monitor_dialog_position to 1
|
Main.applescript
|
if ABC_show_name is not "" or SBS_show_name is not "" then
|
Main.applescript
|
set URL_user_entered to quoted form of URL_user_entered
|
Main.applescript
|
set download_filename to quoted form of download_filename
|
Main.applescript
|
set download_filename_new to quoted form of download_filename_new
|
Main.applescript
|
set YTDL_log_file to quoted form of YTDL_log_file
|
Main.applescript
|
set YTDL_simulate_log to text 1 thru -2 of YTDL_simulate_log
|
Main.applescript
|
set YTDL_simulate_log to quoted form of YTDL_simulate_log
|
Main.applescript
|
set diag_Title_quoted to quoted form of diag_Title
|
Main.applescript
|
set YTDL_TimeStamps_quoted to quoted form of YTDL_TimeStamps
|
Main.applescript
|
set my_params to quoted form of downloadsFolder_Path & " " & quoted form of MacYTDL_preferences_path & " " & YTDL_TimeStamps_quoted & " " & ytdl_settings & " " & URL_user_entered & " " & YTDL_log_file & " " & download_filename & " " & download_filename_new & " " & quoted form of MacYTDL_custom_icon_file_posix & " " & monitor_dialog_position & " " & YTDL_simulate_log & " " & diag_Title_quoted & " " & is_Livestream_Flag & " " & screen_width & " " & screen_height & " " & DL_Use_YTDLP & " " & quoted form of path_to_MacYTDL
|
Main.applescript
|
if DL_Show_Settings is true then
|
Main.applescript
|
set branch_execution to run_Utilities_handlers's show_settings(YTDL_subtitles, DL_Remux_original, DL_YTDL_auto_check, DL_STEmbed, DL_audio_only, YTDL_description, DL_Limit_Rate, DL_over_writes, DL_Thumbnail_Write, DL_verbose, DL_Thumbnail_Embed, DL_Add_Metadata, DL_Use_Proxy, DL_Use_Cookies, DL_Use_Custom_Template, DL_Use_Custom_Settings, remux_format_choice, DL_TimeStamps, DL_Use_YTDLP, YTDL_version, folder_chosen, theButtonQuitLabel, theButtonCancelLabel, theButtonDownloadLabel, DL_Show_Settings, MacYTDL_prefs_file, MacYTDL_custom_icon_file_posix, diag_Title)
|
Main.applescript
|
if branch_execution is "Settings" then set_settings()
|
Main.applescript
|
if branch_execution is "Quit" then quit_MacYTDL()
|
Main.applescript
|
do shell script "osascript -s s " & myMonitorScriptAsString & " " & my_params & " " & " > /dev/null 2> /dev/null &"
|
Main.applescript
|
set URL_user_entered to ""
|
Main.applescript
|
set SBS_show_URLs to ""
|
Main.applescript
|
set ABC_show_URLs to ""
|
Main.applescript
|
if skip_Main_dialog is false then
|
Main.applescript
|
end download_video
|
Main.applescript
|
on check_cookies_file(DL_Cookies_Location)
|
Main.applescript
|
set cookies_Path_posix to (POSIX file DL_Cookies_Location)
|
Main.applescript
|
set cookies_Path_alias to cookies_Path_posix as alias
|
Main.applescript
|
set theCookiesFileMissingLabel to localized string "Your cookies file is not available. You can make it available then click on Continue, return to set a new cookies location or quit." from table "MacYTDL"
|
Main.applescript
|
set quit_or_return to button returned of (display dialog theCookiesFileMissingLabel buttons {theButtonQuitLabel, theButtonReturnLabel, theButtonContinueLabel} default button 2 cancel button 1 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600)
|
Main.applescript
|
else if quit_or_return is theButtonQuitLabel then
|
Main.applescript
|
end check_cookies_file
|
Main.applescript
|
on check_download_folder(folder_chosen)
|
Main.applescript
|
if folder_chosen = downloadsFolder_Path then
|
Main.applescript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.