NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 18 19 20 21 22 … 93 Next »
NPVR Database connection

 
  • 0 Vote(s) - 0 Average
NPVR Database connection
ralphy
Offline

Senior Member

Posts: 255
Threads: 51
Joined: Nov 2006
#1
2010-09-14, 07:54 AM
My limited knowledge has me stumped...

What the equivalent NPVR code for this GBPVR code? I've tried various combinations of the methods available in the DatabaseHelperFactory but no joy to date:confused:

Code:
SQLiteConnection connection;
connection = (SQLiteConnection)DatabaseHelperFactory.getDbProviderFactory().CreateConnection();
connection.ConnectionString=GBPVRInfo.GBPVRDBConnectionString;
connection.Open();

SQLiteCommand command = connection.CreateCommand();
command.CommandText="select * from CHANNEL";
sqlite_datareader=command.ExecuteReader();

connection.Close();

Is the ConnectionString = "Data Source=\""+NUtility.SettingsHelper.GetInstance().GetDataDirectory()+"npvr.db3\";Version=3;";
[SIZE="1"]Silverstone GD01S-MXR (three dead rows of pixels in the LCD and defective remote control), Power: Zalman ZM460B-APS (blew up - can't remember what's there now); CPU: Pentium D 3.2 GHz with Asus V72 Cooler; MD: Asus P5LD2 Deluxe 2048MB,
WDC WD10EADS 1TB Data, 320GB System, Asus EN9400GT Silent 512MB, Hauppauge HVR 1300,
XP Home SP3, GB-PVR 2.0, ExternalDisplay v0.3[/SIZE]
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,766
Threads: 954
Joined: May 2006
#2
2010-09-14, 11:30 AM (This post was last modified: 2010-09-14, 11:53 AM by mvallevand.)
I use
Code:
string clientMode = SettingsHelper.GetInstance().GetSettingsNode("//Recording/ClientMode").InnerText;
        string dbLocation = null;
        if (clientMode != "true")
        {
                dbLocation = SettingsHelper.GetInstance().GetDataDirectory();
        }
        else
        {
                dbLocation = SettingsHelper.GetInstance().GetSettingsNode("//Recording/DatabaseShare").InnerText.TrimEnd('\\') + "\\";
        }
        dbCon.ConnectionString = "Data Source=\"" + dbLocation + "npvr.db3\";Version=3;New=True;";
Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#3
2010-09-14, 04:33 PM
Code:
DatabaseHelper databaseHelper = DatabaseHelper.GetInstance();
            DbConnection connection = databaseHelper.GetConnection();
            DbCommand command = databaseHelper.CreateCommand(connection, query);
            
            DbDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                     ....
            }

            databaseHelper.FreeConnection(connection);

...but if you really just want the list of channels, then I'd do this:

Code:
List<Channel> channels = Channel.LoadAll()
ralphy
Offline

Senior Member

Posts: 255
Threads: 51
Joined: Nov 2006
#4
2010-09-15, 12:01 AM
Thanks for your help guys.

sub Wrote:...but if you really just want the list of channels, then I'd do this:

Code:
List<Channel> channels = Channel.LoadAll()

Actually, I want to find out the details of the of the playing recording, or the liveTV (ie title, description, channel number, channel name etc). I have been doing this by receiving the filename from an eventnotification and querying the database. Are there any methods to do this other than using an SQL query?
[SIZE="1"]Silverstone GD01S-MXR (three dead rows of pixels in the LCD and defective remote control), Power: Zalman ZM460B-APS (blew up - can't remember what's there now); CPU: Pentium D 3.2 GHz with Asus V72 Cooler; MD: Asus P5LD2 Deluxe 2048MB,
WDC WD10EADS 1TB Data, 320GB System, Asus EN9400GT Silent 512MB, Hauppauge HVR 1300,
XP Home SP3, GB-PVR 2.0, ExternalDisplay v0.3[/SIZE]
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#5
2010-09-15, 12:09 AM
You can get the list of channels with:
List<Channel> channels = Channel.LoadAll()

You can get the list of recordings with:
List<ScheduledRecording> records = ScheduledRecording.LoadAll()

There isnt really methods to directly get ScheduledRecording from the information you see in the events, but you could load all, and look for the ScheduledRecording with the filename reported in the event.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Way to tell programmatically if channel load in from NPVR has finished... gdogg371 3 2,319 2021-03-11, 03:59 PM
Last Post: mvallevand
  Plugins and NPVR. Where do we start? sub 80 68,060 2020-11-26, 10:02 PM
Last Post: mandai
  Test/Development environment for npvr.db3 scJohn 10 4,171 2020-09-04, 09:14 PM
Last Post: scJohn
  How to extract M3U8 and get matching XMLTV guide data from NPVR almightyj 0 3,346 2018-10-23, 07:24 AM
Last Post: almightyj
  ios app to control npvr ui idea jnbooker15 4 3,554 2015-09-21, 10:19 PM
Last Post: sub
  ios app to control npvr ui idea jnbooker15 0 2,431 2015-09-21, 06:39 PM
Last Post: jnbooker15
  Couple of questions about hacking npvr.db3 drmargarit 6 4,206 2014-09-08, 02:22 AM
Last Post: sub
  Delete recordings from database but not from disk? spinnaker 8 3,744 2013-10-26, 10:51 PM
Last Post: spinnaker
  high res (256x256+) npvr icon? reven 15 5,761 2013-09-01, 05:13 AM
Last Post: psycik
  trying to fake npvr database for unit tests reven 3 2,233 2013-05-20, 08:53 AM
Last Post: reven

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

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

Linear Mode
Threaded Mode