a script to see if something is recording

General talk about ARGUS TV
cazz
Posts: 17
Joined: Sat May 15, 2010 8:42 pm
Location: Sweden

a script to see if something is recording

Post by cazz » Tue Aug 29, 2017 10:31 pm

Hi
Is it possible with a batch script see if something is recording on Argus-TV servern.

Right now I have a script on my workstation so after I have move the file that I have recording to a folder I run the script

The script open TS-doctor and extract the subtitle of the file that I have recording, after that is use MKVmerge to join the TS file and the SRT file to a MKV file and when it done it clean all old files and move the new MKV file back to the server that I also running Plex server.

Why I do this is because Plex have very hard time to understand the swedish subtitle in the TS file so it does not show any subtitle but with my script and with TS-doctor and MKVmerge I now can easy watch what I have recording :)

But now I like to make it automatic with a script that run ever night and first it have to see if that is nothing is recording or going to record, after that is going to start running my script.

tomper
Posts: 36
Joined: Sat Apr 28, 2012 1:02 am

Re: a script to see if something is recording

Post by tomper » Wed Aug 30, 2017 9:02 pm

Argus TV has a REST API and a wrapper for .Net so if your scripting language can't consume that kind of service, you'll have to create a small programme that can be called from your script to make the call.

FWIW here's the code for a C# console app that checks if there's a recording running or scheduled within whatever number of hours provided as the fourth argument (or now if there's no fourth argument).

ConsoleAppName.exe serverName portNumber serviceTransport numberOfHours
e.g. ConsoleAppName.exe MyServer 49943 Http 3

Code: Select all

static void Main(string[] args)
{
  if (args.Length < 3)
    return;
   
  if (!Proxies.IsInitialized)
  {
    Proxies.Initialize(new ServerSettings()
    {
      ServerName = args[0],
      Port = int.Parse(args[1]),
      Transport = (ServiceTransport)Enum.Parse(typeof(ServiceTransport), args[2])
    });
  }

  int hours = 0;

  if (args.Length > 3)
    int.TryParse(args[3], out hours);
 
  UpcomingRecording upcomingRecording = Proxies.ControlService.GetNextUpcomingRecording(true).Result;
  Console.WriteLine((upcomingRecording.ActualStartTime.CompareTo(DateTime.Now.AddHours(hours))) < 0);
}
I don't know enough about bat files to tell you if or how if could be called from one. The programme writes either true or false to the standard output so you might have to change the last line to give you whatever output you need.

Hope this helps.
Last edited by tomper on Mon Sep 04, 2017 8:08 pm, edited 5 times in total.

cazz
Posts: 17
Joined: Sat May 15, 2010 8:42 pm
Location: Sweden

Re: a script to see if something is recording

Post by cazz » Wed Aug 30, 2017 9:18 pm

Thanks for the replay
Ahh have never work in C#, only some in VB.NET

Hmm have to see what I can do about it.

rudig
Posts: 254
Joined: Tue Sep 06, 2011 6:21 pm

Re: a script to see if something is recording

Post by rudig » Wed Aug 30, 2017 9:53 pm

Hi, can't you solve this with running a post script after the recording? You can configure this in Argus

cazz
Posts: 17
Joined: Sat May 15, 2010 8:42 pm
Location: Sweden

Re: a script to see if something is recording

Post by cazz » Wed Aug 30, 2017 10:47 pm

well what I can understand I can run a script after it have recording (I have try but never got it to work)
But not sure if that is good if it going to recording some other program after the first one is finnish recording.

If the script start to run after the first recording it going to be wrong when it find the the tv show it still recording.

tomper
Posts: 36
Joined: Sat Apr 28, 2012 1:02 am

Re: a script to see if something is recording

Post by tomper » Wed Aug 30, 2017 11:57 pm

cazz wrote:
Wed Aug 30, 2017 10:47 pm
If the script start to run after the first recording it going to be wrong when it find the the tv show it still recording.
If you configure ArgusTV to pass the path of the completed recording as a parameter then you could create a script that only processes that file.

You would have to process the file on the server though.

cazz
Posts: 17
Joined: Sat May 15, 2010 8:42 pm
Location: Sweden

Re: a script to see if something is recording

Post by cazz » Thu Aug 31, 2017 7:30 pm

hmm yes that I can do but then somehow I need to send info about the file from argustv server to the script

rudig
Posts: 254
Joined: Tue Sep 06, 2011 6:21 pm

Re: a script to see if something is recording

Post by rudig » Fri Sep 01, 2017 6:15 pm

Check https://www.argus-tv.com/wiki/index.php ... g_Commands foray the parameters that you can pass to a script

cazz
Posts: 17
Joined: Sat May 15, 2010 8:42 pm
Location: Sweden

Re: a script to see if something is recording

Post by cazz » Sat Sep 02, 2017 12:11 am

hmm trying to understand how to use the Processing command.

I know how to use parameters to insert data in a batch file

So somehow I need to make it like this in processing

runfile.bat "%%FILE%%"

When %%FILE%% is the patch and filename to the recording .TS file

But not sure how to set it up

I mean Name I understand and going to write "Convert"
but Path and Arguments?

I did try something easy that add info in a text file but did not got it to work, nothing happend

That I did try was this

Code: Select all

Name: Convert
Path: D:\script.bat
Arguments: "%%FILE%%"

The bat file is on the server where Argus TV servern is.
I have to se "" at the %%FILE% becurse the filename have space

the batch file is very simple

Code: Select all

@echo off
@echo %~1 >>test.txt
just trying to add the address and filename in a text file but not even a text file is created.

/UPDATE
Got it to work like that I have write, is just that even if the script is simple it take sometime to run the processing

cazz
Posts: 17
Joined: Sat May 15, 2010 8:42 pm
Location: Sweden

Re: a script to see if something is recording

Post by cazz » Sat Sep 02, 2017 7:09 pm

It feel like it not always run the scripit

Have notice I can manuelly run Post Processing of a recording file but it does look like nothing happend.
Sometime it have run the script but not always.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests