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.
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();
}
}
}