Friday, November 24, 2017
  • Index
  •  » Code Exchange
  •  » Final Completion of Web-Video Downloader/Player/MP3-Maker...

#1 2015-05-03 01:39:23 am

artphotodude
Member
Registered: 2012-10-15
Posts: 45

Final Completion of Web-Video Downloader/Player/MP3-Maker...

About a year ago, completed an Applescript G.U.I. for the popular command-line web-downloader youtube-dl.  Mostly to be able to keep using my PPC Macs for web-video!  In addition to downloading, it also streamed through QuickTime for direct playback. The original review of it can be seen here:
http://ppcluddite.blogspot.com/2014/02/ … be-dl.html

Well just completed final version - has been updated/improved in a number of ways. 

• Is able to also make MP3s of web-videos with a button-click.  Can download and convert multiple items at the same time.  Deletes source file after creation.

• Auto-updates youtube-dl framework (checks the first time is used each day - keeps track of date with dummy folder).

• Can play multi-segmented videos.  The user just closes the current QuickTime window when done and next segment opens right up. 

• Has hotkey shortcut support for all versions and supported systems.

• Has auto-installer that installs Python, the Perian QuickTime Extension and ffmpeg for mp3 creation (all bundled in app with permission)

• Has heuristic Sed-handler that fixes common variations of youtube.com links to standard format the script can understand.

• Runs in most all Macs from PPC/10.4 to Intel/10.8.  Uses endian-checker to install and call custom binaries and Python version for each system.

Those wishing to try it can find it here: http://www.mediafire.com/download/46tbq … versal.zip

Applescript:



------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- A G.U.I. for the Python Script youtube-dl ([url]http://rg3.github.io/youtube-dl/[/url]). Written by Adam Albrec (game_creator@hotmail.com) --
------------------------------------------------------------------------------------------------------------------------------------------------------------------

-- Version 5.0 (Last Updated 05/01/2015) --



----
-- Installer/Handlers Section.
----

-- Sets Python version and checks system architecture to customize installation and execution.
set endTest to (do shell script "sysctl -n hw.byteorder")
if endTest is "4321" then
   set archType to "PPC"
else if endTest is "1234" then
   set archType to "x86"
end if
if archType is "PPC" then
   set pythonVrsn to "2.7"
else
   set pythonVrsn to "3.4"
end if

-- Prompts for agreement to component licenses and installation.
set appInstalled to (do shell script "if test -e ~/Library/Preferences/ppcmcInstalled/; then echo 1; else echo 0; fi") -- Looks for dummy-file "ppcmcInstalled" in User Prefs.
if appInstalled is "0" then
   display dialog " Acknowlegents and Licenses:

I Adam Albrec, give the Applescript-code herein to all to use freely for whatever they wish, without condition. All may reuse, any or all-parts of it, as they see fit. My heartfelt gratitude to all the GREAT Apple/Bash-scripters, over the years, who's shoulders I've stood on to make this work!

- Special Thanks To -

• Jason Myers for his help with debugging and testing.

• Daniel Bolton and the team at youtube-dl ( [url]http://rg3.github.io/youtube-dl/[/url] ) for their incredible app - NONE of this would be possible without their genius!

• Chris Forsythe and Graham Booker of perian.org for unleashing the power of QuickTime AND for allowing me to bundle Perian in this Installer!!

• ProgrammingKid, creator of the most-awesome 'FLV Crunch' video-converter, for allowing the use of his compiled-binaries of ffmpeg (allowing MP3 conversion),

• and Last, but Not Least - the folks at Python.org for their amazing work and generous open-license to use Python.

By installing this software, you agree before all applicable Laws, God, and the Millions of Transistors of this computer to abide by the licenses and terms set fourth by the contributing parties above.

"
buttons {"Decline", "Accept"} default button "Accept"
   set agreeChoice to button returned of the result
   if agreeChoice is "Accept" then
       set licenseDocs to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Licenses/"
       beep
       do shell script "open " & licenseDocs -- Opens folder of license documents.
       do shell script "sudo mkdir -p /usr/local/bin/; sudo mkdir -p /usr/local/lib//" with administrator privileges -- Creates /usr/local/ folders if not present.
       set usrLocalBin to "/usr/local/bin/"
       set usrLocalLib to "/usr/local/lib/"
       set servicesFolder to "/Library/Services/"
       set youtubedlBin to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/usrLocal/youtube-dl"
       do shell script "sudo cp -n " & youtubedlBin & " " & usrLocalBin & "; sudo chmod 777 /usr/local/bin/youtube-dl" with administrator privileges -- Installs youtube-dl and sets permissions.
       set ffmpegBin to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/usrLocal/" & archType & "/ffmpeg-0.5"
       try
           do shell script "sudo cp -n " & ffmpegBin & " " & usrLocalBin with administrator privileges -- Installs ffmpeg (for MP3 conversion).
       end try
       set libfaacDylib to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/usrLocal/" & archType & "/libfaac.0.dylib"
       try
           do shell script "sudo cp -n " & libfaacDylib & " " & usrLocalLib with administrator privileges -- Installs libfaac.0.dylib (for MP3 conversion).
       end try
       set libfaadDylib to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/usrLocal/" & archType & "/libfaad.0.dylib"
       try
           do shell script "sudo cp -n " & libfaadDylib & " " & usrLocalLib with administrator privileges -- Installs libfaad.0.dylib (for MP3 conversion).
       end try
       set libmp3lameDylib to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/usrLocal/" & archType & "/libmp3lame.0.dylib"
       try
           do shell script "sudo cp -n " & libmp3lameDylib & " " & usrLocalLib with administrator privileges -- Installs libmp3lame.0.dylib (for MP3 conversion).
       end try
       set perianInstalled to (do shell script "if test -e /Library/PreferencePanes/Perian.prefPane/; then echo 1; else echo 0; fi") -- Looks in system and user 'PreferencePanes' folders for Perian. Triggers installation if not found.
       if perianInstalled is not "1" then
           set perianInstalled to (do shell script "if test -e ~/Library/PreferencePanes/Perian.prefPane/; then echo 1; else echo 0; fi")
           if perianInstalled is not "1" then
               set perianPrefPane to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/Perian.prefPane/"
               do shell script "sleep 5; open " & perianPrefPane
           end if
       end if
       set pythonInstalled to (do shell script "if test -e /usr/local/bin/python" & pythonVrsn & "/; then echo 1; else echo 0; fi") -- Looks for Python 2.7 (PPC) or 3.4 (x86), and triggers installation if not found.
       if pythonInstalled is not "1" then
           if archType is "PPC" then
               set pythonInstaller to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/Python/Python.mpkg"
           else
               set pythonInstaller to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/Python/python-3.4.2-macosx10.6.pkg"
           end if
           do shell script "sleep 8; open " & pythonInstaller
       end if
       if archType is "x86" then
           do shell script "sudo mkdir -p /Library/Services/" with administrator privileges
           set ppcmcQuickLaunch to quoted form of (POSIX path of (path to me)) & "Contents/Resources/Install\\ Files/QuickLaunch/PPCMC\\ QuickLaunch.workflow"
           try
               do shell script "sudo cp -R " & ppcmcQuickLaunch & " " & servicesFolder & ";sleep 1; sudo /System/Library/CoreServices/pbs" with administrator privileges -- Installs PPCMC QuickLaunch Service (for x86 hotkey-support).
           end try
       end if
       do shell script "mkdir -p ~/Library/Preferences/ppcmcInstalled/" -- Creates dummy-file "ppcmcInstalled" in User Prefs to disable installer in future runs.
       repeat -- Loops until after Python is installed and then looks for available updates for youtube-dl.
           delay 1
           tell application "System Events" to set istllrRunning to count of (every process whose name is "Installer") -- Updates youtube-dl framework to current version after install (waits for Python installation to complete if needed).
           if istllrRunning is 0 then
               try
                   do shell script "/usr/local/bin/python" & pythonVrsn & " /usr/local/bin/youtube-dl -U"
               end try
               exit repeat
           end if
       end repeat
       try
           if archType is "PPC" then -- For PPC systems, promps user for download/install of Spark for hotkey-support if not found. If found, prompts to check Read Me for Spark usage. For Intel systems, prompts to check Read Me for system hotkey support.
               set sparkInstalled to (do shell script "if test -e ~/Library/Application\\ Support/Spark/; then echo 1; else echo 0; fi")
               if sparkInstalled is "0" then
                   beep
                   display dialog "The installer has detected that you are running a PPC version of OSX. Would you like the installer to download and begin installation of Spark?
       
Spark enables hotkey-support for PPC Media Center (see Read Me for info) and many other Apps!"
with icon alias ((path to me) & "Contents:Resources:applet.icns" as string) buttons {"No", "Yes"} default button "Yes"
                   set sparkChoice to button returned of the result
                   if sparkChoice is "Yes" then
                       do shell script "curl -o ~/Desktop/Spark.dmg '[url]http://www.shadowlab.org/softwares/Spark/Spark.dmg[/url]'; open ~/Desktop/Spark.dmg"
                   end if
               else
                   beep
                   display dialog "The installer has detected that you have Spark Installed!
               
Spark can offer hotkey-support for PPC Media Center (see Read Me for info)."
with icon alias ((path to me) & "Contents:Resources:applet.icns" as string) buttons {"OK"} default button "OK"
               end if
           else
               beep
               display dialog "The installer has detected that you are running an Intel Mac System.
               
OSX can offer hotkey-support for PPC Media Center (see Read Me for info)."
with icon alias ((path to me) & "Contents:Resources:applet.icns" as string) buttons {"OK"} default button "OK"
           end if
       end try
       error number -128
   else
       error number -128
   end if
end if

-- If the URL is a youtube site, handler helps to remove extraneous characters that might interfere with the script.
on trimLine(this_text, trim_chars, trim_indicator)
   set x to the length of the trim_chars
   if the trim_indicator is in {0, 2} then
       repeat while this_text begins with the trim_chars
           try
               set this_text to characters (x + 1) thru -1 of this_text as string
           on error
               return ""
           end try
       end repeat
   end if
end trimLine

-- Website video-quality request codes for 'Save' and 'Play' options in PPC Macs.
set videoQualityOptions to {"-f 'best[height<=?360]/best'", "-f 'best[height<=?540]/best'", "-f 'best[height<=?1080]/best'"} as list



----
-- Auto-updater for youtube-dl framework.
----

set dateCurrent to ((do shell script "date '+%m%d%Y'") as text)
set updateCurrentCheck to (do shell script "if test -e ~/Library/Preferences/ppcmcUpdated" & dateCurrent & "/; then echo 1; else echo 0; fi")
if updateCurrentCheck is not "1" then
   try
       do shell script "rm -R ~/Library/Preferences/ppcmcUpdated*"
   end try
   do shell script "/usr/local/bin/python" & pythonVrsn & " /usr/local/bin/youtube-dl -U > /dev/null 2>&1 &"
   do shell script "mkdir ~/Library/Preferences/ppcmcUpdated" & dateCurrent & "/"
end if



-- Prevents time-out while waiting for user-response.
with timeout of 86400 seconds
   
   -- Enables the script to go back to the start when choosing the "Save" or "Play" options without entering a URL.
   repeat
       
       
       
       ----
       -- Requests desired URL to Save, Play or Convert to MP3.
       ----
       
       display dialog " Enter URL of Desired Internet Video:" with icon alias ((path to me) & "Contents:Resources:applet.icns" as string) default answer "" buttons {"Save", "Play", "MP3"} default button "Play"
       set {pageURL, actionChoice} to {text returned, button returned} of the result
       
       -- Removes extraneous characters/formatting-variations in Youtube links.
       set pageURL_Im to pageURL
       set AppleScript's text item delimiters to "www."
       set wwwRmv to text items of pageURL_Im
       set AppleScript's text item delimiters to ""
       set pageURL_Im to wwwRmv as string
       set AppleScript's text item delimiters to {""}
       pageURL_Im
       if pageURL_Im contains "[url]http://youtube.com/watch?feature=player_embedded[/url]" then
           set pageURL_Done to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]http://youtube.com/watch?feature=player_embedded&v=[/url]", 0)
       else if pageURL_Im contains "[url]https://youtube.com/watch?feature=player_embedded[/url]" then
           set pageURL_Done to "[url]https://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]https://youtube.com/watch?feature=player_embedded&v=[/url]", 0)
       else
           set pageURL_Im to do shell script "echo " & pageURL_Im & " | sed 's/?list.*//g'"
           set pageURL_Im to do shell script "echo " & pageURL_Im & " | sed 's/&.*//g'"
           if pageURL_Im contains "[url]http://youtu.be/[/url]" then
               set pageURL_Done to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]http://youtu.be/[/url]", 0)
           else if pageURL_Im contains "[url]https://youtu.be/[/url]" then
               set pageURL_Done to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]https://youtu.be/[/url]", 0)
           else if pageURL_Im contains "youtu.be/" then
               set pageURL_Done to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "youtu.be/", 0)
           else
               set pageURL_Done to pageURL_Im
           end if
       end if
       
       
       
       ----
       -- Converts desired video to MP3 Audio.
       ----
       
       -- Exits with error, if a multi-segmented video url is entered for MP3 conversion.
       if actionChoice is "MP3" then
           if pageURL_Done is not "" then
               set multiSegmentTest to paragraphs of (do shell script "/usr/local/bin/python" & pythonVrsn & " /usr/local/bin/youtube-dl --get-url " & pageURL_Done) as list
               set multiSegmentTestCount to the number of items of multiSegmentTest
               if multiSegmentTestCount > 1 then
                   beep
                   display dialog "Very Sorry! Cannot Make MP3s from Multi-Segment Videos!" with icon 2 buttons {"OK"} default button "OK"
                   error number -128
               end if
           end if
           
           --Sets up temp-folder for videos to be converted.
           if pageURL_Done is not "" then
               set rdmString to ""
               repeat 6 times
                   set rdmString to rdmString & some item of "abcdefghijklmnopqrstuvwxyz1234567890"
               end repeat
               
               -- Sets up appearance and launches Terminal window for download & conversion.
               tell application "System Events"
                   set terminalRunning to count of (every process whose name is "Terminal")
                   if terminalRunning is 1 then
                       tell application "Terminal"
                           activate
                       end tell
                       tell application "System Events" to keystroke "n" using command down
                       tell application "Terminal"
                           set background color of first window to "black"
                           set cursor color of first window to "red"
                           set normal text color of first window to "red"
                           set bold text color of first window to "red"
                       end tell
                   else
                       tell application "Terminal"
                           activate
                       end tell
                       tell application "Terminal"
                           set background color of first window to "black"
                           set cursor color of first window to "red"
                           set normal text color of first window to "red"
                           set bold text color of first window to "red"
                       end tell
                   end if
               end tell
               tell application "Terminal"
                   do script "clear; mkdir -p ~/Library/Application\\ Support/ppcmcTemp/" & rdmString & "/; echo -e \"
\"; echo -e \"
Downloading Video to Convert...\"; sleep 1; echo -e \"
\"; /usr/local/bin/python"
& pythonVrsn & " /usr/local/bin/youtube-dl " & pageURL_Done & " -o ~/Library/Application\\ Support/ppcmcTemp/" & rdmString & "/\"%(title)s.%(ext)s\"; echo -e \"
\"; echo -e \"
Converting Video to MP3...\"; sleep 1; echo -e \"
\"; vidTtl=\"$(ls ~/Library/Application\\ Support/ppcmcTemp/"
& rdmString & "/)\"; /usr/local/bin/ffmpeg-0.5 -i ~/Library/Application\\ Support/ppcmcTemp/" & rdmString & "/\"${vidTtl}\" -f mp3 -ar 44100 -ab 320000 -vn ~/Desktop/\"${vidTtl%????}\".mp3; rm -R ~/Library/Application\\ Support/ppcmcTemp/" & rdmString & "/; echo -e \"
\"; echo -e \"
- Conversion Complete -\"; sleep 1; echo -e \"
\""
in first window
               end tell
               error number -128
           end if
           beep
           display dialog "A Video URL is Required to Proceed" with icon 2 buttons {"Try Again", "Cancel"} default button "Try Again"
       end if
       
       
       
       ----
       -- Video download code.
       ----
       
       if actionChoice is "Save" then
           if pageURL_Done is not "" then
               if archType is "PPC" then
                   set qualityChoice to (choose from list {"LQ Video", "SD Video", "HD Video"} with prompt " Choose Preferred Quality:    

Note: will download closest match available.
"
default items "HD Video" without multiple selections allowed) as text
                   
                   -- LQ quality choice.
                   if qualityChoice is "LQ Video" then
                       set videoQuality to the first item of videoQualityOptions
                       
                       -- SD quality choice.
                   else if qualityChoice is "SD Video" then
                       set videoQuality to the second item of videoQualityOptions
                       
                       -- HQ quality choice.
                   else if qualityChoice is "HD Video" then
                       set videoQuality to the third item of videoQualityOptions
                       
                       -- Exits if user clicks "Cancel".
                   else if qualityChoice is "false" then
                       error number -128
                   end if
               else
                   set videoQuality to ""
               end if
               
               -- Sets up appearance and launches Terminal window for download.
               tell application "System Events"
                   set terminalRunning to count of (every process whose name is "Terminal")
                   if terminalRunning is 1 then
                       tell application "Terminal"
                           activate
                       end tell
                       tell application "System Events" to keystroke "n" using command down
                       tell application "Terminal"
                           set background color of first window to "black"
                           set cursor color of first window to "yellow"
                           set normal text color of first window to "yellow"
                           set bold text color of first window to "yellow"
                       end tell
                   else
                       tell application "Terminal"
                           activate
                       end tell
                       tell application "Terminal"
                           set background color of first window to "black"
                           set cursor color of first window to "yellow"
                           set normal text color of first window to "yellow"
                           set bold text color of first window to "yellow"
                       end tell
                       
                   end if
               end tell
               tell application "Terminal"
                   do script "clear; echo -e \"
\"; echo -e \"
Downloading Video...\"; sleep 1; echo -e \"
\"; /usr/local/bin/python"
& pythonVrsn & " /usr/local/bin/youtube-dl " & videoQuality & " " & pageURL_Done & " -o ~/Desktop/\"%(title)s.%(ext)s\"; echo -e \"
\"; echo -e \"
- Download Complete -\"; sleep 1; echo -e \"
\""
in first window
               end tell
               error number -128
           else
               beep
               display dialog "A Video URL is Required to Proceed" with icon 2 buttons {"Try Again", "Cancel"} default button "Try Again"
           end if
           
           
           
           ----
           -- Plays video in QuickTime.
           ----
           
       else if actionChoice is "Play" then
           if pageURL_Done is not "" then
               if archType is "PPC" then
                   set qualityChoice to (choose from list {"LQ Video", "SD Video", "HD Video"} with prompt " Choose Preferred Quality:    

Note: will stream closest match available.
"
default items "SD Video" without multiple selections allowed) as text
                   
                   -- LQ quality choice.
                   if qualityChoice is "LQ Video" then
                       set videoQuality to the first item of videoQualityOptions
                       
                       -- SD quality choice.
                   else if qualityChoice is "SD Video" then
                       set videoQuality to the second item of videoQualityOptions
                       
                       -- HQ quality choice.
                   else if qualityChoice is "HD Video" then
                       set videoQuality to the third item of videoQualityOptions
                       
                       -- Exits if user clicks "Cancel".
                   else if qualityChoice is "false" then
                       error number -128
                   end if
               else
                   set videoQuality to ""
               end if
               
               -- Gets video link from URL and checks for multi-segment videos.
               set pageURL_Segments to paragraphs of (do shell script "/usr/local/bin/python" & pythonVrsn & " /usr/local/bin/youtube-dl --get-url " & videoQuality & " " & pageURL_Done) as list
               set numberOfSegments to the number of items of pageURL_Segments
               
               -- Multi-segment controller. If a video has multiple segments, each additional segment is triggered after the current QuickTime window is closed. NOTE: PPC Media Center must close ALL windows currently open before starting first segment.
               if numberOfSegments > 1 then
                   try
                       do shell script "killall QuickTime\\ Player"
                   end try
               end if
               tell application "QuickTime Player"
                   activate
               end tell
               set segmentNumber to 1
               repeat numberOfSegments times
                   set qtLink to item segmentNumber of pageURL_Segments as string
                   if numberOfSegments > 1 then
                       repeat
                           delay 0.5
                           tell application "System Events"
                               if window 1 of process "QuickTime Player" exists then
                               else
                                   exit repeat
                               end if
                           end tell
                       end repeat
                   end if
                   
                   -- Activates and streams video link to QuickTime.
                   tell application "QuickTime Player"
                       getURL qtLink
                   end tell
                   set segmentNumber to segmentNumber + 1
               end repeat
               error number -128
           else
               beep
               display dialog "A Video URL is Required to Proceed" with icon 2 buttons {"Try Again", "Cancel"} default button "Try Again"
           end if
           
           
           
           ----
           -- End of Script.
           ----
       end if
   end repeat
end timeout

NOTE:  Just made an update that adds the ability to normalize Vimeo Albums/Channels/Groups and Google/Yahoo video-search results and in the process removes all DNS/Search Tracking for added security.  Just posting the update to the scraper below:

Applescript:


-- Removes extraneous characters/formatting-variations in Youtube links, filters out Vimeo albums/channels/groups code, and streamlines Google/Yahoo video search results.
       set pageURL_Im to pageURL
       set AppleScript's text item delimiters to "www."
       set wwwRmv to text items of pageURL_Im
       set AppleScript's text item delimiters to ""
       set pageURL_Im to wwwRmv as string
       set AppleScript's text item delimiters to {""}
       pageURL_Im
       set pageURL_Im to do shell script "echo " & quoted form of pageURL_Im & " | sed 's/http.*http/http/g;s/%3A/\\:/g;s/%2F/\\//g;s/%3F/?/g;s/%3D/=/g'"
       if pageURL_Im contains "[url]http://youtube.com/watch?feature=player_embedded[/url]" then
           set pageURL to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]http://youtube.com/watch?feature=player_embedded&v=[/url]", 0)
       else if pageURL_Im contains "[url]https://youtube.com/watch?feature=player_embedded[/url]" then
           set pageURL to "[url]https://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]https://youtube.com/watch?feature=player_embedded&v=[/url]", 0)
       else
           set pageURL_Im to do shell script "echo " & pageURL_Im & " | sed 's/?list.*//g'"
           set pageURL_Im to do shell script "echo " & pageURL_Im & " | sed 's/&.*//g'"
           set pageURL_Im to do shell script "echo " & pageURL_Im & " | sed 's/vimeo.com\\/album\\/.*\\/video\\//vimeo.com\\//g'"
           set pageURL_Im to do shell script "echo " & pageURL_Im & " | sed 's/vimeo.com\\/channels\\/.*\\//vimeo.com\\//g'"
           set pageURL_Im to do shell script "echo " & pageURL_Im & " | sed 's/vimeo.com\\/groups\\/.*\\/videos\\//vimeo.com\\//g'"
           if pageURL_Im contains "[url]http://youtu.be/[/url]" then
               set pageURL to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]http://youtu.be/[/url]", 0)
           else if pageURL_Im contains "[url]https://youtu.be/[/url]" then
               set pageURL to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "[url]https://youtu.be/[/url]", 0)
           else if pageURL_Im contains "youtu.be/" then
               set pageURL to "[url]http://youtube.com/watch?v=[/url]" & trimLine(pageURL_Im, "youtu.be/", 0)
           else if pageURL_Im contains "[url]http://google.com/url?q=[/url]" then
               set pageURL to trimLine(pageURL_Im, "[url]http://google.com/url?q=[/url]", 0)
           else
               set pageURL to pageURL_Im
           end if
       end if

Last edited by artphotodude (2015-11-01 02:59:58 pm)

Offline

 

#2 2015-05-03 01:44:49 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: Final Completion of Web-Video Downloader/Player/MP3-Maker...

Hi,

don't use both sudo and administrator privileges in the same line, see Technical Note TN2065: do shell script in AppleScript


regards

Stefan

Offline

 

#3 2015-05-03 12:54:19 pm

artphotodude
Member
Registered: 2012-10-15
Posts: 45

Re: Final Completion of Web-Video Downloader/Player/MP3-Maker...

StefanK wrote:

Hi,

don't use both sudo and administrator privileges in the same line, see Technical Note TN2065: do shell script in AppleScript


Very true Stefan:

Wound up having to do this because of somewhat inconsistent application of the admin password during the install (mostly in newer Mac systems).  Is not generally considered good form, but provided a backup-password execution because of sudo, that I was not able to always count on without it.  This, I suspect, was do to the 'if-statements' that look for items already installed before attempting to install.  Have noticed a lot of handlers, and permissions don't always hold when doing multiple "if/else" ins and outs. 

Fortunately, it is only used on first install and after that, the installer portion is completely unused.  Had initially wanted to have an installer app, separate from the working part of the script, but GateKeeper in later versions is pretty unforgiving, and it wound-up making sense to just get it all out of the way with that first right-click open, and "Yes, I Want to Continue...".

Offline

 
  • Index
  •  » Code Exchange
  •  » Final Completion of Web-Video Downloader/Player/MP3-Maker...

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)