Appleskript nach erfolgreichem Firefox Download ausführen

Jupidu

Mitglied
Thread Starter
Dabei seit
10.02.2008
Beiträge
57
Reaktionspunkte
0
Hi,
ich möchte, dass nach einem erfolgreichem Youtube Video Download, dieses Video automatisch zu iTunes hinzugefügt wird. Ein Appleskript, welches diese Aufgabe übernimmt, habe ich schon geschrieben.

Gibt es eine Möglichkeit, dass dieses Skript ausgeführt wird, sobald der Videodownload mit Firefox beendet ist?
 
Mit einer Ordnerüberwachung.
Testen auf Video-Datei und evtl. von youtube.
Script verzögern solange *.part existiert.
Siehe z.B. hier.
Das ist zwar jetzt nicht OSX, ist aber trotzdem hilfreich.
 
Auf Systemebene gibt es meines Wissens keinerlei Kontrollmöglichkeit, ob ein Download abgeschlossen ist oder nicht.
Das geht wahrscheinlich nur, wenn der Download selbst mit dem gleichen AppleScript gestartet und in kurzen Intervallen gecheckt wird, ob die Aktion beendet worden ist. (Firefox ist allerdings wenig scriptfreundlich ...)
Wie löst Du den Youtube-Download aus?
Ich nehme an mit einem Plugin?

Ciao
Farid
 
@chebfarid
Gibt's denn noch »file is busy« in AS?
*.part wäre halt auf Firefox beschränkt.
 
Zuletzt bearbeitet:
hi,
besten Dank für die antworten. Ich nutze nen Firefox-Plugin zum Youtube-Download.

@olivetti
das mit dem *.part funktioniert nicht, da die videodatei nicht als *.part gespeichert wird. Es wird beim Download gleich ne *.mp4, die man auch sofort abspielen kann (nur halt nicht bis zum Ende).

Hab das Problem jetzt auch mit einer Ordner-Überwachung gelöst. Hier gibt es das Skript dazu:

http://dougscripts.com/itunes/itinfo/folderaction01.php

Komisch, dass es mit Firefox keine einfachere Lösung gibt. Firefox muss doch irgendeine Meldung rausgeben, sobald der Download beendet ist. Sonst könnte es ja auch keine Growl-Notifications geben...
 
Welches FF-Plugin ist das denn?
Vlt. kann man Growl abfragen.
Es gab/gibt einen »busy status« auf Dateien, evtl. kann man damit was machen.
 
Komisch, dass es mit Firefox keine einfachere Lösung gibt. Firefox muss doch irgendeine Meldung rausgeben, sobald der Download beendet ist. Sonst könnte es ja auch keine Growl-Notifications geben...
Ja klar. Firefox gibt eine Notification raus, für die sich ein Programm registrieren kann. Dieses Programm zu schreiben, ist mit Verlaub aber etwas komplizierter als dein verlinktes AppleScript.


Gruß


Anbei ein weiteres Skript, welches noch ein wenig zuverlässiger arbeiten sollte. Es "vereint den Vorteil der Größenwachstumsmethode (Schnelligkeit) mit der Zuverlässigkeit der lsof-Methode":
Code:
on adding folder items to thisFolder after receiving theItems
	repeat with this_item in theItems
		
		try
			
			--check if file is growing using UNIX "ls" command 
			set LastFileSize to -1
			set isGrowing to true
			repeat until isGrowing is false
				set CurrentFileSize to do shell script ("/bin/ls -l " & (quoted form of (POSIX path of (this_item))) & " | /usr/bin/awk '{print $5}'")
				if CurrentFileSize is equal to LastFileSize then
					set isGrowing to false
				else
					set LastFileSize to CurrentFileSize
					delay 2
				end if
			end repeat
			
			--check if file is busy using UNIX "lsof" command 
			set isbusy to 1
			repeat until isbusy is 0
				set isbusy to ((do shell script ("echo `lsof " & (quoted form of (POSIX path of (this_item))) & " | wc -l`")) as integer)
				if isbusy is not equal to 0 then
					delay 5
				end if
			end repeat
			
			
			tell application "Finder"
				move this_item to folder "x:y:z:"
			end tell
			
			
			--once the script arrives here, the file in question is not growing and is not busy anymore 
			--this has been tested for all kinds of file sizes (up to 1,2GB) and protocols (FTP, SMB) 
			--now that the file is ready, begin your processing 
			--you should check here if the file exists, because the Windows copy process could have been aborted by the user
		end try
		
	end repeat
end adding folder items to
 
  • Gefällt mir
Reaktionen: chebfarid
Zurück
Oben Unten