Comskip tuning - AVS Forum
Forum Jump: 
Thread Tools
post #1 of 2 Old 08-28-2013, 02:37 PM - Thread Starter
Phillie14586's Avatar
Join Date: Sep 2010
Posts: 111
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 4 Post(s)
Liked: 10
Does anyone know how to run Comskip manually on a Mac? With the new version of Comskip the commercial marking is way off and I would like to tune the .ini file.
Phillie14586 is offline  
Sponsored Links
post #2 of 2 Old 09-01-2013, 06:41 AM - Thread Starter
Phillie14586's Avatar
Join Date: Sep 2010
Posts: 111
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 4 Post(s)
Liked: 10
I combined the RecordingStarted and RecordingDone scripts to come up with this script that will run comskip from EyeTV manually. I don't know how to send the -w command infront of comskip to bring up the debug window like you can in windows but at least it will run.

-- by Ben Blake, September 2009

global LogMsg
-- 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"
set selectedRecordings to selection of programs window
repeat with theRecording in selectedRecordings
set recordingID to unique ID of theRecording as integer
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 recording id recrdingIDInteger
set LogMsg to "RecordingDone found multiple PIDs for recording ID: " & recordingID & ", Channel " & (channel number of rec) & " - " & (title 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 repeat
end tell
delay 10
set cmd to "/usr/bin/nice -n 2 '/Library/Application Support/ETVComskip/' --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 run

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)
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
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/' --force --log " & recID & " &> /dev/null &"
set cmd to "'/Library/Application Support/ETVComskip/' --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
Phillie14586 is offline  
Reply HTPC - Mac Chat

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Forum Jump: 

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off