NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 81 82 83 84 85 … 93 Next »
help with databases

 
  • 0 Vote(s) - 0 Average
help with databases
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#1
2004-12-24, 12:54 AM
can anyone help me out with a database class. the only thing ive really done with databases in the past was one assignment for uni which was done in java a year ago. and i dont want to code it wrong so king argyle and others have to use access or whatever. so if anyone can write me a class (give you full credit etc) which i pass a video file name, and see if its located in the recordings database, and then returns (via out variables or property methods, or however you feel it would work best) the description, data recorded etc.

i want to add these to "my videos" but i have no idea how to.

i think the helper dll was going to have something like this in it, but i have no idea how far that has come.

thanks.
merry xmas and all that Tongue

now i am going to get some last minute shopping done (got birthday money so i can go and buy xmas presents now, i never get to spend that money on myself, birthdays at xmas suck! Tongue)
jorm
Offline

Posting Freak

Posts: 2,014
Threads: 109
Joined: Aug 2004
#2
2004-12-24, 01:26 AM
Why dont you just iterate through the recordings using the gbpvr dlls there is a class that gives you the recordings and check the filenames. You can then get the programme object.

If you really want to use the database let me know and I will write you a quick method.
WinXP Home
3 X MVPs
Hauppauge 250 MCE
Hauppauge 150
P-4 2.4 GHz / 768 megs Ram
610 Gigs Of Media Storage
Guest

Unregistered
 
#3
2004-12-24, 01:51 AM
I used to have a method that did just this in the original release of the Video Archive plug-in. It may still be in the old source posted on the GBPVR plug-in downloads page. In the new version I cache the recordings collection and fetch them from there as Jorm suggested. It uses more memory but at least it is database independent.

Jeff
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#4
2004-12-24, 04:55 AM
Reven, as the others have said, you can get the vast majority of the information you need from the ScheduledRecording and ScheduleHelper classes. If you use these classes, you'll be pretty much database friendly regardless of the database in use.

Also, if you query the database yourself, then just pull the Database connection string from the Config.xml. And that will connect you to the appropriate database whether it be Access or MSDE. If you are doing basic queries against the database you should be fine. The only point you'll come into potential clashes is if you start to use Functions in your SQL. The main one that causes problem is use of the Now() function in Access SQL. The equivalant for MSDE/Sql Server is getdate().

For what you are looking for, you should be able to use the two classes I mentioned earlier, and it'll be fine.

I have a couple of helper classes I'm working, but they aren't ready for release yet. Should be out with my first cut at the priority scheduling program.



reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#5
2004-12-24, 06:07 AM
thanks for the response, i was unaware of the scheduledrecording classes, i have a look into them later on.
ill post if i have any problems.

merry xmas everyone.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#6
2004-12-24, 07:30 AM
ok ive played around a little, and this seems to be quite quick
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if(ScheduledRecordings != null)
{
foreach (ScheduledRecording scheduledRecording in ScheduledRecordings)
{
if(fullName == scheduledRecording.getFileName())
{
Description = scheduledRecording.getProgramme().getDescription();
if(scheduledRecording.getProgramme().getSubTitle().Length > 0)
fileName = scheduledRecording.getProgramme().getSubTitle();
break;
}
}
}
[/QUOTE]
ScheduledRecordings is static IList i set when &quot;My Videos&quot; is activated, (its in a FileDetails class, full of fun facts about files Tongue well size,sort methods,blah blah blah.)
sure iterating thru each and every recording searching for the right one isnt the quickest way of doing something; so if anyone knows a smarter/better way of doing this, please say so. but if not, ill stick with this, it seems to work. just got to play around and check for exceptions and stuff (and have to decide if i want the imdb.com data to override this, you know logic question. pretty boring stuff.)

i just hope that getSubTitle isnt nullable (i first tried the test if getSubtitle() != null, but that didnt work.) ill run loads of tests etc, i doubt ill have this out until after xmas (well since its 8.32pm xmas eve here, so yeah i doubt it Tongue).
jorm
Offline

Posting Freak

Posts: 2,014
Threads: 109
Joined: Aug 2004
#7
2004-12-24, 02:40 PM
One problem I see is that a programme can be null.  So when you call getProgramme check to make sure it is not null.  It would be null if you did a manual recording and your code should handle it at least.

I do not believe that a subtitle is ever null.  It might just be an empty string which is fine.

If you wanted this logic to run faster not reallly necessary but may be noticable if you have a lot of recordings you can use a Hashtable instead of an IList.  Then you hash based on the filename makes the lookup logrithmic instead of sequential.



WinXP Home
3 X MVPs
Hauppauge 250 MCE
Hauppauge 150
P-4 2.4 GHz / 768 megs Ram
610 Gigs Of Media Storage
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#8
2004-12-25, 12:12 AM
yeah i was thinking about the for loop, which wouldnt take that long, the maximum amount of recordings would most likely be about 100 which wouldnt take long at all, even with 1000 recordings going thru them all wouldnt take long, so its not a really biggy. ill add code to make sure the program isnt null (was unaware of that), thanks jorm.

well its xmas day, so merry xmas everyone.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  creating a trigger in access .mdb databases? reven 7 5,601 2005-10-07, 04:23 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