NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 4 5 6 7 8 … 93 Next »
Recording a specific episode based on season and episode number

 
  • 0 Vote(s) - 0 Average
Recording a specific episode based on season and episode number
cbgifford
Offline

Member

Posts: 189
Threads: 20
Joined: Aug 2014
#1
2014-12-18, 11:54 PM
Greetings all,

I'm writing a utility that will run from the postupdateepg.bat script that will add an entry to the recurring recording table based on a season and episode number or alternatively title and subtitle. I figure I shouldn't need any custom rules as I will be searching the EPG for the show details. I was wondering if there is anything else that needs to be done after adding the show to the recurring recordings table? One thing I can think of off the top of my head is how to get NPVR to rerun the scheduling so any thing I added would be scheduled to record instead of having to wait 24 hours for it to run again.

Any ideas or pointers would be appreciated. If there were anyone wanting a specific feature added to it, I'd be open to taking doing it.
Chris


Server - Intel Core I3-3210 @ 3.40GHz - 8 GB RAM - Windows 10.0 Pro - Total Storage - 5.4 TB
Two Silicondust HD Prime CC capture, 6 tuners total
Client - Intel Core I3-3210 @3.2GHz - 4GB Ram - Windows 7.0 Pro
Client - Intel Core I3-3210 @2.9GHz - 4GB Ram - Windows 10.0 Pro
NAS - Intel Core I3-3220T @ 2.8GHz - 4GB RAM - Windows 10.0 Pro (Total Storage - 25 TB)


sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#2
2014-12-19, 12:09 AM
Quote:I figure I shouldn't need any custom rules as I will be searching the EPG for the show details
I'm not quite sure how you're wanting it to work, but if you've already found the show you want recorded in the EPG data, then you can call something like the following to schedule a recording of that specific episode:

ScheduleHelperFactory.GetScheduleHelper().ScheduleRecording(epgEvent);
cbgifford
Offline

Member

Posts: 189
Threads: 20
Joined: Aug 2014
#3
2014-12-19, 01:40 AM (This post was last modified: 2014-12-19, 01:44 AM by cbgifford.)
sub Wrote:I'm not quite sure how you're wanting it to work, but if you've already found the show you want recorded in the EPG data, then you can call something like the following to schedule a recording of that specific episode:

ScheduleHelperFactory.GetScheduleHelper().ScheduleRecording(epgEvent);

I am using visual studio 2013 Community but using VB instead of C#. Haven't looked at C any about 20 years or there about. What reference do I need to add to access these types of calls? Or if you point me in teh direction of a thread that has a list of the functions and where they're located that would be awesome.
Chris


Server - Intel Core I3-3210 @ 3.40GHz - 8 GB RAM - Windows 10.0 Pro - Total Storage - 5.4 TB
Two Silicondust HD Prime CC capture, 6 tuners total
Client - Intel Core I3-3210 @3.2GHz - 4GB Ram - Windows 7.0 Pro
Client - Intel Core I3-3210 @2.9GHz - 4GB Ram - Windows 10.0 Pro
NAS - Intel Core I3-3220T @ 2.8GHz - 4GB RAM - Windows 10.0 Pro (Total Storage - 25 TB)


sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#4
2014-12-19, 01:55 AM
I'd assumed you were doing it form a plugin, but re-reading your post, I see it was form a standalone utility. You should be able to do it though, including from VB.NET. I can't help you with the exact syntax though - it's been a long time since I did any VB. You'd need to add a reference to NShared.dll and NUtility.dll though. If you're already looking at the data in the database, you can probably use EPGEvent.LoadByOID(x) to get the EPGEvent object to pass into the ScheduleRecording() call.
cbgifford
Offline

Member

Posts: 189
Threads: 20
Joined: Aug 2014
#5
2014-12-19, 02:09 AM
sub Wrote:You should be able to do it though, including from VB.NET. I can't help you with the exact syntax though - it's been a long time since I did any VB. You'd need to add a reference to NShared.dll and NUtility.dll though. If you're already looking at the data in the database, you can probably use EPGEvent.LoadByOID(x) to get the EPGEvent object to pass into the ScheduleRecording() call.

Just added the references, that gets me headed in the right direction, appreciate it. Syntax is on me, I've been a BASIC programmer before there was VB with MS Basic PDS and Quick Basic
Chris


Server - Intel Core I3-3210 @ 3.40GHz - 8 GB RAM - Windows 10.0 Pro - Total Storage - 5.4 TB
Two Silicondust HD Prime CC capture, 6 tuners total
Client - Intel Core I3-3210 @3.2GHz - 4GB Ram - Windows 7.0 Pro
Client - Intel Core I3-3210 @2.9GHz - 4GB Ram - Windows 10.0 Pro
NAS - Intel Core I3-3220T @ 2.8GHz - 4GB RAM - Windows 10.0 Pro (Total Storage - 25 TB)


mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,766
Threads: 954
Joined: May 2006
#6
2014-12-19, 02:23 AM
cbgifford Wrote:Just added the references, that gets me headed in the right direction, appreciate it. Syntax is on me, I've been a BASIC programmer before there was VB with MS Basic PDS and Quick Basic

I have a command line utility I use myself for recording by unique id here is the recording logic I use after I get the event oids. I don't record to the default folder,

Code:
if (ScheduleHelperFactory.GetScheduleHelper() == null)
                {
                    RecordingServiceProxy.ForceRemote();
                    ScheduleHelperFactory.SetScheduleHelper(RecordingServiceProxy.GetInstance());
                    PluginRegistry.GetInstance().LoadPlugins();
                }
                IScheduleHelper helper = ScheduleHelperFactory.GetScheduleHelper();

                foreach (int oid in oids)
                {
                    evt = EPGEvent.LoadByOID(oid);
                    if (evt != null)
                    {
                        ScheduledRecording myRecording = new ScheduledRecording();
                        {
                            myRecording = helper.ScheduleRecording(evt, 1, 0, RecordingQuality.QUALITY_BEST, "[TV Shows]");
                            if (myRecording != null)
                            {
                                Logger.Debug(myRecording.OID.ToString() + " Schedule " + evt.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm") + " " + evt.Subtitle);
                            }
                            else
                            {
                                Logger.Debug(evt.OID.ToString() + " Failed   " + evt.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm") + " " + evt.Subtitle);

                            }
                        }

                    }
                }

Martin
cbgifford
Offline

Member

Posts: 189
Threads: 20
Joined: Aug 2014
#7
2014-12-19, 02:25 AM
sub Wrote:You should be able to do it though, including from VB.NET. I can't help you with the exact syntax though - it's been a long time since I did any VB. You'd need to add a reference to NShared.dll and NUtility.dll though. If you're already looking at the data in the database, you can probably use EPGEvent.LoadByOID(x) to get the EPGEvent object to pass into the ScheduleRecording() call.

Code:
If My.Settings.NConnection = "" Or Command() = "/C" Then
            frmInteractive.ShowDialog()
        End If
        Dim t As DataTable
        t = LoadEPG("SELECT * FROM EPG_EVENT WHERE season = 1 and episode=1 AND first_run='Y'")
        For X As Integer = 0 To t.Rows.Count - 1
            NUtility.ScheduleHelperFactory.GetScheduleHelper.ScheduleRecording(NUtility.EPGEvent.LoadByOID(t.Rows(X).Item("OID"), RecordingQuality.QUALITY_DEFAULT)
        Next
        MsgBox("Total Rows = " & t.Rows.Count)

You've made me slightly dangerous with a little knowledge, thank you SIR!
Chris


Server - Intel Core I3-3210 @ 3.40GHz - 8 GB RAM - Windows 10.0 Pro - Total Storage - 5.4 TB
Two Silicondust HD Prime CC capture, 6 tuners total
Client - Intel Core I3-3210 @3.2GHz - 4GB Ram - Windows 7.0 Pro
Client - Intel Core I3-3210 @2.9GHz - 4GB Ram - Windows 10.0 Pro
NAS - Intel Core I3-3220T @ 2.8GHz - 4GB RAM - Windows 10.0 Pro (Total Storage - 25 TB)


sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#8
2014-12-19, 02:27 AM
Martin's code reminds me, since this is an external utility, not a plugin, you'll probably need something like he has at the top of his code:

Code:
if (ScheduleHelperFactory.GetScheduleHelper() == null)
                {
                    RecordingServiceProxy.ForceRemote();
                    ScheduleHelperFactory.SetScheduleHelper(RecordingServiceProxy.GetInstance());
                    PluginRegistry.GetInstance().LoadPlugins();
                }
cbgifford
Offline

Member

Posts: 189
Threads: 20
Joined: Aug 2014
#9
2014-12-19, 02:33 AM
I got the below error when I tried to execute the code, the inner exception is file not found. I am running the development system on a client and added the references via a UNC path. I am assuming that I need to install NPVR on the client and run multiple configs when I am either watching TV or developing or is there a way around that?

System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'NUtility.DatabaseHelper' threw an exception.
Source=NUtility
TypeName=NUtility.DatabaseHelper
StackTrace:
at NUtility.DatabaseHelper.GetInstance()
at NUtility.EPGEvent.LoadByOID(Int32 oid)
at NScheduler.modMain.Main() in C:\Users\Chris\Documents\Visual Studio 2013\Projects\NScheduler\modMain.vb:line 108
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.FileNotFoundException
FileName=System.Data.SQLite, Version=1.0.85.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
FusionLog==== Pre-bind state information ===
LOG: DisplayName = System.Data.SQLite, Version=1.0.85.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
(Fully-specified)
LOG: Appbase = file:///C:/Users/Chris/Documents/Visual Studio 2013/Projects/NScheduler/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : NUtility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Chris\Documents\Visual Studio 2013\Projects\NScheduler\bin\Debug\NScheduler.vshost.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Data.SQLite, Version=1.0.85.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

HResult=-2147024894
Message=Could not load file or assembly 'System.Data.SQLite, Version=1.0.85.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The system cannot find the file specified.
Source=NUtility
StackTrace:
at NUtility.DatabaseHelper..ctor()
at NUtility.DatabaseHelper..cctor()
InnerException:
Chris


Server - Intel Core I3-3210 @ 3.40GHz - 8 GB RAM - Windows 10.0 Pro - Total Storage - 5.4 TB
Two Silicondust HD Prime CC capture, 6 tuners total
Client - Intel Core I3-3210 @3.2GHz - 4GB Ram - Windows 7.0 Pro
Client - Intel Core I3-3210 @2.9GHz - 4GB Ram - Windows 10.0 Pro
NAS - Intel Core I3-3220T @ 2.8GHz - 4GB RAM - Windows 10.0 Pro (Total Storage - 25 TB)


sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#10
2014-12-19, 02:40 AM
You'll need to make your executable as x86, since it references DLLs that depend on some 32 bit components.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Custom recording tomx 2 398 2025-02-07, 09:14 AM
Last Post: tomx
  API call for Recording Complete linustorvalds 1 273 2025-01-19, 02:11 PM
Last Post: mvallevand
  Manual recording API mvallevand 2 909 2023-11-09, 02:14 PM
Last Post: mvallevand
  Recording direct to GPhotos API rgonzalez 0 1,394 2020-06-29, 04:45 AM
Last Post: rgonzalez
  Recurring Recording URL Parameters jcole998 2 2,880 2019-09-19, 01:08 PM
Last Post: jcole998
  Get recording length from stream skogl 46 13,415 2019-08-15, 09:34 PM
Last Post: sub
  XMLTV Channel Number Option gdogg371 12 6,590 2018-07-18, 04:32 PM
Last Post: sub
  Unexpected result when deleting a pending recording scJohn 5 3,630 2018-05-06, 10:09 PM
Last Post: sub
  How to best verify success when adding a recurring recording drmargarit 1 2,723 2017-03-02, 03:13 PM
Last Post: mvallevand
  Update Season and Episode from EPG_EVENT puck64 0 2,772 2015-08-31, 07:37 AM
Last Post: puck64

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode