2006-03-27, 13:58
hello all!
i made a dll in c# .net to read/write the xbmc's video database (myvideos31.db).
i use it in a tool and it's seems to be stable but if you want to to help me with some suggestions, you're welcome!
this is the xbmcvideodb dll
and code comments
some example of use :
i will not explain how to load a dll, there are a lot of tutorials in the web...
how to load the database
how to get all the files loaded by xbmc
how to fill a listbox with the filenames
how to load the third movie
how to fill movie's information to fields
how to modify some informations
how to save the third movie
enjoy !!!
i made a dll in c# .net to read/write the xbmc's video database (myvideos31.db).
i use it in a tool and it's seems to be stable but if you want to to help me with some suggestions, you're welcome!
this is the xbmcvideodb dll
and code comments
some example of use :
i will not explain how to load a dll, there are a lot of tutorials in the web...
how to load the database
Quote:_myvideos = new xbmcvideodb.myvideos("c:\myvideos31.db");
how to get all the files loaded by xbmc
Quote:_myvideos.loadfiles();
how to fill a listbox with the filenames
Quote:lstfiles.items.clear();
foreach (xbmcvideodb.files files in _myvideos.filescollection.list)
lstfiles.items.add(new listviewitem(new string[] {files.strfilename}));
how to load the third movie
Quote:int id = _myvideos.filescollection[3].idmovie
_myvideos.loadfromidmovie(id);
how to fill movie's information to fields
Quote:txttitle.text = _myvideos.movieinfocollection[0].strtitle;
foreach(xbmcvideodb.actors actor in _myvideos.actorscollection.list)
if (actor.idactor == _myvideos.movieinfocollection[0].iddirector)
txtdirector.text += actor.stractor + " ";
for (int i = 0; i < _myvideos.genrecollection.list.count; i++)
{
if (i > 0) txtgenre.text += ", ";
txtgenre.text += _myvideos.genrecollection[i].strgenre.trim();
}
txtyear.text = _myvideos.movieinfocollection[0].iyear.tostring();
/* the first actor is the director */
for (int i = 1; i < _myvideos.actorscollection.list.count; i++)
{
if (i > 1) txtacteurs.text += ", ";
txtacteurs.text += _myvideos.actorscollection[i].stractor.trim();
}
txtruntime.text = _myvideos.movieinfocollection[0].strruntime;
txtrating.text = _myvideos.movieinfocollection[0].frating;
how to modify some informations
Quote:_myvideos.movieinfocollection[0].iyear = 1998;
how to save the third movie
Quote:_myvideos.movieinfocollection.save(3);
enjoy !!!