MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Community Skins and Plugins » Plugins


Plugins Plugins developed and maintained by users. Want to create your own plugin? Start a thread in here.

Reply
 
LinkBack Thread Tools Display Modes
Old 2005-01-08, 08:54   #1 (permalink)
Portal Member
 
Join Date: Jul 2004
Posts: 380
Thanks: 0
Thanked 2 Times in 2 Posts


Default help wanted

Hi
I need some help with my plugin. Somebody wants to help me out?

1/ How do I CLEAR a database? I want to delete all the records, but I can't delete the file itself because MP is locking it.

2/ How do I refresh a view in MP. Example. the skin shows a database content, and the user presses refresh to load a new file in the database. How do I make that new information show up on the screen. Is there a function in MP to RELOAD the screen?


Thanks in advance

//Lasse
__________________
----------------------------------------
MCE 2005
Twinhan 3040 DVB-T + CI + Cam---Boxer
ATI Radeon 9800 Pro 128Mb
SoundMax 1950
1Gb Ram
-----------------------------------------
lar282 is offline   Reply With Quote
Old 2005-01-08, 11:55   #2 (permalink)
Portal Member
 
Join Date: Aug 2004
Location: Melbourne, Australia
Posts: 773
Thanks: 0
Thanked 0 Times in 0 Posts


Default Re: help wanted

Quote:
Originally Posted by lar282
Hi
I need some help with my plugin. Somebody wants to help me out?

1/ How do I CLEAR a database? I want to delete all the records, but I can't delete the file itself because MP is locking it.

2/ How do I refresh a view in MP. Example. the skin shows a database content, and the user presses refresh to load a new file in the database. How do I make that new information show up on the screen. Is there a function in MP to RELOAD the screen?


Thanks in advance

//Lasse
To clear the database, simply use this SQL for each table in the database:
Code:
 DELETE FROM <table name>
For example,
Code:
 DELETE FROM programs
to delete all the tv programs in TVDatabase.

To make MP reload the screen, it depends on what screen, but for most screens with a list in it, just call the LoadDirectory("") method (check to see if it exists - I know it works for the music module).

Sam
samuel337 is offline   Reply With Quote
Old 2005-01-08, 12:29   #3 (permalink)
Portal Member
 
Join Date: Jul 2004
Posts: 380
Thanks: 0
Thanked 2 Times in 2 Posts


Default Thank u very very much

Thank u very very much


//Lasse
__________________
----------------------------------------
MCE 2005
Twinhan 3040 DVB-T + CI + Cam---Boxer
ATI Radeon 9800 Pro 128Mb
SoundMax 1950
1Gb Ram
-----------------------------------------
lar282 is offline   Reply With Quote
Old 2005-01-08, 13:19   #4 (permalink)
Portal Member
 
Join Date: Jul 2004
Posts: 380
Thanks: 0
Thanked 2 Times in 2 Posts


Default still to dumb

So if I wanted to delete all records in the table DVD, should it look like this

DVD_DB myDVD_db=null;
// Open Database
myDVD_db = new DVD_DB();
myDVD_db.Execute DELETE FROM dvd


Well I know it should look like that since I get a expexted ; here and there, but I can't figure it out. Can u help me some more, please


//Lasse
__________________
----------------------------------------
MCE 2005
Twinhan 3040 DVB-T + CI + Cam---Boxer
ATI Radeon 9800 Pro 128Mb
SoundMax 1950
1Gb Ram
-----------------------------------------
lar282 is offline   Reply With Quote
Old 2005-01-08, 13:44   #5 (permalink)
Portal Member
 
Join Date: Aug 2004
Location: Melbourne, Australia
Posts: 773
Thanks: 0
Thanked 0 Times in 0 Posts


Default Re: still to dumb

Quote:
Originally Posted by lar282
So if I wanted to delete all records in the table DVD, should it look like this

DVD_DB myDVD_db=null;
// Open Database
myDVD_db = new DVD_DB();
myDVD_db.Execute DELETE FROM dvd


Well I know it should look like that since I get a expexted ; here and there, but I can't figure it out. Can u help me some more, please


//Lasse
Well first off, there is no DVD database so I'm going to use the video database as an example.

Another thing, in MP you can't use the existing code to clear the database (i.e. reference Databases.dll and use the functions in there) because there is no function to clear the database and you can't access the database variable directly (its not public). So you will need your own code to open the database connection:

Code:
function ClearDatabase() 
{
SQLiteClient m_db=null;
 Log.Write("opening video database");
      try 
      {
        // Open database
				try
				{
        System.IO.Directory.CreateDirectory("database");
				}
				catch(Exception){}
				m_db = new SQLiteClient(@"database\videodatabase2.db");
      } 
      catch (Exception ex) 
      {
        Log.Write("videodatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace);
      }
      
      Log.Write("video database opened");

//now for each table, do this, replacing movie with the table name.
m_db.Execute("DELETE FROM movie");

//close and dispose of the database
m_db.Close();
m_db = null;
}
EDIT:
whoops, forgot to tell you that you need to add the following statements at the top of the file:
Code:
using SQLite.NET;
using MediaPortal.Util;
HTH

Sam
samuel337 is offline   Reply With Quote
Old 2005-01-08, 14:00   #6 (permalink)
Portal Member
 
Join Date: Jul 2004
Posts: 380
Thanks: 0
Thanked 2 Times in 2 Posts


Default

thank u .Will give it another try tonite.


//Lasse
__________________
----------------------------------------
MCE 2005
Twinhan 3040 DVB-T + CI + Cam---Boxer
ATI Radeon 9800 Pro 128Mb
SoundMax 1950
1Gb Ram
-----------------------------------------
lar282 is offline   Reply With Quote
Reply

Bookmarks

Tags
wanted

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New version of the MP webinterface! Translators wanted! Maschine Plugins 55 2008-08-07 13:36
dvb-c frequencies wanted for CAIW Netherlands tjeerd Installation, configuration support 5 2007-06-18 10:29
People with DirectX knowledge wanted! frodo General Development (no feature request here!) 17 2006-10-05 20:32
First and new HTPC, comments wanted timppala HTPC Projects 1 2006-08-10 08:23
Help Wanted from Europeans - Hauppauge PVR500 and MCE Remote Brocklander Ongoing HTPC Projects 1 2005-11-22 09:34


All times are GMT +1. The time now is 05:15.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress