- Creops
- Medlem ●
- Gävle
- 2008-01-28 09:24
Hej alla som kan mer om kodning än mej.
Jag håller på att försöka sätta upp en headless Mac mini som ska streama en videosignal.
Den hämtar tider och namn från iCal och byter namn på filerna.
Ibland får jag upp nonsens felmeddelanden från scriptet som jag inte riktigt förstår.
Jag misstänker att den skulle behövas kollas igenom och kanske läggas in lite (in case of error)kod.
Det är från början ett franskt script som jag försökt översatt.
Alla kommentarer mottages tacksamt!
La upp den här oxå: http://pastebin.com/f64367e3
property thelist : {} on idle --Site or will be stores the file record (the file) set thefile to "My_HD:storage:mymovie.mov" repeat set now to current date set today to current date set time of today to 0 set tomorrow to ((today) + (1 * days)) tell application "iCal" --one recovers and one counts the events of today (calendar number 1) set todayevents to (every event of calendar "Stream" whose start date comes after today and start date comes before tomorrow) set thecount to count todayevents --the found events are analyzed set i to 1 repeat until i is (thecount + 1) set thestart to start date of item i of todayevents set theend to end date of item i of todayevents -- set nomcours to summary of item i of todayevents set the_desc to the description of item i of todayevents set beforenow to ((now) - (2 * minutes)) set afternow to ((now) + (2 * minutes)) --if an event has one hour of beginning between now and 2 minutes ago, one looks at more closely if thestart comes before now and thestart comes after beforenow then --si la liste d'évènements signalés est vide, on signale l'évènement if thelist is {} then --one announces it by displaying his name set thesummary to summary of item i of todayevents --display dialog thesummary -- Ta bort ev fil om den redan finns. -- Kollar så inte QT spelar in. tell application "QuickTime Broadcaster" tell first document status end tell set theStatus to the result end tell if theStatus is not "Broadcasting" then -- Kollar om filen finns try tell application "Finder" if file thefile exists then set renThefile to true else set renThefile to false end if end tell end try -- om filen finns byt namn på den. if renThefile then try tell application "Finder" activate set the name of file thefile to "Slask " & (current date) & ".mov" end tell on error errTxt number errNum display dialog errTxt & return & errNum end try end if end if delay 1 -- Startar inspelningen say "The recording is activated" tell application "QuickTime Broadcaster" activate tell document 1 set recording to true end tell start document 1 end tell --and one puts it in the list of the already announced events set theID to uid of item i of todayevents set thelist to thelist & {theID} --if the list of announced events is not empty, one checks else set listcount to count thelist set j to 1 set alreadyhere to false repeat until j is (listcount + 1) if item j of thelist is uid of item i of todayevents then --if the event were already announced, the process is stopped set alreadyhere to true exit repeat else set j to j + 1 end if end repeat if alreadyhere is false then --if the event were not announced yet, one announces it by displaying his name set thesummary to summary of item i of todayevents --display dialog thesummary -- one can also launch an application: say "Recording has now stopped" tell application "QuickTime Broadcaster" tell document 1 set recording to true end tell start document 1 end tell --and one puts it in the list of the already announced events set theID to uid of item i of todayevents set thelist to thelist & {theID} end if end if end if -- Stop of QTB if one arrives at the end of the event tell application "QuickTime Broadcaster" if status of document 1 is "Diffusion" or status of document 1 is "Broadcasting" then -- display dialog "diffusion in progress" if theend comes before afternow and theend comes after now then -- display dialog "diffusion in the course of stop" stop document 1 -- it is waited until the diffusion arrete delay 10 -- One deplace the file records on the server -- Orginalet använder shellscript -- do shell script "mv " & path_to_server & "mymovie.mov " & path_to_server & nomfichier -- Rename filjävlen när allt är klart set theFileName to the_desc as string try tell application "Finder" activate set the name of file thefile to theFileName & " " & (current date) & ".mov" end tell on error errTxt number errNum display dialog errTxt & return & errNum say "File is done" end try end if end if end tell set i to i + 1 end repeat end tell --one repeats the operation every 60 seconds, and as one checks the events of it y' has 2 minutes, one thus leaves 1 minute of beat in the event of deceleration of the machine, not to miss an event return 60 end repeat end idle