MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Main Features (talk, share your ideas, get support) » Watch / Listen Media » MyTV - Engine 0.2 » Tips and Tricks


Tips and Tricks Post your Tips and Tricks in here.

Reply
 
LinkBack Thread Tools Display Modes
Old 2006-11-02, 00:01   #1 (permalink)
Portal Member
 
Join Date: Jul 2006
Location: UK
Posts: 255
Thanks: 0
Thanked 4 Times in 3 Posts

My System

Default HowTo Convert Mp MyVideos Database to Ant format for MyFilms

If you wanna convert the database used for MediaPortal's MyVideos into an Ant.xml file so you can use it in MyFilms here's an sql script I wrote to do it. If Source is released for MyFilms I'll add an import utility to convert direct to ant.xml without needing to run Ant Import . Thought I'd post it as it may be useful to anyone with a large MyVideos DB who wants to try something else out, or use Ant. You'll need to install Ant Movie Catalog (freeware) and I like to use TextPad to edit text.

-------

1. Make a copy of your VideoDatabaseV5.db3 file open it up in SQLiteBrowser.exe (in ..mediaportal\Docs)

2. Do 'File|Import database from SQL File', select mp_to_ant.sql (below) and say no to prompt. A large DB may take a few minutes to convert so be patient, it will say 'Import completed' when it's done.

3. Export Ant table from SQLite as ant.csv

4. Run Ant do File|Import, select csv file type, set delimiter = , (that's a comma) and load up ant.csv.

5. untick the first row (containing the column names). Assign the SAME named column id's to each column (IGNORING idMovie it is not required!) by selecting in drop down then clicking on column, then click Import. You will be prompted what to do with images you MUST select 'Link'

6. When import has finished save to C:\Program Files\MediaPortal\Thumbs\videos\Title\ant.xml setting type as xml, then close Ant.

7. You now need to open the ant.xml file in a text editor (I use Textpad) and search/replace to strip out the nonsense Ant Import puts in for the picture files entry leaving just the filename (no path), it's at the end of each xml string. For me it was (d:\ant\%#34;)=() And (.jpg%#34;)=(.jpg), again be careful to specify a long enough search string that won't affect anything else. If you don't use movie covers you won't need to do this.

8. Now in MP Config|Plugins|MyFilms select ant.xml, set picture path to your C:\Program Files\MediaPortal\Thumbs\videos\Title\ folder, storage file info = Source, ant id item = media label. Save and exit.

Most recent version of MyFilms (v2.3) now works with MediaPortal v0.2.1.0. You can also import the ant.xml into MyDVD's though with my large db it took forever to load and didn't parse the comma seperated actor or genre fields so was abandoned. Once you're using ant to organise your movies you'll never look back, there are scripts to automate grabbing info from many different web sites. The mp_to_ant.sql is attached to this post and also listed below


mp_to_ant.sql
Code:
CREATE TABLE Ant (
idMovie  integer,
MediaLabel text, 
MediaType text,
Source text,
Rating integer, 
OriginalTitle text, 
Director text,
Category text, 
Year integer, 
Length integer, 
Actors text, 
URL text, 
Description text,
Picture text);

INSERT INTO Ant Select 
movie.idMovie,
movie.discid,
'', 
path.strPath || files.strFilename, 
movieinfo.fRating, 
movieinfo.strTitle, 
actors.strActor,
'', 
movieinfo.iYear, 
movieinfo.runtime, 
'', 
'http://imdb.com/title/' || movieinfo.IMDBID, 
movieinfo.strPlot, 
movieinfo.strTitle || 'L.jpg' 
From movie,movieinfo,path,files,actors 
WHERE movieinfo.idMovie = movie.idMovie and 
files.idMovie = movie.idMovie and 
path.idPath = movie.idPath and 
files.idMovie = movie.idMovie and 
actors.idActor = movieinfo.idDirector;


CREATE TABLE tmpActor (idMovie,strActor text);

CREATE TRIGGER insert_ant_actor INSERT ON tmpActor 
  BEGIN
    UPDATE Ant SET Actors = Actors || new.strActor || ',' WHERE Ant.idMovie = new.idMovie;
  END;

INSERT INTO tmpActor 
SELECT actorlinkmovie.idMovie,actors.strActor FROM actorlinkmovie
JOIN actors ON actorlinkmovie.idActor = actors.idActor;


CREATE TABLE tmpGenre (idMovie, strGenre text);

CREATE TRIGGER insert_ant_genre INSERT ON tmpGenre 
  BEGIN
    UPDATE Ant SET Category = Category || new.strGenre || ',' WHERE Ant.idMovie = new.idMovie;
  END;

INSERT INTO tmpGenre 
SELECT genrelinkmovie.idMovie,genre.strGenre FROM genrelinkmovie
JOIN genre ON genrelinkmovie.idGenre = genre.idGenre;


UPDATE ANT SET Category = (SUBSTR(Category,1,LENGTH(Category)-1)); 
UPDATE ANT SET Actors = (SUBSTR(Actors,1,LENGTH(Actors)-1)); 


DROP TRIGGER insert_ant_actor;
DROP TABLE tmpActor;
DROP TRIGGER insert_ant_genre;
DROP TABLE tmpGenre;


UPDATE Ant Set MediaType = "REAL" WHERE LOWER(SUBSTR(Source,LENGTH(source)-2,3)) = '.rm';
UPDATE Ant Set MediaType = "ASF" WHERE LOWER(SUBSTR(Source,LENGTH(source)-2,3)) = 'asf';
UPDATE Ant Set MediaType = "DIVX" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'avi';
UPDATE Ant Set MediaType = "DVD" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'ifo';
UPDATE Ant Set MediaType = "MKV" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'mkv';
UPDATE Ant Set MediaType = "MOV" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'mov';
UPDATE Ant Set MediaType = "MPEG4" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'mp4';
UPDATE Ant Set MediaType = "MPEG" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'mpg';
UPDATE Ant Set MediaType = "OGG" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'ogm';
UPDATE Ant Set MediaType = "MPEG" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'peg';
UPDATE Ant Set MediaType = "WMV" WHERE SUBSTR(Source,LENGTH(source)-2,3) = 'wmv';

Last edited by HappyTalk; 2006-12-07 at 10:55. Reason: v2.3 of MyFilms now works with MP v0.2.1.0
HappyTalk is offline   Reply With Quote
Reply

Bookmarks

Tags
ant, convert, database, format, howto, myfilms, myvideo

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
HowTo Improve Movie & Music database speed 1,000 times HappyTalk Tips and Tricks 11 2008-01-02 18:59
(original thread) US/Canadian/Mexico EPG Zap2it Plugin Released bradsjm zap2it (discontinued) 513 2007-02-21 14:07
Help with TVServer and client rick78 Get Support 8 2006-12-12 18:48
0.2.1 and latest svn MyPictures thumbnails broken gloomyandy Codecs, External Players 1 2006-10-24 10:01
RC2 causes laptop to hibernate every 5 mins ms2005 MediaPortal 1 Talk 6 2005-12-19 14:26


All times are GMT +1. The time now is 06:17.


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