text
stringlengths
0
15.7k
source
stringlengths
6
112
set adviser_pid to do shell script "osascript -s s " & myAdviserScriptAsString & " " & adviser_params & " " & " > /dev/null 2> /dev/null & echo $!"
Monitor.applescript
set theProgressLabel to localized string "Progress:" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theProgressingLabel to localized string "Progressing" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theDownloadInLabel to localized string "downloaded in" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theDownloadOfLabel to localized string "downloaded of" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theMinutesLabel to localized string "minutes." in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theInLabel to localized string "in" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theOKLabel to localized string "OK" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theMonitorIntroTextLabel1 to localized string "Your download of" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theMonitorIntroTextLabel2 to localized string "has started." in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theButtonsPauseLabel to localized string "Pause" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theButtonsResumeLabel to localized string "Resume" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theButtonsLogLabel to localized string "Log" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theButtonsStopLabel to localized string "Stop" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theButtonsCloseLabel to localized string "Close" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theRunningLabel to localized string "Running" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set thePercentSymbolLabel to localized string "%" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theMBSymbolLabel to localized string "MB" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set theGBSymbolLabel to localized string "GB" in bundle file pathToBundleShort from table "MacYTDL"
Monitor.applescript
set seconds_running to 0
Monitor.applescript
set time_running to 0
Monitor.applescript
set progress_percentage to ""
Monitor.applescript
set downloadFileSize to ""
Monitor.applescript
set monitor_diag_Title to "MacYTDL"
Monitor.applescript
set diag_intro_text_1 to theMonitorIntroTextLabel1 & " \"" & download_filename_new_monitor_plain & "\" " & theMonitorIntroTextLabel2
Monitor.applescript
set accViewWidth to 100
Monitor.applescript
set the_date_start to current date
Monitor.applescript
set the_time_start to time of the_date_start
Monitor.applescript
set {theButtons, minWidth} to create buttons {theButtonsLogLabel, theButtonsStopLabel} button keys {"l", "S"}
Monitor.applescript
set minWidth to 250
Monitor.applescript
set {theButtons, minWidth} to create buttons {theButtonsLogLabel, theButtonsStopLabel, theButtonsPauseLabel, theButtonsCloseLabel} button keys {"l", "S", "P", ""} cancel button 4
Monitor.applescript
set size_of_log to get eof YTDL_log_file_monitor_posix
Monitor.applescript
if size_of_log is less than 5 then
Monitor.applescript
set YTDL_log to "No log"
Monitor.applescript
set YTDL_log to read file YTDL_log_file_monitor_posix as text
Monitor.applescript
display dialog "Error in Monitor reading log file: " & YTDL_log_file_monitor_posix & return & "Error message: " & errMsg
Monitor.applescript
set the_time to time of (current date)
Monitor.applescript
set seconds_running to the_time - the_time_start
Monitor.applescript
set time_running to seconds_running / minutes
Monitor.applescript
set round_factor to 0.1
Monitor.applescript
set time_running to (round time_running / round_factor) * round_factor
Monitor.applescript
set diag_intro_text_2 to theProgressingLabel
Monitor.applescript
if YTDL_log is not "No log" then
Monitor.applescript
set YTDL_log_lastParapraph to paragraph -2 of YTDL_log
Monitor.applescript
if YTDL_log_lastParapraph contains "[download]" and YTDL_log_lastParapraph contains "%" and YTDL_log_lastParapraph contains "at" then
Monitor.applescript
set progress_percentage to last word in (text 1 thru (offset of "%" in YTDL_log_lastParapraph) of YTDL_log_lastParapraph)
Monitor.applescript
set o to (offset of "." in progress_percentage)
Monitor.applescript
if ((o > 0) and (0.0 as text is "0,0")) then set progress_percentage to (text 1 thru (o - 1) of progress_percentage & "," & text (o + 1) thru -1 of progress_percentage)
Monitor.applescript
set GiBPositionAfterSize to offset of "GiB" in YTDL_log_lastParapraph -- Crude but does work
Monitor.applescript
if GiBPositionAfterSize is not 0 then
Monitor.applescript
set downloadFileSizeGiB to last word in (text 22 thru (GiBPositionAfterSize - 1) of YTDL_log_lastParapraph)
Monitor.applescript
set approxIndicator to character 1 of downloadFileSizeGiB
Monitor.applescript
if approxIndicator is "~" then
Monitor.applescript
set downloadFileSizeGiB to text 2 thru end of downloadFileSizeGiB
Monitor.applescript
set o to (offset of "." in downloadFileSizeGiB)
Monitor.applescript
if ((o > 0) and (0.0 as text is "0,0")) then set downloadFileSizeGiB to (text 1 thru (o - 1) of downloadFileSizeGiB & "," & text (o + 1) thru -1 of downloadFileSizeGiB)
Monitor.applescript
set downloadFileSizeGiB to downloadFileSizeGiB as number
Monitor.applescript
set downloadFileSizeGB to downloadFileSizeGiB * 1.04858 as number
Monitor.applescript
set round_factor to 0.01
Monitor.applescript
set downloadFileSizeGB to (round downloadFileSizeGB / round_factor) * round_factor
Monitor.applescript
set approxIndicator to ""
Monitor.applescript
set diag_intro_text_2 to theProgressLabel & " " & progress_percentage & thePercentSymbolLabel & " " & theDownloadOfLabel & " " & approxIndicator & downloadFileSizeGB & theGBSymbolLabel & " " & theInLabel & " " & time_running & " " & theMinutesLabel
Monitor.applescript
set MiBPositionAfterSize to offset of "MiB" in YTDL_log_lastParapraph
Monitor.applescript
set downloadFileSizeMiB to last word in (text 22 thru (MiBPositionAfterSize - 1) of YTDL_log_lastParapraph)
Monitor.applescript
set approxIndicator to character 1 of downloadFileSizeMiB
Monitor.applescript
set downloadFileSizeMiB to text 2 thru end of downloadFileSizeMiB
Monitor.applescript
set o to (offset of "." in downloadFileSizeMiB)
Monitor.applescript
if ((o > 0) and (0.0 as text is "0,0")) then set downloadFileSizeMiB to (text 1 thru (o - 1) of downloadFileSizeMiB & "," & text (o + 1) thru -1 of downloadFileSizeMiB)
Monitor.applescript
set downloadFileSizeMiB to downloadFileSizeMiB as number
Monitor.applescript
set downloadFileSizeMB to downloadFileSizeMiB * 1.04858 as number
Monitor.applescript
set downloadFileSizeMB to (round downloadFileSizeMB / round_factor) * round_factor
Monitor.applescript
set diag_intro_text_2 to theProgressLabel & " " & progress_percentage & thePercentSymbolLabel & " " & theDownloadOfLabel & " " & approxIndicator & downloadFileSizeMB & theMBSymbolLabel & " " & theInLabel & " " & time_running & " " & theMinutesLabel
Monitor.applescript
else if YTDL_log_lastParapraph contains "[Merger] Merging formats into" then
Monitor.applescript
set diag_intro_text_2 to "FFmpeg merging formats ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[VideoConvertor] Converting video from" then
Monitor.applescript
set diag_intro_text_2 to "Converting download ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[ThumbnailsConvertor] Converting thumbnail" then
Monitor.applescript
set diag_intro_text_2 to "Converting thumbnail ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[EmbedThumbnail] mutagen:" then
Monitor.applescript
set diag_intro_text_2 to "Embedding thumbnail ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[ExtractAudio] Destination:" then
Monitor.applescript
set diag_intro_text_2 to "Extracting audio ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[ffmpeg] Fixing malformed" then
Monitor.applescript
set diag_intro_text_2 to "FFmpeg fixing bitstream ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[ffmpeg] Merging formats into" then
Monitor.applescript
else if YTDL_log_lastParapraph contains "[FixupM3u8] Fixing" then
Monitor.applescript
set diag_intro_text_2 to "Fixing container ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[info] Downloading video thumbnail" or YTDL_log_lastParapraph contains "[info] Writing video thumbnail" then
Monitor.applescript
set diag_intro_text_2 to "Writing thumbnail ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[debug] Invoking downloader on" then
Monitor.applescript
set diag_intro_text_2 to "Starting download ...."
Monitor.applescript
else if YTDL_log_lastParapraph contains "[debug] ffmpeg command line" then
Monitor.applescript
set diag_intro_text_2 to (theRunningLabel & " FFmpeg ....")
Monitor.applescript
else if YTDL_log contains "size= " then
Monitor.applescript
set numParasInlog to count of paragraphs in YTDL_log
Monitor.applescript
repeat with i from 1 to numParasInlog
Monitor.applescript
set lastParaInlog to paragraph (-i) of YTDL_log
Monitor.applescript
if lastParaInlog contains "size=" then
Monitor.applescript
set offsetOfSize to offset of "size" in lastParaInlog
Monitor.applescript
set sizeOfDownloadProgress to text (offsetOfSize + 5) thru (offsetOfSize + 12) of lastParaInlog
Monitor.applescript