text
stringlengths
0
15.7k
source
stringlengths
6
112
set sizeOfDownloadProgress to (sizeOfDownloadProgress * 1.024) as integer
Monitor.applescript
set sizeOfdownloadProgressDelimited to convertNumberToCommaDelimitedString(sizeOfDownloadProgress)
Monitor.applescript
set diag_intro_text_2 to theProgressLabel & " " & sizeOfdownloadProgressDelimited & "KB" & " " & theDownloadInLabel & " " & time_running & " " & theMinutesLabel
Monitor.applescript
set {intro_label2, theTop} to create label diag_intro_text_2 left inset 0 bottom 5 max width minWidth - 20 aligns center aligned control size small size with multiline
Monitor.applescript
set {intro_label1, theTop} to create label diag_intro_text_1 left inset 50 bottom theTop + 10 max width minWidth - 51 control size small size
Monitor.applescript
set {MacYTDL_icon, theTop} to create image view MacYTDL_custom_icon_file_posix_monitor left inset 0 bottom theTop - 35 view width 45 view height 45 scale image scale proportionally
Monitor.applescript
if monitor_state_flag is "Downloading" then
Monitor.applescript
set {monitor_button_returned, buttonNumber, controlResults, finalPosition} to display enhanced window monitor_diag_Title buttons theButtons giving up after 5 acc view width accViewWidth acc view height theTop acc view controls {intro_label2, intro_label1, MacYTDL_icon} initial position {X_position_monitor, Y_position_monitor}
Monitor.applescript
else if monitor_state_flag is "Paused" then
Monitor.applescript
set {theButtons} to create buttons {theButtonsLogLabel, theButtonsResumeLabel, theButtonsCloseLabel} button keys {"l", "R", ""} cancel button 3
Monitor.applescript
set {monitor_button_returned, buttonNumber, controlResults, finalPosition} to display enhanced window monitor_diag_Title buttons theButtons acc view width accViewWidth acc view height theTop acc view controls {intro_label2, intro_label1, MacYTDL_icon} initial position {X_position_monitor, Y_position_monitor}
Monitor.applescript
if monitor_button_returned is theButtonsPauseLabel then
Monitor.applescript
set monitor_state_flag to "Paused"
Monitor.applescript
if is_Livestream_Flag_monitor is not "True" then
Monitor.applescript
do shell script "kill -9 " & adviser_pid
Monitor.applescript
set ffmpeg_child_pid to do shell script "pgrep -P " & youtubedl_pid
Monitor.applescript
if monitor_DL_Use_YTDLP is "yt-dlp" then
Monitor.applescript
set ffmpeg_grandchild_pid to do shell script "pgrep -P " & ffmpeg_child_pid
Monitor.applescript
do shell script "kill " & ffmpeg_grandchild_pid
Monitor.applescript
do shell script "kill " & ffmpeg_child_pid
Monitor.applescript
do shell script "kill " & youtubedl_pid
Monitor.applescript
else if monitor_button_returned is theButtonsResumeLabel then
Monitor.applescript
set monitor_state_flag to "Resumed"
Monitor.applescript
set ytdl_settings_monitor to (" " & ytdl_settings_monitor)
Monitor.applescript
set download_filename_new_monitor_noquotes_trimmed to text 2 thru ((download_filename_new_monitor's length) - (offset of "." in (the reverse of every character of download_filename_new_monitor) as text)) of download_filename_new_monitor
Monitor.applescript
if last character of diag_Title_quoted_monitor is "'" then
Monitor.applescript
set diag_Title_quoted_monitor to text 2 through ((length of diag_Title_quoted_monitor) - 1) of diag_Title_quoted_monitor
Monitor.applescript
if last character of download_filename_new_monitor is "'" then
Monitor.applescript
set download_filename_new_monitor to text 2 through ((length of download_filename_new_monitor) - 1) of download_filename_new_monitor
Monitor.applescript
set YTDL_log_file_resume to MacYTDL_preferences_path_monitor & "youtube-dl_log-" & download_filename_new_monitor_noquotes_trimmed & "-" & download_date_time & ".txt"
Monitor.applescript
set my_params to quoted form of downloadsFolder_Path_monitor & " " & quoted form of MacYTDL_preferences_path_monitor & " " & quoted form of YTDL_TimeStamps_monitor & " " & quoted form of ytdl_settings_monitor & " " & quoted form of URL_user_entered_monitor & " " & quoted form of YTDL_log_file_resume & " " & quoted form of download_filename_monitor & " " & quoted form of download_filename_new_monitor & " " & quoted form of MacYTDL_custom_icon_file_posix_monitor & " " & monitor_dialog_position & " " & quoted form of YTDL_simulate_log_monitor & " " & quoted form of diag_Title_quoted_monitor & " " & is_Livestream_Flag_monitor & " " & screen_width & " " & screen_height & " " & monitor_DL_Use_YTDLP & " " & quoted form of path_to_MacYTDL
Monitor.applescript
else if monitor_button_returned is theButtonsStopLabel then
Monitor.applescript
set monitor_state_flag to "Stopped"
Monitor.applescript
if download_finished is not "Yes" then
Monitor.applescript
if download_filename_new_monitor_plain is "the multiple videos" or download_filename_new_monitor_plain is "the-playlist" then
Monitor.applescript
repeat with each_filename in (get paragraphs of YTDL_simulate_log_monitor)
Monitor.applescript
set each_filename to text 1 thru -5 of each_filename
Monitor.applescript
if each_filename does not contain "WARNING" then
Monitor.applescript
set part_files to do shell script "find " & downloadsFolder_Path_monitor_quoted & " -maxdepth 1 -type f -iname *" & quoted form of each_filename & "*.part* -or -iname *" & quoted form of each_filename & "*.ytdl*"
Monitor.applescript
repeat with each_part_files in (get paragraphs of part_files)
Monitor.applescript
do shell script "mv " & quoted form of each_part_files & " ~/.trash/"
Monitor.applescript
else if YTDL_simulate_log_monitor contains "ERROR: Unsupported URL: https://iview" or YTDL_simulate_log_monitor contains "ERROR: Unsupported URL: https://www.sbs" then
Monitor.applescript
repeat with each_filename in (get paragraphs of download_filename_monitor)
Monitor.applescript
set each_filename to text 1 thru -1 of each_filename
Monitor.applescript
if each_filename does not contain "WARNING:" then
Monitor.applescript
else if download_filename_new_monitor is not "the saved batch" and is_Livestream_Flag_monitor is "False" then
Monitor.applescript
set download_filename_monitor_trimmed to text 1 thru -5 of download_filename_monitor
Monitor.applescript
set part_files to do shell script "find " & downloadsFolder_Path_monitor_quoted & " -maxdepth 1 -type f -iname *" & quoted form of download_filename_monitor_trimmed & "*.part* -or -iname *" & quoted form of download_filename_monitor_trimmed & "*.ytdl*"
Monitor.applescript
else if monitor_button_returned is theButtonsLogLabel then
Monitor.applescript
if monitor_state_flag is not "Paused" then
Monitor.applescript
on convertNumberToCommaDelimitedString(theNumber)
Monitor.applescript
set theNumber to theNumber as string
Monitor.applescript
set theNumberLength to length of theNumber
Monitor.applescript
set theNumber to (reverse of every character of theNumber) as string
Monitor.applescript
set commaDelimitedNumber to ""
Monitor.applescript
repeat with a from 1 to theNumberLength
Monitor.applescript
if a is theNumberLength or (a mod 3) is not 0 then
Monitor.applescript
set commaDelimitedNumber to (character a of theNumber & commaDelimitedNumber) as string
Monitor.applescript
set commaDelimitedNumber to ("," & character a of theNumber & commaDelimitedNumber) as string
Monitor.applescript
return commaDelimitedNumber
Monitor.applescript
end convertNumberToCommaDelimitedString
Monitor.applescript
set this_item to item i of added_items as alias
create_reminder_from_file.scpt
set pathstr to POSIX path of this_item
create_reminder_from_file.scpt
set exT_name to name extension of this_item
create_reminder_from_file.scpt
set cmd to "perl -e 'while(<STDIN>){chomp;next if(/^#/);s/^(\\S+ \\d+, \\d+) +(at *)?\\d+:?\\d* *(a|p)?m? *$/$1/ig;print(qq($_\\n))}' < '" & pathstr & "'"
create_reminder_from_file.scpt
set eventDescList to my (paragraphs of (do shell script cmd))
create_reminder_from_file.scpt
set numEvents to (((number of items in eventDescList) / 6) as integer)
create_reminder_from_file.scpt
repeat with j from 1 to numEvents
create_reminder_from_file.scpt
set reminderList to item ((j - 1) * 6 + 1) of eventDescList
create_reminder_from_file.scpt
set dueDate to item ((j - 1) * 6 + 2) of eventDescList & " " & item ((j - 1) * 6 + 3) of eventDescList
create_reminder_from_file.scpt
set titleName to item ((j - 1) * 6 + 4) of eventDescList
create_reminder_from_file.scpt
set searchWord to item ((j - 1) * 6 + 5) of eventDescList
create_reminder_from_file.scpt
set origTitle to item ((j - 1) * 6 + 6) of eventDescList
create_reminder_from_file.scpt
if searchWord is in origTitle then
create_reminder_from_file.scpt
set mylist to list reminderList
create_reminder_from_file.scpt
set myDate to (my parseDate(dueDate))
create_reminder_from_file.scpt
make new reminder at end with properties {name:titleName, due date:myDate, remind me date:myDate}
create_reminder_from_file.scpt
on parseDate(theDateStr)
create_reminder_from_file.scpt
set time of theDate to 0
create_reminder_from_file.scpt
set theDateStrOrig to theDateStr
create_reminder_from_file.scpt
set theDateStr to getArrayValue(theSplit(theDateStr, "am"), 1) as string
create_reminder_from_file.scpt
set theDateStr to getArrayValue(theSplit(theDateStr, "AM"), 1) as string
create_reminder_from_file.scpt
if theDateStrOrig is not in theDateStr then
create_reminder_from_file.scpt
set usesAM to true
create_reminder_from_file.scpt
set usesAM to false
create_reminder_from_file.scpt
set theDateStr to getArrayValue(theSplit(theDateStr, "pm"), 1) as string
create_reminder_from_file.scpt
set theDateStr to getArrayValue(theSplit(theDateStr, "PM"), 1) as string
create_reminder_from_file.scpt
set usesPM to true
create_reminder_from_file.scpt
set usesPM to false
create_reminder_from_file.scpt
set theDateTimeArray to theSplit(theDateStr, " ")
create_reminder_from_file.scpt
set theTimeStr to getArrayValue(theDateTimeArray, -1) as string
create_reminder_from_file.scpt
set theTimeArray to theSplit(theTimeStr, ":")
create_reminder_from_file.scpt
set theHours to item 1 of theTimeArray
create_reminder_from_file.scpt
if theTimeArray's length > 1 then
create_reminder_from_file.scpt
set theMinutes to item 2 of theTimeArray
create_reminder_from_file.scpt
set theMinutes to 0
create_reminder_from_file.scpt
if (theHours as integer = 12) and usesAM then
create_reminder_from_file.scpt
set hoursAdjust to -12
create_reminder_from_file.scpt
else if (theHours as integer ≠ 12) and usesPM then
create_reminder_from_file.scpt
set hoursAdjust to 12
create_reminder_from_file.scpt