| |||||||
| Plugins Plugins developed and maintained by users. Want to create your own plugin? Start a thread in here. |
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Portal Member Join Date: Dec 2004 Location: Germany
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
| Hi, I'm trying to program a plugin for MP in VB .NET. I added all of the .dlls of the MP directory. My SourceCode is like this: Dim recordings As New ArrayList Dim recording As New MediaPortal.TV.Database.TVRecording MediaPortal.TV.Database.TVDatabase.GetRecordings(r ecordings) Now I get inside sqlclient.dll this error: System.DllNotFoundException (sqlite.dll) Does anybody know what the issue is?
__________________ HTPC: P3-S 1133@1133@1,1V passiv ASUS TUSL2-M Skystar 2 Creative Soundblaster nVidia FX5200 120G Samsung SV1204 Toshiba SD-M1712 (Silent Firmware) -------------------------------------------- PVR Scheduler with MediaPortal Plugin http://www.pvr-scheduler.de |
| | |
| | #3 (permalink) |
| Portal Member Join Date: Dec 2004 Location: Germany
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
| Actually it is more like an external program (PVR Scheduler). I added all the references and put sqlite.dll into my /bin directory of my project. The other .dll like core.dll, SQLiteClient.dll ... were put automatically into my /bin folder, when I compiled it. The only strange thing is that it also creates into /bin a log and a empty database folder? In the log folder there is the mediaportal.log file: 15.12.2004 21:29:39 opening tvdatabase 15.12.2004 21:29:39 TVDatabase exception err ie DLL (sqlite.dll) kann nicht geladen werden. stack: at SQLite.NET.SQLiteClient.sqlite_open(String filename, Int32 mode, String& errmsg)at SQLite.NET.SQLiteClient..ctor(String dbName) at MediaPortal.TV.Database.TVDatabase..cctor() 15.12.2004 21:29:39 tvdatabase opened
__________________ HTPC: P3-S 1133@1133@1,1V passiv ASUS TUSL2-M Skystar 2 Creative Soundblaster nVidia FX5200 120G Samsung SV1204 Toshiba SD-M1712 (Silent Firmware) -------------------------------------------- PVR Scheduler with MediaPortal Plugin http://www.pvr-scheduler.de |
| | |
| | #5 (permalink) |
| Portal Member Join Date: Dec 2004 Location: Germany
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
| I also tried that, but it doesn't solve the issue. ![]()
__________________ HTPC: P3-S 1133@1133@1,1V passiv ASUS TUSL2-M Skystar 2 Creative Soundblaster nVidia FX5200 120G Samsung SV1204 Toshiba SD-M1712 (Silent Firmware) -------------------------------------------- PVR Scheduler with MediaPortal Plugin http://www.pvr-scheduler.de |
| | |
| | #6 (permalink) |
| Portal Member Join Date: Dec 2004 Location: Germany
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
| OK. I know now what it doesn't work: Code: private TVDatabase()
{
}
/// <summary>
/// static constructor. Opens or creates the tv database from database\TVDatabaseV6.db
/// </summary>
static TVDatabase()
{
lock (typeof(TVDatabase))
{
try
{
// Open database
Log.Write("opening tvdatabase");
System.IO.Directory.CreateDirectory("database");
//Upgrade();
m_db = new SQLiteClient(@"database\TVDatabaseV9.db");
CreateTables();
if (m_db!=null)
{
m_db.Execute("PRAGMA cache_size=8192\n");
m_db.Execute("PRAGMA synchronous='OFF'\n");
m_db.Execute("PRAGMA count_changes='OFF'\n");
}
}
catch (Exception ex)
{
Log.Write("TVDatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace);
}
Log.Write("tvdatabase opened");
}
}
Code: static public bool GetRecordings(ref ArrayList recordings)
{
lock (typeof(TVDatabase))
{
recordings.Clear();
try
{
if (null==m_db) return false;
string strSQL;
strSQL=String.Format("select * from channel,recording where recording.idChannel=channel.idChannel order by iStartTime");
SQLiteResultSet results;
results=m_db.Execute(strSQL);
if (results.Rows.Count== 0) return false;
for (int i=0; i < results.Rows.Count;++i)
{
long iStart=Int64.Parse(Get(results,i,"recording.iStartTime"));
long iEnd=Int64.Parse(Get(results,i,"recording.iEndTime"));
TVRecording rec=new TVRecording ();
rec.Channel=Get(results,i,"channel.strChannel");
rec.Start=iStart;
rec.End=iEnd;
rec.Canceled = Int64.Parse(Get(results,i,"recording.iCancelTime"));
rec.ID=Int32.Parse(Get(results,i,"recording.idRecording"));
rec.Title=Get(results,i,"recording.strProgram");
rec.RecType=(TVRecording.RecordingType)Int32.Parse(Get(results,i,"recording.iRecordingType"));
int iContectRec=Int32.Parse(Get(results,i,"recording.bContentRecording"));
if (iContectRec==1) rec.IsContentRecording=true;
else rec.IsContentRecording=false;
recordings.Add(rec);
}
return true;
}
catch(SQLiteException ex)
{
Log.Write("TVDatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace);
}
return false;
}
}
Should be like: Dim tvb As New MediaPortal.TV.Database.TVDatabase TVDatabase is private!! But I have to insanciate m_db, in order to get it work. Either @frodo can change this or I have to program my own SQLite subroutines, but then I don't know if MP supports multi user access. @frodo Can you please give me a hint! Thanks!!
__________________ HTPC: P3-S 1133@1133@1,1V passiv ASUS TUSL2-M Skystar 2 Creative Soundblaster nVidia FX5200 120G Samsung SV1204 Toshiba SD-M1712 (Silent Firmware) -------------------------------------------- PVR Scheduler with MediaPortal Plugin http://www.pvr-scheduler.de |
| | |
| | #7 (permalink) |
| Portal Member Join Date: Aug 2004 Location: Melbourne, Australia
Posts: 773
Thanks: 0
Thanked 0 Times in 0 Posts
| Nope, you can use it without any changes. The keyword is static. In VB.NET lingo, this translates to shared. Therefore, this class cannot be and doesn't need to be instantiated because there can only ever be one instance of it - its singleton. To access the methods, simply go MediaPortal.TV.Database.TVDatabase.AddRecording or whatever. Keep in mind that the method can only ever be accessed by one call at a time, shown by the lock (typeof(TVDatabase)) statement. So if MP happens to be using the TVdatabase, then your plugin will have to wait until MP finishes before you can use it. The database itself however does allow multiple user access, so if you want to can connect directly to the database file. BTW, if you do choose this way and you want to use ADO.NET work SQLite, there is a dll that lets you do this. See http://sourceforge.net/projects/adodotnetsqlite. Sam |
| | |
| | #8 (permalink) |
| Portal Member Join Date: Dec 2004 Location: Germany
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
| Thank you for the information. But I can't simple access the methods like this: Dim recordings As New ArrayList Dim recording As New MediaPortal.TV.Database.TVRecording MediaPortal.TV.Database.TVDatabase.GetRecordings(r ecordings) Do you know the issue? I already know http://sourceforge.net/projects/adodotnetsqlite and this is what I wanted to use when I don't get access to the MP methods Anyway I think that MP uses these libraries: http://www.phpguru.org/static/SQLite.NET.html But I don't know if these libs also work in VB .NET
__________________ HTPC: P3-S 1133@1133@1,1V passiv ASUS TUSL2-M Skystar 2 Creative Soundblaster nVidia FX5200 120G Samsung SV1204 Toshiba SD-M1712 (Silent Firmware) -------------------------------------------- PVR Scheduler with MediaPortal Plugin http://www.pvr-scheduler.de |
| | |
| | #9 (permalink) |
| Portal Member Join Date: Aug 2004 Location: Melbourne, Australia
Posts: 773
Thanks: 0
Thanked 0 Times in 0 Posts
| What happens when you use that code? Keep in mind that if you want to access the recording objects in the arraylist, you have to convert the type, e.g. Code: Dim recordings As New ArrayList MediaPortal.TV.Database.TVDatabase.GetRecordings(recordings) Dim recording As MediaPortal.TV.Database.TVRecording recording = cType(recordings(0), MediaPortal.TV.Database.TVRecording) recording.Title or whatever... |
| | |
| | #10 (permalink) |
| Portal Member Join Date: Dec 2004 Location: Germany
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
| This doesn't work. I already get an false return value of MediaPortal.TV.Database.TVDatabase.GetRecordings(r ecordings) ! MessageBox.Show(MediaPortal.TV.Database.TVDatabase .GetRecordings(recordings))
__________________ HTPC: P3-S 1133@1133@1,1V passiv ASUS TUSL2-M Skystar 2 Creative Soundblaster nVidia FX5200 120G Samsung SV1204 Toshiba SD-M1712 (Silent Firmware) -------------------------------------------- PVR Scheduler with MediaPortal Plugin http://www.pvr-scheduler.de |
| | |
![]() |
| Bookmarks |
| Tags |
| net, plugin, sqlitedll |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with TVServer and client | rick78 | Get Support | 8 | 2006-12-12 19:48 |
| MP freezes at full screen, and sound fading out.. | Gunsmoke | General Support | 6 | 2006-08-16 19:43 |
| Why is my WebEPG doing this? | TheMerovingian | WebEPG | 13 | 2006-07-10 21:59 |
| .Net Error with OS "Windows Xp Lite" | Knossos | Installation, configuration support | 2 | 2006-05-02 02:29 |
| Help with Compilation Errors from CVS | MadAxeMan | General Development (no feature request here!) | 8 | 2005-02-08 22:45 |