text
stringlengths
0
15.7k
source
stringlengths
6
112
set value of property list item "Keep_Remux_Original" to settings_original_choice
Main.applescript
set value of property list item "Over-writes allowed" to settings_forceOW_choice
Main.applescript
set value of property list item "Remux_Format" to settings_remux_format_choice
Main.applescript
set value of property list item "Show_Settings_before_Download" to settings_show_settings_choice
Main.applescript
set value of property list item "Add_TimeStamps" to settings_timestamps_choice
Main.applescript
set value of property list item "SubTitles" to settings_subtitles_choice
Main.applescript
set value of property list item "Subtitles_Format" to settings_subtitlesformat_choice
Main.applescript
set value of property list item "Subtitles_Language" to settings_subtitleslanguage_choice
Main.applescript
set value of property list item "Subtitles_YTAuto" to settings_autoST_choice
Main.applescript
set value of property list item "Thumbnail_Write" to settings_thumb_write_choice
Main.applescript
set value of property list item "Verbose" to settings_verbose_choice
Main.applescript
set value of property list item "Make_QuickTime_Compat" to settings_QT_Compat_choice
Main.applescript
set value of property list item "Get_Formats_List" to settings_formats_list_choice
Main.applescript
set services_Folder to ((path to home folder) & "Library:Services:") as text
Main.applescript
set macYTDL_service_file to services_Folder & "Send-URL-To-MacYTDL.workflow"
Main.applescript
set Service_file_plist to (macYTDL_service_file & ":Contents:info.plist")
Main.applescript
set isServiceInstalled to "No"
Main.applescript
if (exists the file macYTDL_service_file) then
Main.applescript
set isServiceInstalled to "Yes"
Main.applescript
if settings_auto_download_choice is true then
Main.applescript
if isServiceInstalled is "Yes" then
Main.applescript
set value of property list item "Auto_Download" to settings_auto_download_choice
Main.applescript
if show_yt_dlp is "yt-dlp" or show_yt_dlp is "yt-dlp-legacy" then -- This might not work on macOS earlier than 10.15
Main.applescript
set new_value to "Download Video Now"
Main.applescript
tell property list file Service_file_plist
Main.applescript
set value of property list item "default" of property list item "NSMenuItem" of property list item 1 of property list items of contents to new_value
Main.applescript
if isServiceInstalled is "No" then
Main.applescript
set theNeedServiceLabel to localized string "Sorry, to have automatic downloads, you need to install the MacYTDL Service. Discard settings changes and return to Main, install the Service and turn on auto downloads or save all but Auto-download changes" from table "MacYTDL"
Main.applescript
set theButtonsInstallLabel to localized string "Install" from table "MacYTDL"
Main.applescript
set autoDLNeedService to button returned of (display dialog (theNeedServiceLabel & " ?") with title diag_Title buttons {theButtonReturnLabel, theButtonsInstallLabel, theButtonsSaveLabel} default button 2 with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if autoDLNeedService is theButtonReturnLabel then main_dialog()
Main.applescript
if autoDLNeedService is theButtonsInstallLabel then
Main.applescript
run_Utilities_handlers's install_MacYTDLservice(path_to_MacYTDL)
Main.applescript
if show_yt_dlp is "yt-dlp" or show_yt_dlp is "yt-dlp-legacy" then
Main.applescript
else if settings_auto_download_choice is false and isServiceInstalled is "Yes" then
Main.applescript
set value of property list item "Auto_Download" to false
Main.applescript
set new_value to "Send-URL-To-MacYTDL"
Main.applescript
if settings_proxy_URL_choice is not "" then
Main.applescript
set protocol_chosen to text 1 thru 5 of settings_proxy_URL_choice
Main.applescript
if protocol_chosen is not "http:" and protocol_chosen is not "https" and protocol_chosen is not "socks" then
Main.applescript
set theNeedValidProtocolLabel to localized string "Sorry, you need a valid protocol for a proxy URL (http, https or socks)." from table "MacYTDL"
Main.applescript
display dialog theNeedValidProtocolLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
if settings_use_proxy_choice is true and settings_proxy_URL_choice is "" then
Main.applescript
set theMustProvideProxyURLLabel to localized string "Sorry, you need a proxy URL to use a proxy for downloads." from table "MacYTDL"
Main.applescript
display dialog theMustProvideProxyURLLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set value of property list item "Proxy_URL" to settings_proxy_URL_choice
Main.applescript
set value of property list item "Use_Proxy" to settings_use_proxy_choice
Main.applescript
if settings_use_cookies_choice is true and settings_cookies_location_choice is "/No Cookie File" then
Main.applescript
set theMustProvideProxyLocationLabel to localized string "Sorry, you need to give the location of your cookies file." from table "MacYTDL"
Main.applescript
display dialog theMustProvideProxyLocationLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set value of property list item "Use_Cookies" to settings_use_cookies_choice
Main.applescript
set value of property list item "Cookies_Location" to settings_cookies_location_choice
Main.applescript
if settings_use_custom_template_choice is true and (settings_custom_template_choice is "" or settings_custom_template_choice is " ") then
Main.applescript
set theMustProvideCustomTemplateLabel to localized string "Sorry, you have not provided a custom file name template." from table "MacYTDL"
Main.applescript
display dialog theMustProvideCustomTemplateLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
if settings_custom_template_choice is not equal to "" and settings_custom_template_choice does not end with ".%(ext)s" then
Main.applescript
set settings_custom_template_choice to settings_custom_template_choice & ".%(ext)s"
Main.applescript
set value of property list item "Use_Custom_Output_Template" to settings_use_custom_template_choice
Main.applescript
set value of property list item "Custom_Output_Template" to settings_custom_template_choice
Main.applescript
if settings_use_custom_settings_choice is true and settings_custom_settings_choice is "" then
Main.applescript
set theMustProvideCustomSettingsLabel to localized string "Sorry, you have not provided custom settings." from table "MacYTDL"
Main.applescript
display dialog theMustProvideCustomSettingsLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set value of property list item "Use_Custom_Settings" to settings_use_custom_settings_choice
Main.applescript
set value of property list item "Custom_Settings" to settings_custom_settings_choice
Main.applescript
set test_DL_folder to ""
Main.applescript
repeat until test_DL_folder is "file" or test_DL_folder is "folder" or test_DL_folder is "disk" or test_DL_folder is "«class cfol»" or test_DL_folder is "alias"
Main.applescript
tell application "System Events" to set test_DL_folder to (get class of item (settings_folder_choice as text)) as text
Main.applescript
set offset_to_file_name to last_offset(settings_folder_choice as text, "/")
Main.applescript
set settings_folder_choice to text 1 thru offset_to_file_name of settings_folder_choice
Main.applescript
set value of property list item "DownloadFolder" to settings_folder_choice
Main.applescript
set settings_limit_rate_value_choice to settings_limit_rate_value_choice as real
Main.applescript
set theLimitRateInvalidLabel to localized string "Sorry, you need a positive real number to limit download speed." from table "MacYTDL"
Main.applescript
display dialog theLimitRateInvalidLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
if settings_limit_rate_choice is true and (settings_limit_rate_value_choice is "" or settings_limit_rate_value_choice is less than or equal to 0) then
Main.applescript
set value of property list item "Limit_Rate" to settings_limit_rate_choice
Main.applescript
set value of property list item "Limit_Rate_Value" to settings_limit_rate_value_choice
Main.applescript
if settings_subtitles_choice is false and settings_autoST_choice is false and settings_stembed_choice is true then
Main.applescript
set theSTsEmbeddedTogetherLabel to localized string "Sorry, you need to turn on subtitles if you want them embedded." from table "MacYTDL"
Main.applescript
display dialog theSTsEmbeddedTogetherLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
if settings_stembed_choice is true and (settings_format_choice is not "mp4" and settings_format_choice is not "mkv" and settings_format_choice is not "webm" and settings_remux_format_choice is not "webm" and settings_remux_format_choice is not "mkv" and settings_remux_format_choice is not "mp4") then
Main.applescript
set theSTsEmbeddedFileformatLabel to localized string "Sorry, File format or Remux format must be mp4, mkv or webm for subtitles to be embedded." from table "MacYTDL"
Main.applescript
display dialog theSTsEmbeddedFileformatLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set value of property list item "SubTitles_Embedded" to settings_stembed_choice
Main.applescript
if settings_thumb_embed_choice is true and ((DL_Use_YTDLP is "yt-dlp") or (DL_Use_YTDLP is "youtube-dl" and Atomic_is_installed is true and settings_audio_only_choice is true and (settings_audio_codec_choice is "mp3" or settings_audio_codec_choice is "m4a"))) then
Main.applescript
set value of property list item "Thumbnail_Embed" to true
Main.applescript
else if settings_thumb_embed_choice is true and Atomic_is_installed is false and DL_Use_YTDLP is "youtube-dl" then
Main.applescript
set theSTsEmbedFormatLabel to localized string "Sorry, to embed thumbnails, you need to install Atomic Parsley. You can do that in Utilities." from table "MacYTDL"
Main.applescript
display dialog theSTsEmbedFormatLabel with title diag_Title buttons {theButtonOKLabel} default button 1 with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
else if settings_thumb_embed_choice is true and DL_Use_YTDLP is "youtube-dl" and (settings_audio_only_choice is false or (settings_audio_codec_choice is not "mp3" and settings_audio_codec_choice is not "m4a")) then
Main.applescript
set theSTsEmbedFormatLabel to localized string "Sorry, to embed thumbnails, you need to specify audio only and use mp3 or m4a audio format." from table "MacYTDL"
Main.applescript
if settings_thumb_embed_choice is false then
Main.applescript
set value of property list item "Thumbnail_Embed" to false
Main.applescript
end set_settings
Main.applescript
on check_ytdl(show_yt_dlp)
Main.applescript
set YTDL_site_URL to "https://github.com/yt-dlp/yt-dlp/releases"
Main.applescript
if show_yt_dlp is "yt-dlp" then
Main.applescript
set name_of_executable to "yt-dlp_macos"
Main.applescript
else if show_yt_dlp is "yt-dlp-legacy" then
Main.applescript
set name_of_executable to "yt-dlp_macos_legacy"
Main.applescript
set YTDL_releases_page to do shell script "curl " & YTDL_site_URL & " | textutil -stdin -stdout -format html -convert txt -encoding UTF-8 "
Main.applescript