text
stringlengths
0
15.7k
source
stringlengths
6
112
set theYTDLCurlErrorLabel1 to localized string "There was an error with looking for the " from table "MacYTDL"
Main.applescript
set theYTDLCurlErrorLabel2 to localized string " web page. The error was: " from table "MacYTDL"
Main.applescript
set theYTDLCurlErrorLabel3 to localized string ", and the URL that produced the error was: " from table "MacYTDL"
Main.applescript
set theYTDLCurlErrorLabel4 to localized string "Try again later and/or send a message to [email protected] with the details." from table "MacYTDL"
Main.applescript
set theYTDLCurlErrorLabel to theYTDLCurlErrorLabel1 & show_yt_dlp & theYTDLCurlErrorLabel2 & errmsg & theYTDLCurlErrorLabel3 & YTDL_site_URL & ". " & theYTDLCurlErrorLabel4
Main.applescript
display dialog theYTDLCurlErrorLabel buttons {theButtonOKLabel} default button 1 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set installedYTDL_version to do shell script ytdlp_file & " --version"
Main.applescript
if installedYTDL_version is not YTDL_version then
Main.applescript
set value of property list item "YTDL_YTDLP_version" to installedYTDL_version
Main.applescript
set theYTDLUpToDateLabela to localized string " is up to date. Your current version is " from table "MacYTDL"
Main.applescript
set theYTDLUpToDateLabel to show_yt_dlp & theYTDLUpToDateLabela
Main.applescript
set switch_flag to false
Main.applescript
if alert_text_ytdl is "Switching" then set switch_flag to true
Main.applescript
set alert_text_ytdl to theYTDLUpToDateLabel & installedYTDL_version
Main.applescript
if YTDL_releases_page is "" then
Main.applescript
set theYTDLPageErrorLabel1 to localized string "There was a problem with looking for " from table "MacYTDL"
Main.applescript
set theYTDLPageErrorLabel2 to localized string "Perhaps you are not connected to the internet or GitHub is currently not available." from table "MacYTDL"
Main.applescript
set theYTDLPageErrorLabel to theYTDLPageErrorLabel1 & show_yt_dlp & ". " & theYTDLPageErrorLabel2
Main.applescript
display dialog theYTDLPageErrorLabel buttons {theButtonOKLabel} default button 1 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set AppleScript's text item delimiters to "Latest"
Main.applescript
set YTDL_releases_text to text item 1 of YTDL_releases_page
Main.applescript
set numParas to count paragraphs in YTDL_releases_text
Main.applescript
set version_para to paragraph (numParas) of YTDL_releases_text
Main.applescript
set YTDL_version_check to text item 2 of version_para
Main.applescript
if YTDL_version_check is not equal to installedYTDL_version or homebrew_ytdlp_exists is true then
Main.applescript
if switch_flag is true then
Main.applescript
set YTDL_update_text to "To switch to " & show_yt_dlp & " it will need to be installed. Would you like to download it now ?"
Main.applescript
set YTDL_update_text to "A new version of " & show_yt_dlp & " is available. You have version " & installedYTDL_version & ". The current version is " & YTDL_version_check & return & return & "Would you like to download it now ?"
Main.applescript
set YTDL_install_answ to button returned of (display dialog YTDL_update_text buttons {theButtonNoLabel, theButtonYesLabel} default button 2 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if YTDL_install_answ is theButtonYesLabel then
Main.applescript
set installAlertActionLabel to quoted form of "_"
Main.applescript
set installAlertTitle to quoted form of (localized string "MacYTDL installation:" from table "MacYTDL")
Main.applescript
set installAlertMessage to quoted form of (localized string "started. Please wait." from table "MacYTDL")
Main.applescript
set installAlertSubtitle to quoted form of ((localized string "Download and install of " from table "MacYTDL") & show_yt_dlp)
Main.applescript
do shell script resourcesPath & "alerter -message " & installAlertMessage & " -title " & installAlertTitle & " -subtitle " & installAlertSubtitle & " -timeout 5 -sender com.apple.script.id.MacYTDL -actions " & installAlertActionLabel & " > /dev/null 2> /dev/null & "
Main.applescript
if homebrew_ytdlp_exists is true then
Main.applescript
do shell script "rm /usr/local/bin/yt-dlp" with administrator privileges
Main.applescript
do shell script "curl -L " & YTDL_site_URL & "/download/" & YTDL_version_check & "/" & name_of_executable & " -o /usr/local/bin/yt-dlp" with administrator privileges
Main.applescript
if errmsg does not contain "User canceled" then
Main.applescript
display dialog "There was an error in downloading the YT-DLP update. The error reported was " & errmsg
Main.applescript
do shell script "chmod a+x /usr/local/bin/yt-dlp" with administrator privileges
Main.applescript
set YTDL_version to YTDL_version_check
Main.applescript
set theYTDLUpDatedLabel to localized string " has been updated. Your new version is " from table "MacYTDL"
Main.applescript
set alert_text_ytdl to show_yt_dlp & theYTDLUpDatedLabel & YTDL_version
Main.applescript
set theYTDLOutOfDateLabel to localized string " is out of date. Your current version is " from table "MacYTDL"
Main.applescript
set alert_text_ytdl to show_yt_dlp & theYTDLOutOfDateLabel & YTDL_version
Main.applescript
end check_ytdl
Main.applescript
on check_ffmpeg()
Main.applescript
if user_system_arch is "Intel" then
Main.applescript
check_ffmpeg_intel()
Main.applescript
check_ffmpeg_arm()
Main.applescript
end check_ffmpeg
Main.applescript
on check_ffmpeg_intel()
Main.applescript
set ffprobe_version_long to do shell script ffprobe_file & " -version"
Main.applescript
set theFFmpegAlertUpToDateLabel to localized string "FFmpeg and FFprobe are up to date. Your current version is " from table "MacYTDL"
Main.applescript
set alert_text_ffmpeg to theFFmpegAlertUpToDateLabel & ffmpeg_version
Main.applescript
set ffmpeg_site to "https://evermeet.cx/pub/ffmpeg/"
Main.applescript
set FFmpeg_page to do shell script "curl " & ffmpeg_site & " | textutil -stdin -stdout -format html -convert txt -encoding UTF-8 "
Main.applescript
set theFFmpegCurlErrorLabel to localized string "There was an error with looking for the FFmpeg web page. The error was: " & errmsg & ", and the URL that produced the error was: " & ffmpeg_site & ". Try again later and/or send a message to [email protected] with the details." from table "MacYTDL"
Main.applescript
display dialog theFFmpegCurlErrorLabel buttons {theButtonOKLabel} default button 1 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
if FFmpeg_page is "" then
Main.applescript
set theFFmpegDownloadProblemLabel to localized string "There was a problem with accessing FFmpeg. Perhaps you are not connected to the internet or the server is currently not available. Try again later." from table "MacYTDL"
Main.applescript
display dialog theFFmpegDownloadProblemLabel buttons {theButtonOKLabel} default button 1 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600
Main.applescript
set ffmpeg_version_start to (offset of "version" in FFmpeg_page) + 8
Main.applescript
set ffmpeg_version_end to (offset of "-tessus" in FFmpeg_page) - 1
Main.applescript
set ffmpeg_version_check to text ffmpeg_version_start thru ffmpeg_version_end of FFmpeg_page
Main.applescript
if ffmpeg_version_check is not equal to ffmpeg_version or ffmpeg_version_check is not equal to ffprobe_version then
Main.applescript
set theFFmpegOutDatedTextLabel1 to localized string "FFmpeg is out of date. You have version " from table "MacYTDL"
Main.applescript
set theFFmpegOutDatedTextLabel2 to localized string "The current version is " from table "MacYTDL"
Main.applescript
set theFFmpegOutDatedTextLabel3 to localized string "Would you like to update it now ? If yes, this will also update FFprobe. Note: You may need to provide administrator credentials." from table "MacYTDL"
Main.applescript
set ffmpeg_install_text to theFFmpegOutDatedTextLabel1 & ffmpeg_version & ". " & theFFmpegOutDatedTextLabel2 & ffmpeg_version_check & return & return & theFFmpegOutDatedTextLabel3
Main.applescript
set ffmpeg_install_answ to button returned of (display dialog ffmpeg_install_text buttons {theButtonNoLabel, theButtonYesLabel} default button 2 with title diag_Title with icon file MacYTDL_custom_icon_file giving up after 600)
Main.applescript
if ffmpeg_install_answ is theButtonYesLabel then
Main.applescript
run_Utilities_handlers's install_ffmpeg_ffprobe_intel(theButtonOKLabel, diag_Title, path_to_MacYTDL, usr_bin_folder, resourcesPath, MacYTDL_custom_icon_file, user_on_old_os)
Main.applescript
set theFFmpegProbeAlertUpDatedLabel to localized string "FFmpeg and FFprobe have been updated. Your new version is " from table "MacYTDL"
Main.applescript
set alert_text_ffmpeg to theFFmpegProbeAlertUpDatedLabel & ffmpeg_version
Main.applescript
set theFFmpegProbeAlertOutOfDateLabel to localized string "FFmpeg is out of date. Your current version is " from table "MacYTDL"
Main.applescript
set alert_text_ffmpeg to "" & ffmpeg_version
Main.applescript
end check_ffmpeg_intel
Main.applescript
on check_ffmpeg_arm()
Main.applescript
set ffmpeg_site to "https://ffmpeg.martin-riedl.de"
Main.applescript
set AppleScript's text item delimiters to {"macOS (Apple Silicon/arm64)"}
Main.applescript
set release_build_text_FFmpeg to paragraph 2 of text item 3 of FFmpeg_page
Main.applescript
set release_build_version_FFmpeg to text item 2 of release_build_text_FFmpeg
Main.applescript
if release_build_version_FFmpeg is not equal to ffmpeg_version or release_build_version_FFmpeg is not equal to ffprobe_version then
Main.applescript
set ffmpeg_install_text to theFFmpegOutDatedTextLabel1 & ffmpeg_version & ". " & theFFmpegOutDatedTextLabel2 & release_build_version_FFmpeg & return & return & theFFmpegOutDatedTextLabel3
Main.applescript
run_Utilities_handlers's install_ffmpeg_ffprobe_arm(theButtonOKLabel, diag_Title, path_to_MacYTDL, usr_bin_folder, resourcesPath, MacYTDL_custom_icon_file, user_on_old_os)
Main.applescript
end check_ffmpeg_arm
Main.applescript
on utilities()
Main.applescript
set path_to_home_folder to (path to home folder)
Main.applescript
set services_Folder_nonPosix to (path_to_home_folder & "Library:Services:") as text
Main.applescript
set macYTDL_service_file_nonPosix to services_Folder_nonPosix & "Send-URL-To-MacYTDL.workflow"
Main.applescript
set services_Folder to (POSIX path of (path to home folder) & "/Library/Services/")
Main.applescript
if not (exists the file macYTDL_service_file) then
Main.applescript
set theVersionInstalledLabel to localized string "Installed:" from table "MacYTDL"
Main.applescript
set theYTDLVersionInstalledlabel to theVersionInstalledLabel & " v" & YTDL_version
Main.applescript
set FFMpeg_version_installed to theVersionInstalledLabel & " v" & ffmpeg_version
Main.applescript
set theCurrentInstalledLabel to localized string "Current:" from table "MacYTDL"
Main.applescript
set current_settings_installed to "(" & theCurrentInstalledLabel & " " & DL_Settings_In_Use & ")"
Main.applescript
set theInstructionsTextLabel to localized string "Choose the utility(ies) you would like to run then click 'Start'" from table "MacYTDL"
Main.applescript