Hallo zusammen
Zuerst mal ein gutes neues Jahr an alle hier!
Seit ich ETV-Comskip 2.0.2-10.6 installiert habe (auf Snow-Leo), fährt mein Mac mini nach der Aufnahme nicht mehr herunter. Er markiert brav die Werbung, bleibt dann aber laufen.
Ich habe das normale RecordingStarted-Script aus dem ETVComSkip-Paket installiert und mein RecrodingDone-Script angepasst:
RecordingStarted
Code:
on RecordingStarted(recordingID)
delay 10
set cmd to "/usr/bin/nice -n 2 '/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --log " & recordingID & " > /dev/null"
-- display dialog cmd
do shell script cmd
--disable this if you do not want a logfile written
-- write_to_file((short date string of (current date) & " " & time string of (current date)) & "Recording Started run for ID: " & recordingID & (ASCII character 13), (path to "logs" as string) & "EyeTV scripts.log", true)
end RecordingStarted
on write_to_file(this_data, target_file, append_data)
--from http://www.apple.com/applescript/sbrt/sbrt-09.html
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
RecordingDone
Code:
global LogMsg
on RecordingDone(recordingID)
do shell script "echo Kontrollmarke_1 > /comskip.txt"
tell application "EyeTV.app"
set Aufnahme to recordingID as integer
end tell
-- Werbung markieren mit ETVcomskip
-- do shell script "/Library/Application\\ Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials " & Aufnahme
set LogMsg to ""
do shell script "echo Kontrollmarke_2 >> /comskip.txt"
CheckMultiplePIDs(recordingID)
-- IDLE-Time abrufen
delay 60
do shell script "echo Kontrollmarke_3 >> /comskip.txt"
set idletime to do shell script "ioreg -c IOHIDSystem | grep Idle | tail -1 | awk '{printf(\"%d\", $NF/10^9);}'"
set idletime to idletime as integer
do shell script "echo " & idletime & " >> /comskip.txt"
-- Wenn IDLE-Time abgelaufen ist, überprüfen ob eine Aufnahme ansteht
if idletime > 60 then
tell application "System Events"
set itunes_running to (name of processes) contains "iTunes"
set quicktime_running to (name of processes) contains "Quicktime Player"
set frontrow_running to (name of processes) contains "Front Row"
end tell
if itunes_running is true then
tell application "iTunes"
if player state is playing then
set itunes_playing to true
else if player state is stopped then
set itunes_playing to false
else
delay 120
if player state is playing then
set itunes_playing to true
else
set itunes_playing to false
end if
end if
end tell
else
set itunes_playing to false
end if
if quicktime_running is true then
tell application "QuickTime Player"
if exists document 1 then
set quicktime_document to true
else
set quicktime_document to false
end if
end tell
else
set quicktime_document to false
end if
if itunes_playing is false and quicktime_document is false and frontrow_running is false then
tell application "EyeTV.app"
if «class IRcd» = false then
-- überprüfen ob eine Aufnahme ansteht
set limitsleep to 15 * minutes
set limitoff to 30 * minutes
set ruhezustand to true
set ausmachen to true
set vorlauf to («class Prpd» 2) * minutes
set jetzt to current date
repeat with Aufnahme in «class Stim» of every «class cPrg»
set diff to Aufnahme - jetzt
if diff ≥ vorlauf then set diff to diff - vorlauf
if diff ≥ 0 and diff ≤ limitsleep then set ruhezustand to false
if diff ≥ 0 and diff ≤ limitoff then set ausmachen to false
end repeat
-- Wenn keine Aufnahme in den nächsten 15 Minuten ansteht, in den Ruhezustand gehen
if ruhezustand = true and ausmachen = false then
activate
set antwort to display dialog "EyeTV hat eine Aufnahme beendet.
Die nächste Aufnahme steht in 15 - 30 Minuten an.
Soll der Computer in den Ruhezustand gehen?" buttons {"Ja", "Nein"} default button "nein" with icon note with title "EyeTV-Recorder" giving up after 30
if button returned of antwort = "Ja" or button returned of antwort = "" then
tell application "Finder"
ignoring application responses
sleep
end ignoring
end tell
end if
end if
-- Wenn keine Aufnahme in den nächsten 30 Minuten ansteht, herunterfahren
if ausmachen = true then
activate
set antwort to display dialog "EyeTV hat eine Aufnahme beendet.
Es steht keine EyeTV-Aufnahme bevor.
Soll der Computer ausgeschaltet werden?" buttons {"Ja", "Ruhezustand", "Nein"} default button "nein" with icon note with title "EyeTV-Recorder" giving up after 30
if button returned of antwort = "Ja" or button returned of antwort = "" then
tell application "Finder"
ignoring application responses
shut down
end ignoring
end tell
end if
if button returned of antwort = "Ruhezustand" then
tell application "Finder"
ignoring application responses
sleep
end ignoring
end tell
end if
end if
end if
end tell
end if
end if
end RecordingDone
-- testing code: this will not be called when triggered from EyeTV, but only when the script is run as a stand-alone script
on run
tell application "EyeTV.app"
set rec to «class Unqu» of item 1 of every «class cRec»
my RecordingDone(rec)
end tell
end run
on CheckMultiplePIDs(recordingID)
--check if there are multiple Video PIDs in the file
tell application "EyeTV.app"
set input_text to my read_from_file((path to "logs" as string) & "ETVComskip" & ":" & recordingID & "_comskip.log")
if (count of (input_text as string)) > 0 then
set logdata to every paragraph of input_text
set logdata_lastrow to (item ((count of logdata) - 1) of logdata) as string
if (items 1 thru 19 of logdata_lastrow) as string = "Video PID not found" then
--multiple Video PIDs, rerun MarkCommercials until successful
set recrdingIDInteger to recordingID as integer
set rec to «class cRec» id recrdingIDInteger
set LogMsg to "RecordingDone found multiple PIDs for recording ID: " & recordingID & ", Channel " & («class Chnm» of rec) & " - " & («class Titl» of rec)
set PIDs to (items 44 thru ((count of logdata_lastrow) - 2) of logdata_lastrow) as string
set delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ", "
set PID_List to {}
set PID_List to every word of PIDs
set AppleScript's text item delimiters to delims
repeat with pid in PID_List
my launchComSkip(recordingID, pid)
repeat while (my mcIsRunning())
delay 5
end repeat
end repeat
end if
end if
end tell
end CheckMultiplePIDs
on read_from_file(target_file)
--return the contents of the given file
set fileRef to (open for access (target_file))
set txt to (read fileRef for (get eof fileRef) as «class utf8»)
close access fileRef
return txt
end read_from_file
on write_to_file(this_data, target_file, append_data)
--from http://www.apple.com/applescript/sbrt/sbrt-09.html
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
on launchComSkip(recID, pid)
if pid = "" then
set cmd to "'/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log" & recID & " > /dev/null"
else
set cmd to "'/Library/Application Support/ETVComskip/MarkCommercials.app/Contents/MacOS/MarkCommercials' --force --log" & recID & " --pid=" & pid & " > /dev/null"
end if
do shell script cmd
end launchComSkip
on mcIsRunning()
set processPaths to do shell script "ps -xww | awk -F/ 'NF >2' | awk -F/ '{print $NF}' | awk -F '-' '{print $1}' "
return (processPaths contains "MarkCommercials")
end mcIsRunning
Anhand der Kontrollmarken im ersten Teil sehe ich dann in der Datei /comskip.txt, dass alle Kontrollmarken erreicht wurden, aber die idletime heute z.B. nur 17 Sekunden erreicht hat. Es scheint mir, als ob das noch laufenden X11 die Idletime unterbricht.
Habt ihr ähnliche Phänomene oder wie habt ihr das neue ETVComSkip implementiert, dass es funktioniert?