|
SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer. |
|
Thread Tools | Search this Thread | Display Modes |
#361
|
|||
|
|||
Quote:
avifile = (avifile =~ /[?*\\\/:<>|]/).replaceAll("") Your code is missing the \ (the one you have escapes the / then you need two more, the first escaping the second.
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... Last edited by Slugger; 01-25-2011 at 10:09 PM. |
#362
|
|||
|
|||
Thanks Slugger - this code worked on fixing the problem that I was having as that was due to the ? - I guess it likely wouldn't have worked for the other characters.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#363
|
|||
|
|||
Kind of wish the Sage API exposed the function it uses to do this kind of thing. Then we'd have a call we could make on any platform that would always work. But that little line of code should do the trick on Windows...
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#364
|
|||
|
|||
Find TV to archive script
I was modifying the find_tv_to_archive.groovy script from the repository and noticed the string compare to test if the file is already at the destination location is case dependent. I had \\nas configured in Sage and used \\NAS in the script and things kept getting skipped. The snippit below takes care of that. For future reference if us mere mortals notice something like this (or even better fixes) that we want to point out to you, had you rather get posts here, PMs, or emails?
Code:
// If the media file is already stored on the NAS then just skip it if(MediaFileAPI.GetFileForSegment(mediaFile, 0).getAbsolutePath().toLowerCase().startsWith(dest.toString().toLowerCase())) continue; Thanks! |
#365
|
|||
|
|||
I would say this is not a bug in the script because files paths are case dependent in Linux (ie NAS != nas) and since sage supports Linux plugins should try to play nice with all the supported os'es
__________________
Server 2003 r2 32bit, SageTV9 (finally!) 2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast) 2x HD300, 1x SageClient (Win10 Test/Development) Check out TVExplorer |
#366
|
|||
|
|||
Quote:
Quote:
You're both right... the answer is to detect the OS and act accordingly. I just committed an update to the script that detects if it's running on Windows and if so, then do a case insensitive file path comparison.
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#367
|
|||
|
|||
Quote:
Quote:
Good call, and I applaud the use of the ternary operator. It doesn't get enough love these days |
#368
|
|||
|
|||
Quote:
Quote:
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#369
|
|||
|
|||
Groovy script for transcoding
Here is the Groovy script that I use to transcode files. The file will transcode files to MPEG-4 Good Quality AVI although this can be changed by modifying the Format variable in the code below. The output file will be put in the \\server\videos\TV Shows\{ShowName} folder and the file will be renamed to the Episode Title. For example the file 30Rock-BrooklynWithoutLimits-565091-0.mpg would end up being \\server\videos\TV Shows\30 Rock\Brooklyn Without Limits.avi. The code also strips any characters that are illegal for filenames in windows. This was written for Sage7 on Windows so I don't know if it would work on Linux or Mac.
The code is largely stolen from Slugger's examples for a groovy script to kick off comskip. Therefore I may have left in some superfluous code that is not needed. Code:
boolean checkRecordingType = true; // Check the recording is of the type specified on the command line (i.e. only process mpg recordings) Object mf = MediaFileAPI.GetMediaFileForID(Integer.parseInt(SJQ4_METADATA.get("SJQ4_ID"))); File path = new File(SJQ4_METADATA.get("SJQ4_PATH")); String fileName = SJQ4_METADATA.get("SJQ4_LAST_SEGMENT"); String EpisodeName2 = SJQ4_METADATA.get("SJQ4_EPISODE"); String NewPath = "\\\\Server\\Videos\\TV Shows\\"; String Format = "MPEG4-Good Quality AVI"; String avitype = "avi"; String avifile String OutputFile; String id = SJQ4_METADATA.get("SJQ4_ID"); String EpisodeName=ShowAPI.GetShowEpisode(mf); String ShowTitle=ShowAPI.GetShowTitle(mf); Object mediaFile = MediaFileAPI.GetMediaFileForID(id.toInteger()); if(SJQ4_ARGS.length > 0) fileType = SJQ4_ARGS[0]; else fileType = null; if(mf == null || path == null || path.getAbsolutePath().length() == 0 || fileName == null || fileName.length() == 0) { println("ERROR: Invalid environment data passed to scritpt!"); return 1; } if(checkRecordingType && fileType != null && fileType.length() > 0 && !fileName.endsWith("." + fileType)) { println("Recording is not of specified type '" + fileType + "', skipping comskip!"); return 2; } if(!comskipLive && MediaFileAPI.IsFileCurrentlyRecording(mf)) { println("Recording in progress, waiting..."); return 1; } if (EpisodeName !=null) avifile = EpisodeName + "." + avitype; else avifile = fileName + "." + avitype; avifile = (avifile =~ /[?*\\\\/:<>|]/).replaceAll("") OutputFile = NewPath + ShowTitle +"\\" + avifile; println("Media file is:"+mediaFile); println("Episode2="+EpisodeName2); println("avifile="+avifile); println("Outputfile="+OutputFile); println("Format="+Format); TranscodeAPI.AddTranscodeJob ( mediaFile , Format, new File(OutputFile) , true ); return 0;
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#370
|
||||
|
||||
I'm starting to have trouble resisting the draw of SJQv4, but i'm also hesitant to give up v3. Can the two plugins co-exist provided the rules don't cause collisions?
__________________
Clients: 1xHD200 Connected to 50" TH-50PZ750U Plasma Server : Shuttle SFF SSH55J2 w/ Win7 Home, SageTV v7, Core i3 540, 2GB RAM, 30GB SSD for OS, 1.5TB+2x1TB WDGP for Recordings, BluRay, 2xHDHR, 1xFirewire SageTV : PlayOn, SJQ, MediaShrink, Comskip, Jetty, Web Client, BMT Having a problem? Don't forget to include a log! (Instructions for: PlayOn For SageTV v1.5, MediaShrink) |
#371
|
|||
|
|||
v4 is an upgrade of v3, you cannot have both installed on a Sage system simultaneously. Installing v4 will overwrite v3 (if v3 was installed as a plugin and not just carried over from a Sage v6 upgrade). If v3 isn't installed as a plugin then all bets are off... jar collisions, etc. will result if you try to run the two in parallel.
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#372
|
|||
|
|||
Code:
Object mf; // This is a MediaFile object, pulled from somewhere earlier in this script File[] files = Tools.mapDir(MediaFileAPI.GetSegmentFiles(mf)) Thank you.
__________________
Vostro 200, Intel Core 2 Duo 2.53Ghz, Windows XP Pro as a Server and Client Quad Core 2.66 PC on 1000 MHz network for Comskip and AirVideo 4 x Comcast RNG110 tuners, 3 x Firewire + 1 USB-Uirt Channel control 4 x HD-PVR, 1 WinTV 1850 Composite and TS SageTV V7.0.23 |
#373
|
|||
|
|||
Quote:
Eventually, I'll allow the test script to modify the exe args and then you'll be able to do it that way, but there's no ETA for that feature. Until then, this is how you'd have to do it - only Groovy scripts can call Tools.mapDir().
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#374
|
|||
|
|||
@lenkost Here's basically the whole idea:
Replace your direct call to comskip.exe with this groovy script, which uses Tools.mapDir() to map the received file name argument... Code:
def exe = "C:/comskip/comskip.exe" // I'm assuming the first cmd line arg is the file name to be comskipped, adjust accordingly def fileName = Tools.mapDir(SJQ4_ARGS[0]) println "Using '${fileName}' as argument..." def cmdLine = [exe, fileName] println "Executing ${cmdLine}..." Process p = cmdLine.execute() p.waitFor() println p.in.text println p.err.text return p.exitValue()
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#375
|
|||
|
|||
Thanks. Will it pass comskip log to SJQ UI?
__________________
Vostro 200, Intel Core 2 Duo 2.53Ghz, Windows XP Pro as a Server and Client Quad Core 2.66 PC on 1000 MHz network for Comskip and AirVideo 4 x Comcast RNG110 tuners, 3 x Firewire + 1 USB-Uirt Channel control 4 x HD-PVR, 1 WinTV 1850 Composite and TS SageTV V7.0.23 |
#376
|
|||
|
|||
It will, as long as the output isn't more than 64KB. Once I fix the open bug pertaining to that issue then it should dump all output to the UI (that's what the last two println statements are for).
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#377
|
|||
|
|||
One more question:
If i kill job in SJQ UI, will the SJQ Agent kill corresponding instance of Comskip.exe? Does termination of the script kill the child process?
__________________
Vostro 200, Intel Core 2 Duo 2.53Ghz, Windows XP Pro as a Server and Client Quad Core 2.66 PC on 1000 MHz network for Comskip and AirVideo 4 x Comcast RNG110 tuners, 3 x Firewire + 1 USB-Uirt Channel control 4 x HD-PVR, 1 WinTV 1850 Composite and TS SageTV V7.0.23 |
#378
|
|||
|
|||
Depends on the OS you're running on. On Windows, I believe the answer is no. You'll have to test it to find out. Though it might because every groovy script runs in its own JVM and so it depends how groovy creates its child processes. Assuming it does it just like Java then I think the answer is still no on Windows and yes on Linux. But, again, you'll have to test to find out.
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#379
|
|||
|
|||
This is my SLQAgent.properties:
Code:
#Generated by SJQv4 agent #Thu Jan 27 22:38:10 EST 2011 task.comskip.exe=\\\\LenTV\\SJQScripts\\comskip.groovy task.comskip.schedule=ON task.comskip.args="$SJQ4_PATH\\$SJQ4_LAST_SEGMENT" task.comskip.test=\\\\LenTV\\SJQScripts\\comskip_test.groovy agent.mapdir = D:\\Sagetv1\\,\\\\LenTV\\Sagetv1\\;E:\\Sagetv2\\,\\\\LenTV\\Sagetv2\\ agent.schedule=ON task.comskip.testargs=ts task.comskip.rcmin=0 task.comskip.maxprocs=4 task.comskip.maxtimeratio=1.0 agent.resources=100 task.comskip.maxtime=14400 task.comskip.rcmax=1 agent.port=23344 task.comskip.resources=25 Code:
2011-01-27 22:41:37,555 WARN [ProcessRunner]: isActive(SJQ4Task-192.168.0.110-23347-1654) = true; [SJQ4Task-192.168.0.110-23347-1652, SJQ4Task-192.168.0.110-23347-1654] 2011-01-27 22:42:09,524 INFO [Config]: Props file update detected, reloading properties from disk! 2011-01-27 22:42:09,540 WARN [Config]: Unrecognized property skipped! [agent.mapdir] 2011-01-27 22:42:09,540 INFO [Config]: Props file update detected, reloading properties from disk! 2011-01-27 22:42:09,540 WARN [Config]: Unrecognized property skipped! [agent.mapdir] 2011-01-27 22:42:33,555 WARN [Config]: Unrecognized property skipped! [agent.mapdir] 2011-01-27 22:42:33,571 INFO [Config]: Watching 'C:\sjqagent\bin\..\conf' 2011-01-27 22:42:36,712 WARN [ProcessRunner]: isActive(SJQ4Task-192.168.0.110-23347-1652) = false; [] 2011-01-27 22:42:37,524 WARN [ProcessRunner]: isActive(SJQ4Task-192.168.0.110-23347-1654) = false; []
__________________
Vostro 200, Intel Core 2 Duo 2.53Ghz, Windows XP Pro as a Server and Client Quad Core 2.66 PC on 1000 MHz network for Comskip and AirVideo 4 x Comcast RNG110 tuners, 3 x Firewire + 1 USB-Uirt Channel control 4 x HD-PVR, 1 WinTV 1850 Composite and TS SageTV V7.0.23 |
#380
|
|||
|
|||
Code:
task.comskip.exe=\\\\LenTV\\SJQScripts\\comskip.groovy Code:
task.comskip.exe=script:\\\\LenTV\\SJQScripts\\comskip.groovy Code:
2011-01-27 22:42:09,540 WARN [Config]: Unrecognized property skipped! [agent.mapdir]
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
Currently Active Users Viewing This Thread: 4 (0 members and 4 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugin: MizookLCD (Alternate SageTV LCDSmartie Plugin) | cslatt | SageTV Customizations | 48 | 06-11-2012 10:44 AM |
SJQv4: Technology Preview | Slugger | SageTV v7 Customizations | 39 | 12-17-2010 01:17 PM |
SageTV Plugin Developers: Any way to see stats for your plugin? | mkanet | SageTV Software | 4 | 12-12-2010 10:33 PM |
MediaPlayer Plugin/STV Import: Winamp Media Player Plugin | deria | SageTV Customizations | 447 | 12-11-2010 07:38 PM |
SJQv4: Design Discussion | Slugger | SageTV v7 Customizations | 26 | 10-18-2010 08:22 AM |