Auto start time shift (1 Viewer)

etsmc

Portal Member
June 20, 2012
17
1
37
Home Country
Australia Australia
Hope someone can help out.
What we would like to do is automatically start time shifting all channels on our TV server

i have used the Example 2 in the development wiki and modified it a bit and have been able to get a list of all the channels and then for each channel start time shifting it.

The problem is that it will start time shifting the fist channel on the first card and then when it starts the next time shift it starts in on the same card and stops the previous channel. we would like it to start on the next available card unless a channel on the same transponder is running then use the card that is on.

any pointers would be great.


Code:
using System;
using System.Diagnostics;
using System.Collections;
using System.Text;
using TvControl;		  // include the tvserver remote control interfaces
using TvLibrary.Channels; // include tv-channel types
using TvDatabase;
using System.Collections.Generic;		// include tv-server database
 
namespace AutoTimeshifter
{
	/// <summary>
	/// example which connects to the tvserver
	/// and starts timeshifting then waits 5 seconds and then stops timeshifting.
	/// </summary>
	class Program
	{
		static void Main(string[] args)
		{
			try
			{
				//set the hostname of the tvserver
				RemoteControl.HostName = "tv-server";
 
				//get the location of the database..
				string connStr;
				string provider;
				IController controller = RemoteControl.Instance;
				controller.GetDatabaseConnectionString(out connStr, out provider);
 
				//set the connection string
				Gentle.Framework.ProviderFactory.SetDefaultProviderConnectionString(connStr);
 
				// Now get a list of all tv-channels
				IList<Channel> channels = Channel.ListAll();
				Console.WriteLine("List of Channels");
				foreach (var c in channels)
				{
					Console.WriteLine("{0}, {1}", c.DisplayName, c.IdChannel);
 
					Console.WriteLine("timeshifting channel:{0}", c.DisplayName);
 
					//start timeshifting
					IUser me = new User();
 
					VirtualCard vcard;
 
					TvResult result = controller.StartTimeShifting(ref me, c.IdChannel, out vcard);
					if (result != TvResult.Succeeded)
					{
						//failed to start timeshifting
						Console.WriteLine("timeshifting failed:{0}", result);
					}
					else
					{
						Console.WriteLine("timeshifting succeeded");
						Console.WriteLine(" rtsp url:{0}", vcard.RTSPUrl);
						Console.WriteLine(" filename:{0}", vcard.TimeShiftFileName);
						Console.WriteLine(" VCard:{0}", vcard.Id);
					}
				}
			   
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.Message);
 
			}
			Console.ReadKey();
		}
	  }
}
 

Users who are viewing this thread

Similar threads

This Plugin is made to overtake the lack of direct show video settings in Tvserver for hauppauge PVR card (tested with Colossus 2 and Pvr HD2 usb, but it could work with any pvr card)For each timeshift starting it setups : VideoProcAmp_Brightness VideoProcAmp_Contrast VideoProcAmp_Hue VideoProcAmp_Saturation VideoProcAmp_Sharpness...
This Plugin is made to overtake the lack of direct show video settings in Tvserver for hauppauge PVR card (tested with Colossus 2...
This Plugin is made to overtake the lack of direct show video settings in Tvserver for hauppauge PVR card (tested with Colossus 2...
Replies
0
Views
947
Added cron task into my enigma box to run this script daily. Test run worked without any issues so no more manual edits everyday. (y)(y)
Added cron task into my enigma box to run this script daily. Test run worked without any issues so no more manual edits everyday...
Any assistance here would be greatly appreciated - I am pulling my hair out with this one! I am using a couple of IPTV services...
Replies
20
Views
2K
Hi, I'm quite new to this forum so please excuse me if I'm short on my understanding on how this works, I've been trying to find a solution for a couple of days but I've been yet unsuccessful. I'm trying to use an old HP Touchsmart (iq500) as a TV screen to live stream my PS2, as I haven't got enough room/money for a new TV. The...
Hi, I'm quite new to this forum so please excuse me if I'm short on my understanding on how this works, I've been trying to find a...
Hi, I'm quite new to this forum so please excuse me if I'm short on my understanding on how this works, I've been trying to find a...
Replies
0
Views
981
OK, this is specifically for people in Belgium (Vlaanderen) who are using Telenet Cable with MediaPortal 2. Next year (Edit: this year, in march 2020) the Telenet provider will stop broadcasting Analog TV and Radio signals on their cable, and make the switch to Digital (DVB-C). The radio signals will disappear completely, so you'll...
OK, this is specifically for people in Belgium (Vlaanderen) who are using Telenet Cable with MediaPortal 2. Next year (Edit: this...
OK, this is specifically for people in Belgium (Vlaanderen) who are using Telenet Cable with MediaPortal 2. Next year (Edit: this...
Replies
0
Views
908
Hey. When I want to get info from tv server I use TVBusinessLayer methods. Also sometimes I need to set cofing with some metthod I don't remember
Hey. When I want to get info from tv server I use TVBusinessLayer methods. Also sometimes I need to set cofing with some metthod I...
Hi, I'm moving from delphiprogramming to develp a application in visual studio c#, and i got this just a button and a textbox...
Replies
1
Views
993
Top Bottom