home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Auto start time shift
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="etsmc" data-source="post: 959438" data-attributes="member: 126069"><p>Hope someone can help out.</p><p>What we would like to do is automatically start time shifting all channels on our TV server</p><p> </p><p>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.</p><p></p><p>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.</p><p> </p><p>any pointers would be great.</p><p> </p><p> </p><p>[CODE=C#]using System;</p><p>using System.Diagnostics;</p><p>using System.Collections;</p><p>using System.Text;</p><p>using TvControl; // include the tvserver remote control interfaces</p><p>using TvLibrary.Channels; // include tv-channel types</p><p>using TvDatabase;</p><p>using System.Collections.Generic; // include tv-server database</p><p> </p><p>namespace AutoTimeshifter</p><p>{</p><p> /// <summary></p><p> /// example which connects to the tvserver</p><p> /// and starts timeshifting then waits 5 seconds and then stops timeshifting.</p><p> /// </summary></p><p> class Program</p><p> {</p><p> static void Main(string[] args)</p><p> {</p><p> try</p><p> {</p><p> //set the hostname of the tvserver</p><p> RemoteControl.HostName = "tv-server";</p><p> </p><p> //get the location of the database..</p><p> string connStr;</p><p> string provider;</p><p> IController controller = RemoteControl.Instance;</p><p> controller.GetDatabaseConnectionString(out connStr, out provider);</p><p> </p><p> //set the connection string</p><p> Gentle.Framework.ProviderFactory.SetDefaultProviderConnectionString(connStr);</p><p> </p><p> // Now get a list of all tv-channels</p><p> IList<Channel> channels = Channel.ListAll();</p><p> Console.WriteLine("List of Channels");</p><p> foreach (var c in channels)</p><p> {</p><p> Console.WriteLine("{0}, {1}", c.DisplayName, c.IdChannel);</p><p> </p><p> Console.WriteLine("timeshifting channel:{0}", c.DisplayName);</p><p> </p><p> //start timeshifting</p><p> IUser me = new User();</p><p> </p><p> VirtualCard vcard;</p><p> </p><p> TvResult result = controller.StartTimeShifting(ref me, c.IdChannel, out vcard);</p><p> if (result != TvResult.Succeeded)</p><p> {</p><p> //failed to start timeshifting</p><p> Console.WriteLine("timeshifting failed:{0}", result);</p><p> }</p><p> else</p><p> {</p><p> Console.WriteLine("timeshifting succeeded");</p><p> Console.WriteLine(" rtsp url:{0}", vcard.RTSPUrl);</p><p> Console.WriteLine(" filename:{0}", vcard.TimeShiftFileName);</p><p> Console.WriteLine(" VCard:{0}", vcard.Id);</p><p> }</p><p> }</p><p> </p><p> }</p><p> catch (Exception ex)</p><p> {</p><p> Console.WriteLine(ex.Message);</p><p> </p><p> }</p><p> Console.ReadKey();</p><p> }</p><p> }</p><p>}[/code]</p></blockquote><p></p>
[QUOTE="etsmc, post: 959438, member: 126069"] 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=C#]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(); } } }[/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Auto start time shift
Contact us
RSS
Top
Bottom