text
stringlengths
0
15.7k
source
stringlengths
6
112
set switch_FFmpeg to button returned of (display dialog (theFFmpegSwitchLabel & " " & installed_FFmpeg_arch & theFFmpegToLabel & new_FFmpeg_arch & " ?") buttons {theButtonNoLabel, theButtonYesLabel} default button 2 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if switch_FFmpeg is theButtonYesLabel then
Main.applescript
run_Utilities_handlers's install_ffmpeg_ffprobe(theButtonOKLabel, diag_Title, path_to_MacYTDL, usr_bin_folder, resourcesPath, MacYTDL_custom_icon_file, user_on_old_os, new_FFmpeg_arch)
Main.applescript
if utilities_YTDL_webpage_choice is true then
Main.applescript
open location "https://github.com/ytdl-org/youtube-dl"
Main.applescript
open location "https://github.com/yt-dlp/yt-dlp"
Main.applescript
if utilities_Switch_choice is true then
Main.applescript
set alert_text_ytdl to "Switching"
Main.applescript
set user_wants_switch to "yt-dlp"
Main.applescript
if ytdlp_exists is false and homebrew_ytdlp_exists is false then
Main.applescript
check_ytdl(show_yt_dlp)
Main.applescript
if ytdlp_exists is false and homebrew_ytdlp_exists is true then
Main.applescript
set thePreferMainOrBrewYTDLPInstallTextLabel to localized string "You currently have a Homebrew install of YT-DLP. Do you wish to switch to a MacYTDL install ?" from table "MacYTDL"
Main.applescript
set choiceMainOrBrewYTDL to button returned of (display dialog thePreferMainOrBrewYTDLPInstallTextLabel with title diag_Title buttons {theButtonNoLabel, theButtonYesLabel} default button 2 with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if choiceMainOrBrewYTDL is theButtonYesLabel then
Main.applescript
if alert_text_ytdl does not contain "is out of date" then
Main.applescript
if utilities_Save_Settings_choice is true then
Main.applescript
set DL_Saved_Settings_Location_Alias to DL_Saved_Settings_Location as alias
Main.applescript
set save_settings_file_name to (choose file name with prompt "Save MacYTDL Settings" & return & "Enter a file name and choose a location" default location DL_Saved_Settings_Location_Alias default name "Name for your saved settings")
Main.applescript
on error number -128 -- If user cancels, go back to Main dialog
Main.applescript
set save_settings_file_name_text to save_settings_file_name as text
Main.applescript
if text -5 thru -1 of save_settings_file_name_text is not "plist" then
Main.applescript
set save_settings_file_name_posix to quoted form of ((POSIX path of save_settings_file_name) & ".plist") -- Need quoted posix form to pass to do shell script
Main.applescript
set save_settings_file_name_posix to quoted form of (POSIX path of save_settings_file_name)
Main.applescript
do shell script "cp -a " & MacYTDL_prefs_file & " " & save_settings_file_name_posix
Main.applescript
set last_colon_in_path to last_offset(save_settings_file_name_text, ":")
Main.applescript
set path_to_saved_settings_location to text 1 thru last_colon_in_path of save_settings_file_name_text
Main.applescript
set value of property list item "Saved_Settings_Location" to path_to_saved_settings_location
Main.applescript
if utilities_Restore_Settings_choice is true then
Main.applescript
set restore_settings_file_name to choose file with prompt "Choose a settings file to restore:" default location DL_Saved_Settings_Location_Alias of type "plist"
Main.applescript
set restore_settings_file_name_text to restore_settings_file_name as text
Main.applescript
set restore_settings_file_name_posix to quoted form of (POSIX path of restore_settings_file_name) -- Need quoted posix form to pass to do shell script
Main.applescript
if restore_settings_file_name_posix = quoted form of MacYTDL_prefs_file then
Main.applescript
set theCannotRestoreLabel to localized string "Sorry, can't restore settings file to itself. Try again ?" from table "MacYTDL"
Main.applescript
set restore_or_giveup to button returned of (display dialog theCannotRestoreLabel with title diag_Title buttons {theButtonNoLabel, theButtonYesLabel} default button 2 with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if restore_or_giveup is theButtonNoLabel then
Main.applescript
set last_colon_in_path to last_offset(restore_settings_file_name_text, ":")
Main.applescript
set last_stop_in_path to last_offset(restore_settings_file_name_text, ".")
Main.applescript
set restored_settings_name to text (last_colon_in_path + 2) thru last_stop_in_path of restore_settings_file_name_text
Main.applescript
do shell script "cp -a " & restore_settings_file_name_posix & " " & MacYTDL_prefs_file
Main.applescript
set value of property list item "Name_Of_Settings_In_Use" to restored_settings_name
Main.applescript
set value of property list item "Saved_Settings_Location" to DL_Saved_Settings_Location
Main.applescript
if utilities_Return_Defaults_choice is true then
Main.applescript
set theReturnSettingsLabel to localized string "Do you really want to return to the default settings ?" from table "MacYTDL"
Main.applescript
set Really_Return_To_Defaults to button returned of (display dialog theReturnSettingsLabel with title diag_Title buttons {theButtonNoLabel, theButtonYesLabel} default button 2 with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if Really_Return_To_Defaults is theButtonYesLabel then
Main.applescript
if utilities_MacYTDL_check_choice is true then
Main.applescript
run_Utilities_handlers's check_MacYTDL(downloadsFolder_Path, diag_Title, theButtonOKLabel, theButtonNoLabel, theButtonYesLabel, MacYTDL_version, MacYTDL_custom_icon_file)
Main.applescript
if utilities_Atomic_choice is true then
Main.applescript
if Atomic_is_installed is false then
Main.applescript
set theDontNeedAPTextLabel to localized string "You are currently using yt-dlp and so there is no need for Atomic Parsley. Do you still wish to install Atomic Parsley ?" from table "MacYTDL"
Main.applescript
set reallyWantsAP to button returned of (display dialog theDontNeedAPTextLabel with title diag_Title buttons {theButtonNoLabel, theButtonYesLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if reallyWantsAP is theButtonNoLabel then main_dialog()
Main.applescript
run_Utilities_handlers's install_MacYTDLatomic(diag_Title, theButtonOKLabel, path_to_MacYTDL, usr_bin_folder)
Main.applescript
else if Atomic_is_installed is true then
Main.applescript
run_Utilities_handlers's remove_MacYTDLatomic(path_to_MacYTDL, theButtonOKLabel, diag_Title, MacYTDL_custom_icon_file)
Main.applescript
if utilities_Service_choice is true then
Main.applescript
set theServiceInstalledLabel to localized string "The MacYTDL Service is installed." from table "MacYTDL"
Main.applescript
display dialog theServiceInstalledLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 100
Main.applescript
else if isServiceInstalled is "Yes" then
Main.applescript
if DL_auto is true then
Main.applescript
set theButtonRemoveLabel to localized string "Remove" from table "MacYTDL"
Main.applescript
set theAutoDLisOnLabel to localized string "You have the Auto downloads setting on. You can cancel and return to Main dialog or remove the Service and turn off auto downloads." from table "MacYTDL"
Main.applescript
set reallyWantsAPRemoved to button returned of (display dialog theAutoDLisOnLabel with title diag_Title buttons {theButtonReturnLabel, theButtonRemoveLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if reallyWantsAPRemoved is theButtonReturnLabel then main_dialog()
Main.applescript
set Service_file_plist to (macYTDL_service_file_nonPosix & ":Contents:info.plist")
Main.applescript
run_Utilities_handlers's remove_MacYTDLservice()
Main.applescript
set theServiceRemovedLabel to localized string "The MacYTDL Service has been removed." from table "MacYTDL"
Main.applescript
display dialog theServiceRemovedLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 100
Main.applescript
else if utilities_button_number_returned is 1 then -- Delete logs
Main.applescript
do shell script "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_log-[ABCDEabcde]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_log-[FGHIJKLMNfghijklmn]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_log-[OPQRSTUVWXYZopqrstuvwxyz]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_log-[1234567890#~!@$%^]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_log-*" & " ~/.trash/"
Main.applescript
do shell script "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_response-[ABCDEabcde]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_response-[FGHIJKLMNfghijklmn]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_response-[OPQRSTUVWXYZopqrstuvwxyz]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_response-[1234567890#~!@$%^]*" & " ~/.trash/" & " ; " & "mv " & POSIX path of MacYTDL_preferences_path & "youtube-dl_response-*" & " ~/.trash/"
Main.applescript
set theUtilitiesDeleteLogsLabel to localized string "All MacYTDL log files are now in the Trash." from table "MacYTDL"
Main.applescript
display dialog theUtilitiesDeleteLogsLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 100
Main.applescript
else if utilities_button_number_returned is 2 then
Main.applescript
set theUtilitiesUninstallLabel to localized string "Do you really want to remove MacYTDL ? Everything will be moved to the Trash." from table "MacYTDL"
Main.applescript
set really_remove_MacYTDL to display dialog theUtilitiesUninstallLabel buttons {theButtonYesLabel, theButtonNoLabel} with title diag_Title default button 2 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set remove_answ to button returned of really_remove_MacYTDL
Main.applescript
if remove_answ is theButtonNoLabel then
Main.applescript
do shell script "mv /usr/local/bin/AtomicParsley" & " ~/.trash/AtomicParsley" with administrator privileges
Main.applescript
if YTDL_exists is true then
Main.applescript
do shell script "mv " & POSIX path of youtubedl_file & " ~/.trash/youtube-dl" with administrator privileges
Main.applescript
if ytdlp_exists is true then
Main.applescript
do shell script "mv " & POSIX path of ytdlp_file & " ~/.trash/yt-dlp" with administrator privileges
Main.applescript
if ffprobe_exists is true then
Main.applescript
do shell script "mv " & POSIX path of ffprobe_file & " ~/.trash/ffprobe" with administrator privileges
Main.applescript
if ffmpeg_exists is true then
Main.applescript
do shell script "mv " & POSIX path of ffmpeg_file & " ~/.trash/ffmpeg" with administrator privileges
Main.applescript
set path_to_macytdl_file to quoted form of (POSIX path of path_to_MacYTDL)
Main.applescript
do shell script "mv " & path_to_macytdl_file & " ~/.trash/MacYTDL.app" with administrator privileges
Main.applescript
do shell script "mv " & POSIX path of MacYTDL_preferences_path & " ~/.trash/MacYTDL"
Main.applescript
do shell script "mv " & quoted form of (POSIX path of DTP_file) & " ~/.trash/DialogToolkitMacYTDL.scptd" -- Quoted form because of space in "Script Libraries" folder name
Main.applescript
set User_defaults_path to "Library/Preferences/com.apple.script.id.MacYTDL.plist"
Main.applescript
set macYTDL_defaults_preferences_file to (POSIX path of (path to home folder) & User_defaults_path)
Main.applescript
do shell script "mv " & quoted form of (macYTDL_service_file) & " ~/.trash/Send-URL-To-MacYTDL.workflow"
Main.applescript
if (the file macYTDL_defaults_preferences_file exists) then
Main.applescript
tell current application to do shell script "mv " & quoted form of (macYTDL_defaults_preferences_file) & " ~/.trash/com.apple.script.id.MacYTDL.plist"
Main.applescript
set theUtilitiesMYTDLUninstalledLabel to localized string "MacYTDL is uninstalled. All components are in the Trash which you can empty when you wish. Cheers." from table "MacYTDL"
Main.applescript
set theUtilitiesMYTDLUninstalledByeLabel to localized string "Goodbye" from table "MacYTDL"
Main.applescript
set MacYTDL_custom_icon_file_Trash to (path_to_home_folder & ".Trash:MacYTDL.app:Contents:Resources:MacYTDL.icns") as string
Main.applescript