Personal Video Database

English => Development => Scripts and Templates => Topic started by: deazo on September 09, 2009, 11:34:58 am

Title: Export to XBMC
Post by: deazo on September 09, 2009, 11:34:58 am
  Hi Nostra Rick and all,

 I have now finally built my HTPC and I am copying over HDD all my burned avi's.
 Parallel to that I would like to find the best way to use XBMC to view PVD's info in their beautiful interface.
 My question you guessed it again is about the transfer process.
 I have read all posts about the subject on PVD's forum as well as XBMC one. And I came to a few conclusions. I'd like you to help me find the best one or if you think of others, to advise. Thanks for your help in advance.
Also before I list my "solutions" I'd like to point that I am clueless and useless at coding and scripting so I am not contemplating writing scripts unless someone tells me it's dead simple of course!

 1. From what I have read, a nice way would be to have PVD create a .nfo file next to each movie file, in the format accepted by XBMC. At the moment I do not think PVD has this feature, and I am not even sure if it can generate .nfo file. For info, the .nfo file structure for xbmc can be found here: http://xbmc.org/wiki/?title=Import_-_Export_Library#Video_nfo_Files (http://xbmc.org/wiki/?title=Import_-_Export_Library#Video_nfo_Files)
Can you tell if such a feature is in the pipeline by any chance, and that it is worth waiting for it to appear in a future update? (really I am not asking for this as I know there are a lot of other things to take care of, but I might be in luck?)

2. In the past I was using Extreme Movie Manager to manage my collection and my subscription to that software is still on, so I can use it. In its last updates, it has the ability to generate .nfo files in the XBMC format. So I'm now considering doing PVD --> EMM --> XBMC... Since I am useless at writing XML templates, I am thinking of finding a way to export in an xml file the following info from PVD (the crucial info I really do not want to loose):
- Original title
- Movie file path
- Posters
- Personal Rating
- IMDB URL (for re-scraping with EMM)
- Allmovie URL (for EMM re-scraping)
Is this feasable? What is the best way to generate such an xml file, readable by EMM ? (I guess I should also ask on EMM's forum)

I really do prefer PVD to EMM's overbusy interface with no interlink between plot keywords, but I also really need to use XBMC so this is the only solutions I came up with. I have also been on XBMC forum but can't find the info I need.
I know this might be asking a lot but if you can I would really appreciate some help!

Thanks
Title: Re: Export to XBMC
Post by: nostra on September 09, 2009, 12:01:26 pm
It is no problem generating such nfo files (actually any text based files) using templates for the export plugin. The files can also be placed near video files automatically.
Just do a search for "export" on this forum and you will get lots of information about creating templates.
Title: Re: Export to XBMC
Post by: deazo on September 09, 2009, 01:37:13 pm

 Thanks for the super fast answer Nostra.
 From what you're saying it should not be super hard to create a script that would do what I need.
 I'm just worried I am not good enough for the task but I'll give it a go.
 Just as a free tip, what should I do to make this script create an .nfo file next to each movie file?
 Thanks.
Title: Re: Export to XBMC
Post by: deazo on September 09, 2009, 02:26:12 pm

 Also, I am wondering about posters:
 I have chosen the posters to be part of the database and not separated.
 When the .nfo file will be generated next to the movie file, is there going to be a kind of "image path" pointing XBMC to the right poster? Considering the poster is "part" of the pvd file, how can it have an image path?
 Please do not laugh if this sounds stupid.. :-\.
Title: Re: Export to XBMC
Post by: rick.ca on September 09, 2009, 10:26:37 pm
Quote
Also before I list my "solutions" I'd like to point that I am clueless and useless at coding and scripting so I am not contemplating writing scripts unless someone tells me it's dead simple of course!

I'm pretty much useless at anything resembling "programming" too. And I don't use XBMC, so I'm not going to attempt to give you specific guidance. From my experience, however, I can tell you the best solution is to export everything to NFO so XBMC can import it (I imagine it does so automatically, if the files are present). At a glance, it seems it's documentation outlines exactly what you need. As nostra says, you don't need a script to create the NFO files—just a plain text export template to define the required format. A sample XML template is provided as a starting point. Although the documentation is rather thin, you can find out what you need to know by searching the forum. Although I don't expect you'll find it easy, the process of editing and troubleshooting an export template is "dead simple." Just edit the template and try an export. It either works or it doesn't. It helps if you're good at compulsive trial and error. ;)

Posters can also be exported "beside" the video file. I expect XBMC will find these and build it's thumbnails from them. I'm not sure, but it may just require a few lines in the same template.

If you share your efforts here, you may find there are other XBMC users who will pitch in to help. Considering how "open" XBMC is, I'm surprised someone hasn't done this already. Even if they have, you'll need to know how to revise your template anyway—so you can handle your custom fields and personal preferences.
Title: Re: Export to XBMC
Post by: deazo on September 09, 2009, 11:15:20 pm
OK thanks I guess I'll start this new project, I really would rather use PVD only than having to go through EMM.
For anyone reading and expecting me to be at it very quick, please bear with me, time is hard to find...
Title: Re: Export to XBMC
Post by: nostra on September 09, 2009, 11:21:18 pm
You could also get in touch with CAD (http://www.videodb.info/forum_en/index.php?topic=1461.0) and oska85 (http://www.videodb.info/forum_en/index.php?topic=1017.0). They seem to be writing a template for XBMC as well...
Title: Re: Export to XBMC
Post by: rick.ca on September 10, 2009, 12:30:38 am
Quote
You could also get in touch with CAD...

See "imagepath" statement (http://www.videodb.info/forum_en/index.php?topic=1453.0) as well.  I forgot about these topics. After getting a lot of help here, it seems CAD forgot to post his finished template.  :o  ;)

I'm sure it would be very helpful to deazo. From the questions he asked, it seems the required template is not as straightforward as I assumed it might be.
Title: Re: Export to XBMC
Post by: CAD on September 10, 2009, 05:32:39 am
hi - sorry been away.
template is mostly finished i think. havn't worked on it for while so not sure where i am up to.
i was waiting for Nostra to do some fixes. (nearfile) so I can save images to same directory.
Need to pull apart what nostra has done now and try and figure out how it works  ;).

Also need to figure out how to make credits work
see http://www.videodb.info/forum_en/index.php?topic=1481.0 if someone can help with this bit (may be fixed in new version??)

For peoples interest in how xbmc works and what im trying to do....
xbmc will scrape imdb, tv.com etc based on folder name (and/or file name??) (but definitely folder name)
If there is a .nfo file in the directory it will scrape that first.
if the .nfo has info required it will use that info.
it will also search .nfo for an imdb url and d/l missing info from that url.
So you can have a .nfo file full of crap with an imdb url and the scraper will find the url and d/l info based on that.
All this data is saved in a local sql database.

The problem (i have) with xbmc is that the scrapes are reeeaaally sloooow, the folder names need to be precise, saving/backing up database info is a bit of a pain. Not really an issue with pc based xbmc as you can use keyboard for data entry, but i'm using xbox to run xbmc

(Not really a big deal - but a matter of principle :) )...I don't want to have to maintain d/l the same data twice for different apps.

So what i am trying to achieve is:
Add movie into pvd, dl any required info from online sources. I can then export movie as a .nfo+image. These files can live in the movie directory. When xbmc does its library update. It will read the .nfo file first as a default and update its internal library with this info. (No need to do second d/l stuff from i/net).
The alternative is to have xbmc do the scrape from imdb and then import this info into pvd ( havn't even started on how to make this happen)

if you want to see fields xbmc is storing, do a individual export (export per movie). This will create a .nfo+images into the directory that movie is stored in. (.nfo file is xml). You can pull this apart to see what is required.

Anyway. attached what i have done so far.
Also included is an example of what xbmc will export. (I imported from xbmc and then exported to folder)

Things that i know are broken (in this version :) )

nearfiles needs too be fixed/checked to save images into same directory that .nfo file is generated.
associated xml entry inside .nfo file needs to be written correctly
I don't know how to make credits work (yet :) )


[attachment deleted by admin]
Title: Re: Export to XBMC
Post by: rick.ca on September 10, 2009, 06:38:00 am
Thanks for the update, CAD.

It seems you forgot to include your attachments. I'm curious about the XBMC export sample, although I suppose it may not tell me more than the wiki entry. I'm wondering if the information in XBMC is at all customizable, or can you only use the fields they provide (obviously you can choose whether or not to populate them). Can you, for example, create a custom field, and then fill it with anything you like from PVD? The main reason I'm wondering is to understand whether the template you're creating will be a general solution for all XBMC users, or something each will have to modify for their own use.

It sounds like you're almost there. You have the nearfiles function now. Hopefully nostra can help you with the other issues. Maybe deazo can beta test for you. ;)
Title: Re: Export to XBMC
Post by: deazo on September 10, 2009, 07:48:21 am
Quote
So what i am trying to achieve is:
Add movie into pvd, dl any required info from online sources. I can then export movie as a .nfo+image. These files can live in the movie directory. When xbmc does its library update. It will read the .nfo file first as a default and update its internal library with this info. (No need to do second d/l stuff from i/net).

That's exactly what I'd like to achieve.

Quote
I'm wondering if the information in XBMC is at all customizable, or can you only use the fields they provide

From what I have gathered, it seems that XBMC is quite rigid and has its own restricted fields. I also think their search options are not that great. That's why I would still love to use PVD as the brain and XBMC as the face...

Quote
Maybe deazo can beta test for you
I'd be glad to do so, this would give me a great starting point. CAD could you post the files? (FYI I'm back home on monday so don't expect any testing before that)
Title: Re: Export to XBMC
Post by: CAD on September 10, 2009, 08:00:11 am
Quote
Thanks for the update, CAD.

It seems you forgot to include your attachments. I'm curious about the XBMC export sample, although I suppose it may not tell me more than the wiki entry. I'm wondering if the information in XBMC is at all customizable, or can you only use the fields they provide (obviously you can choose whether or not to populate them). Can you, for example, create a custom field, and then fill it with anything you like from PVD? The main reason I'm wondering is to understand whether the template you're creating will be a general solution for all XBMC users, or something each will have to modify for their own use.

It sounds like you're almost there. You have the nearfiles function now. Hopefully nostra can help you with the other issues. Maybe deazo can beta test for you. Wink

doh - damn work proxies suck. had to zip it up as well.....

xbmc is open source so i guess that library stuff is customisable. i havn't pulled apart the scrapers. I think they are kinda like the way that nostra does it. compiled .dll type files. Can't say for certain as i haven't investigated / had no need. Maybe when i have more time/kids move out of home....

i have just been trying to do (as close as i can) map of xbmc requirements (from an export from xbmc) to what i can get out of pvd  so xbmc has no need to access internet and i can semi automate .nfo creation. also i am not interested in having xbmc have all movie info/cast people/ etc etc. ( i know others do) For movies - I have a bunch on my hard drive and want a quick reminder of what they are about so i can decide if i want to watch them or not. usually after watching - they are deleted.
I will get around to tv shows... but i use xbmc library as a watched/not watched list. I generally know what a tv series is about so i don't need to d/l info about it. just need an episode list. xbmc wll create an episode list in the library. When playing an episode from xbmc, it disappears from the list after watching it. I always know what episode im up to as they disappear after watching.= less having to remember stuff for me :)
Title: Re: Export to XBMC
Post by: CAD on September 10, 2009, 08:14:15 am
Quote
From what I have gathered, it seems that XBMC is quite rigid and has its own restricted fields. I also think their search options are not that great. That's why I would still love to use PVD as the brain and XBMC as the face...

xbmc is highly customisable, has web front ends is open source and has huge support base.
so big that its really hard to find info on what you want (theres so much). it has web interface and db support (don't know about for firebird though). i though about web interface to pvd (firebird) server running in backend, (should be possible) but for the limited amount of stuff i stream it is probably not worth it. I may get around to it if i ever have time (or ask script kiddies in xbmc forums to have a go)  ;)   i mostly use pvd as movie catalogue/ filing system so i know where everything is. xbmc is pretty much used just to watch stuff. (this doesn't include music. i use xbmc library extensively to filter music)
Title: Re: Export to XBMC
Post by: rick.ca on September 10, 2009, 08:48:05 am
Quote
xbmc is highly customisable, has web front ends is open source and has huge support base.

Yes, this is the impression I had. In other words, the answer to any question is always "Anything is possible." On the other hand, I would guess most users don't stray far from it's default configuration (for things like available metadata fields). If that's the case, a general template that fills as many of it's standard fields as possible may be the way to go. It might then be a ready solution for other XBMC users who want more control over where and how their metadata is obtained. If you can generate some interest in the XBMC community, you might attract the attention of someone who can create something to pull the information directly from the database. That's what us J. River Media Center users have, thanks to raldo. It's very cool. 8)
Title: Re: Export to XBMC
Post by: deazo on September 10, 2009, 09:24:14 am

 It's true the forum is huge on XBMC's site, and I see other sites as well like the XBMC-Passion (French) site as well.
 I could not find anything on "personal ratings" for example, apart from enhancement requests.
 Also on the search options it looks like the search only harvest all text with no distinction.
 
 Thanks for the zip file I'll take a look when I can, and see if I understand anything.
Title: Re: Export to XBMC
Post by: CAD on September 14, 2009, 06:18:21 am
Here is mkii.
You can export multiple .nfo files (way cool)

NB: Mappings are not complete.

There are a couple of issues.
"nearfiles"  parameter needs a path hard coded in or it fails to export images.
Without hardcoding "nearfiles" path, it saves either to where pvd is installed or if you saved a file
without nearfiles, it remembers the location.

Preferences/Folders --> Specify a path.
does not seem to have an effect on where files are saved with nearfiles.
(Perhaps Nostra can add a nearfiles path option) ;)

I can't get credits to work - no matter how hard i try :(

pls pls some request for Nostra ;)
Can we add file path option:
so if "file path" is populated, the exported .nfo/xml can be named the file name.
eg. if you have a movie in c:\movies\moviename\movie_5.1_en.iso
nearfiles=%filename%.nfo will create a file called "movie_5.1_en.nfo"
If you wanted to be super clever it could save the files to the path :) :)


[attachment deleted by admin]
Title: Re: Export to XBMC
Post by: deazo on September 14, 2009, 08:21:43 pm

 I'm really not sure I'm doing things the right way, so see for yourself and please no bashing...
 I have unzipped your file and copied the content into the plugins templates directory.
 For testing purpose I am using a test database made of 2 movies. They are both in a folder of the exact same name than the movie file.
 I first tried to export and generate .nfo files and nothing was happening. All that I was getting was a new explorer window opening on PVD's directory. No file was being created.
 I then played around with the file in notepad, not knowing at all what I was doing.
 I changed the "nearfile" part to this:  nearfiles="%t%.nfo"
 and it actually worked.
 I mean that I got an image file and an nfo file generated for both movies in the right directory with the exact filenames.
The first nfo file (movie A) did not contain the imdb URL of the movie, while the second one, for movie B contained only the Allmovie URL.
Movie A in pvd only had an imdb URL while movie B in pvd had two URL's, imdb and allmovie.

 I then opened XBMC and tried to see if that nfo file was used by it.
The info it took from Movie A was only the poster, plot and runtime. The nfo file for Movie A contained more info, like director, actors, etc.
The info it took for Movie B is roughly as limited, with tagline and outline (this info was not present in movies A's nfo file).

I must then have done something wrong when modifying the script.
What should "nearfiles" be set as?
Also what is the use in pvd preferences/folders/specify a path. Specify for what?


Title: Re: Export to XBMC
Post by: nostra on September 14, 2009, 08:28:30 pm
Quote
I can't get credits to work - no matter how hard i try Sad

Could you remind me what the problem was?

Quote
Can we add file path option:
so if "file path" is populated, the exported .nfo/xml can be named the file name.
eg. if you have a movie in c:\movies\moviename\movie_5.1_en.iso
nearfiles=%filename%.nfo will create a file called "movie_5.1_en.nfo"

It already does this without any changes, so in your example c:\movies\moviename\movie_5.1_en.nfo would be created. You can lso specify smth like nearfiles="..\foldername\%t%-%o(%y%)%.nfo" in the latest version of the plugin.
Title: Re: Export to XBMC
Post by: CAD on September 15, 2009, 01:36:07 am
Hi Deazo.
I'll try to explain how it works and then you can modify to suit.
Also - it will only extract info that exists in PVD so make sure fields are populated.
Also download notepad++ - It makes working with text files much much easier.

Anything that does NOT have something that looks like {%value=something} will not be populated
eg
<trailer></trailer> will not have data entered into it.

Main template file is XBMC2.ptm
Code: [Select]
%OPTIONS%
replace="http://www.imdb.com/title/<->"  <=== Leaves only imdb No (as per xbmc format)
filter="XML Files|*.nfo" <==== Did this to force recognition of .nfo
imagenameformat="%t%%ext%" <==== Exports posters as titlename.jpg
nearfiles="d:_test%t%.nfo"   <==== Exports individual .nfo files. I found I needed to have a file pathe here: eg c:xbmc
NB: You Need to change this path to suit where you want to save your files to.

Code: [Select]
%OPTIONS%

In the main body, i tried to match best I could, but couldn't find all the fields. eg both plot (detailed  and plot summary don't seem to exist in PVD. So I reused some fields.

Code: [Select]
%HEAD%
<movie>
<title>{%value=title}</title>  <==== Imports title
    <rating>{%value=rating}</rating> <==== Imports IMDB rating
...
...
<outline>{%value=tagline}</outline>  <==== Outline uses PVD tagline
<plot>{%value=description}</plot> <==== Plot uses PVD description
{%value=tags template="tags.tpl" maxvalues="3"} <==== This calls the file tags.tpl and  limits the No of tags to 3
...
<thumb>{%value=poster}</thumb> <==== Path to poster. Found poster image had to be in same directory for xbmc to find it.
...
<id>{%value=url}</id> <==== This is the url in PVD. Needs some work to limit it to only imdb No.
<genre>{%value=genre}</genre>
<director>{%value=directors}</director>
...
{%value=actors template="actors.tpl" maxvalues="3" params="full"} <==== calls file actors.tpl and limits the No presented to 3
{%value=Credits template="credits.tpl"}  <==== This doesn't work.
</movie>

I tried best as I could to match what is exported from xbmc.
If you have other fields that need to be populated or what I am populating could be changed, let me know and I'll try to fix it up. :)
Title: Re: Export to XBMC
Post by: CAD on September 15, 2009, 03:05:30 am
Quote
Could you remind me what the problem was?

Hi nostra,
I'm not getting data returned with credits tag.

In main.ptm file I have
Code: [Select]
{%value=credits template="credits.tpl"}
Also tried
Code: [Select]
{%value=credits}
In credits.tpl i have;
Code: [Select]
%HEAD%<credits>%HEAD%
<name>{%param=writers}</name>
<role>{%param=composers}</role>
<role>{%param=producers}</role>
%FOOT%</credits>%FOOT%

It seems %value=credits is being recognised but not processed. ie. nothing gets returned.
I checked the log file. Nothing there to indicate problems.

I am using pvd version 0.9.9.14 and export plugin version 0.6.1.0

Edit removed - text - i think install corrupt - more testing needed. :)

pls pls help :)
Title: Re: Export to XBMC
Post by: CAD on September 15, 2009, 05:57:31 am
Quote
It already does this without any changes, so in your example c:moviesmovienamemovie_5.1_en.nfo would be created. You can lso specify smth like nearfiles="..foldername%t%-%o(%y%)%.nfo" in the latest version of the plugin.

hi Nostra
i was not thinking about a fixed naming standard but using the actual file name and path of the movie from where it is saved on the hard drive. (using info scanned from hard drive)

what i am thinking is having an option for using data from file import.
Where it imports movie details (.avi, iso etc) from harddrive.
This writes a entry to (labeled) file path: eg c:\movie\mymovie.avi
This contains path where file was imported from and filename.
What i am thinking is then being able to use this info to export files into the directory where the files are physically stored.
(All this happens now)

something like nearfiles="%p%%f%.nfo"
where  %p% = path to where files are stored and %f% = file name

so if i have 3 movies stored in:
c:\movies\movie1\good_movie1.avi
c:\movies\movie2\chic_flic.iso
c:\movies\movie3\action01.avi

PVD does a scan folders on hard drive.
Populates "file path:" entries info with the 3 entries above.

i can then export into the directory where the files are stored.

so when i export.
good_movie1.nfo and poster.jpg gets saved to  c:\movies\movie1\ folder
chic_flic.nfo and poster.jpg gets saved to  c:\movies\movie2\ folder
action01.no and poster.jpg gets saved to  c:\movies\movie2\ folder

just need options in nearfiles to reference file path: (path and filename)

 :) Hope my ramblings make sense :)

Title: Re: Export to XBMC
Post by: rick.ca on September 15, 2009, 08:45:25 am
I should probably stay out of this, but...

Quote
just need options in nearfiles to reference file path: (path and filename)

As I understood it, the whole point of a nearfiles function was to create files "beside" the media file. In other words, typically, the exported files have exactly the same pathname, but a different extension. It seems the nearfiles function provided is more powerful than that, in that a path may be specified and variables may be used to construct a filename different than the media filename. But it seems to me nearfiles without any options should do what you need. So doesn't nearfiles=".nfo" work?
Title: Re: Export to XBMC
Post by: CAD on September 15, 2009, 10:42:59 am
there are different issues. I think my install at work may be corrupt. I will blow it away when i get back and test again -editing previous posts to remove issues until i can prove issue...

Quote
As I understood it, the whole point of a nearfiles function was to create files "beside" the media file. In other words, typically, the exported files have exactly the same pathname, but a different extension. It seems the nearfiles function provided is more powerful than that, in that a path may be specified and variables may be used to construct a filename different than the media filename. But it seems to me nearfiles without any options should do what you need. So doesn't nearfiles=".nfo" work?


It will create .nfo files. if I do nearfiles="%y%.nfo" I get individual files named after the title. title.nfo
if i do nearfiles="%ot%.nfo" i get alternative title.
They are saved either to last save place or (as i am finding out) to a path location c: omelocationtitle.nfo defined in nearfiles.
Nostra has not made an option to save the location to the file path/file name of the actual file. (using file import options.)
Title: Re: Export to XBMC
Post by: rick.ca on September 15, 2009, 12:43:11 pm
I'm able to export a text files "beside" media files using nearfiles=".nfo"—so that doesn't seem to be the issue.

Posters can also be exported "beside" the video file.

I said that because we had talked about this capability much in the past. I thought the tools that were necessary to do so were now available. But I haven't actually had the need to do it. And now that I think about it, I haven't a clue how do it. Would someone please explain how this, and this alone, is done? What happens when there are multiple posters?

If these two things are possible, then is the issue how to get them both working in one template? If so, why not just use two templates?
Title: Re: Export to XBMC
Post by: CAD on September 16, 2009, 02:28:39 am
hiya rick
Quote
I'm able to export a text files "beside" media files using nearfiles=".nfo"—so that doesn't seem to be the issue.
yep - you can export .nfo and poster next to media but you have to tell PVD where to save the file. (or it will save to last location)

nearfiles works fantastic, but i want to make it automagic. :)

if i use tools/import movies/folders Ctl+F to import movies that are saved to the hard drive, PVD will populate File Location: field with path and file name of movie.

I want to be able to use this field when I do the export.

Nostra has made new fields available with nearfiles eg %t% %ot%. For what i want to do Nostra will need to modify nearfiles with extra options to read and export "file location" field.  (sorry Nostra) ;)

Currently - if i have a filtered view of Antz, Australia, Awake and i export using code below.
(note i have replace back slashes with forward slashes as back slashes seem to get filtered when i post)
Code: [Select]
imagenameformat="%t%%ext%" <==== Exports posters as titlename.jpg
nearfiles="d:/test%t%.nfo"   <==== Exports individual .nfo files. I found I needed to have a file path here: eg c:/xbmc

This will save Antz.nfo, Australia.nfo, Awake.nfo + their posters (nicely named) Antz.jpg, Australia.jpg, Awake.jpg to d:/temp
(great feature for backing up posters btw)  ;D

i have Antz stored on my HD in c:/movies/Antz (1998)/Antz_5.1_R1.iso
Australia is stored in c:/movies/Australia (2009)/Australia_5.1_R4.iso
if i used import from hard drive feature of PVD, the path and file name gets saved to "file location" field inside PVD.

i want to be able to use this path and file name when i do the export.
when i export for xbmc. PVD will save the files into c:/movies/Antz (1998)/ and will save the .nfo file as Antz_5.1_R1.nfo (poster should be saved there as well.

This will fully automate export and would also allow ppl to backup movie info/posters directly to where the media is located.

cool huh  8)
Title: Re: Export to XBMC
Post by: rick.ca on September 16, 2009, 05:36:23 am
Quote
yep - you can export .nfo and poster next to media but you have to tell PVD where to save the file. (or it will save to last location)

No, I don't think you're understanding me. I said, "the whole point of a nearfiles function was to create files "beside" the media file. In other words, typically, the exported files have exactly the same pathname, but a different extension."

The following template, for me, outputs an NFO file with the same pathname (but with an NFO extension) for each movie selected. This is exactly what I would expect a nearfiles function to do.

Code: [Select]
%OPTIONS%
nearfiles=".nfo"
%OPTIONS%
<title>{%value=title}</title>
<year>{%value=year}</year>

I also said I thought we would (in some release of 0.9.9.x) be able to export posters in exactly the same manner. The following template is the simplest I could come up with that would export posters "beside" the media files ("poster.txt" is only there because it seems something must be specified for the text output).

Code: [Select]
%OPTIONS%
nearfiles="poster.txt"
imagenameformat="%t% (%y%) poster%ext%"
%OPTIONS%
{%value=poster}

The posters do end up in the same directory as the media files. But while imagenameformat might make the filename similar to that of the media file, it's not likely to be the same. If it needs to be exactly the same, I don't see any way of doing that.

So the problem, if any, is not with nearfiles. Unless I'm failing to figure out how it's done, the problem is the lack of a function that will to the same thing with image files. From what I've seen, I suppose the same thing could be accomplished if variables for path, filename and full pathname could be used with imagenameformat.

Now, if I put the two templates together, I get this...

Code: [Select]
%OPTIONS%
nearfiles=".nfo"
imagenameformat="%t% (%y%) poster%ext%"
%OPTIONS%
<title>{%value=title}</title>
<year>{%value=year}</year>
<thumb>{%value=poster}</thumb>

...which puts an NFO file (incomplete, of course) "beside," and a poster "almost beside" the media file. While the poster filename is not exactly the same as the media filename, your NFO file points to it with the <thumb> variable (as I've illustrated). Is this not good enough for XBMC?
Title: Re: Export to XBMC
Post by: CAD on September 16, 2009, 06:39:33 am
tks Rick.
you are right.
Code: [Select]
nearfiles=".nfo"This works a treat when file path is populated. :D

i initially never tested with db entries that had this field populated. (and got wierd filepath errors)
after nostra made his changes i assumed a path had to be added for function to work. now i know better what nearfiles does.
THANKYOU. :)

do you know what the default behaviour is if filepath field is not populated or it can be changed??
as a fallback if filepath is is not populated or wrong, would it possible to have files exported to say export folder under preferences/folders and title or something similar as fuile name. pls.

i now have better understanding of how nearfiles is working. i can modify script.  8)
just need to get credits working now  :'( . Then i can strat on xbmc export for tv eps  :D

stay tuned ;D
Title: Re: Export to XBMC
Post by: rick.ca on September 16, 2009, 09:52:21 am
Quote
do you know what the default behaviour is if filepath field is not populated or it can be changed??

I'm sure it does nothing at all. The only reason I can think of that you would not have File path filled is there is no media. This is a situation I'm very familiar with. Most of the movies in my database are ones I've seen over the years—I don't have media. My media manager (J. River Media Center), however, only records information about media files. I imagine XBMC is the same. The solution is simple. Just create a dummy file for each movie—named in the same manner as any movie file, but with a different extension, like LOG. (Export a list to Excel and use that to create a batch file to create the dummy files.) I configure both PVD and MC to recognize LOG as a valid file type, and both happily find import these files. I then use PvdImport (a MC plugin that pulls information directly from the PVD database) to import PVD data to MC.

If you're just concerned about excluding moves for which there is no media, filter them out before running the export. I doubt it matters, however. Those without files will just be skipped.

I think it's now nostra's turn to help you with the credits. ;)  I hope he'll also tell us if my understanding of how the exporting of posters works is correct.
Title: Re: Export to XBMC
Post by: deazo on September 16, 2009, 05:56:30 pm

 Hi all,

 correct me if I'm saying something stupid but from what I have read of your post Rick, you're looking for a way to have the image file saved beside the movie file automatically.
 With my test config this actually worked perfectly using CAD's script.
 I ended up with posters files right next to my .avi file with the same name.
 Unless you meant other types of images? (i.e. not posters?)
Title: Re: Export to XBMC
Post by: rick.ca on September 16, 2009, 10:43:07 pm
Quote
With my test config this actually worked perfectly using CAD's script.
 I ended up with posters files right next to my .avi file with the same name.

CAD's scripti includes imagenameformat="%t%%ext%", so the posters are named [Title].jpg. That's fine if the movie file is named [Title].avi, but that's not necessarily the case. I want it to be named [filename].jpg. And as a stand-alone function (i.e., not used with nearfiles), I would like it to be able to do [full filepath].jpg (I'm using ".jpg" just to be clear—it would actually be the result of %ext%).

I should point out, I have no particular interest in XBMC. I would like to see a function that works well generally. I think saving an image "beside" a subject file is a common requirement—just as doing so with a text file is. It's also just a good file management practise. What I was expecting was something like "posternearfiles" where posternearfiles="" would result in [full filepath].jpg, posternearfiles="%t" (%y%)%ext%" would result in a renamed file in the same folder, and posternearfiles="C:\My posters\%fn%%ext%" would put them all in one folder with the same filenames ("fn") as the movies.

I suppose this might be generalized to imagenearfiles where there would be a parameter for specifying the image type. I don't know if there's any interest in exporting screen shots and covers, however.
Title: Re: Export to XBMC
Post by: nostra on September 17, 2009, 02:44:43 am
In main template you add:
Code: [Select]
{%value=actors template="pages\actors.tpl"}
In actors.tpl:
Code: [Select]
<actor>
<name>{%param=name}</name>
<role>{%param=role}</role>
</actor>

The same for directors, writers, etc.
Title: Re: Export to XBMC
Post by: CAD on September 17, 2009, 07:02:48 am
Hi Nostra.
i have actors working ok.
i cant get credits to work (or understand how grouptemplate works even)

in http://www.videodb.info/forum_en/index.php?topic=766.0 it looks like there is options for exporting credits.


Variables
Variables are formatted like this: {%value=[number] oprion1="value" optionN="value"}
There are also some special variables:
{%value}   (without number or options) is used in subtemplates for fields with multiple values, pages subtemplates for page numbers and in rating subtemplates (rating as stars) for rating value.
{%param=[value]}   is used in subtemplates for fields with different types of data associated (for example actors field can include such information as person id (pid), names, URL, role)
{%groupparam=[value]}   is used in subtemplates that support grouping (for example: awards, filmography) to identify by what parameter values should be gouped


Varables for information fields:
Movies:
...
...
CDCover   66   width, height, template, maxvalues, params
Credits   67   template, grouptemplate
Episodes   68   template, grouptemplate
Title: Re: Export to XBMC
Post by: nostra on September 17, 2009, 03:13:55 pm
There is an option for credits, but I have never tested it. Now I did took a look at the implementation of this option and saw that it would not function in the current version of the plugin, so you will need to export each type of credits separately until the next version of the plugin...
Title: Re: Export to XBMC
Post by: rick.ca on September 17, 2009, 07:49:02 pm
So the problem, if any, is not with nearfiles. Unless I'm failing to figure out how it's done, the problem is the lack of a function that will to the same thing with image files. From what I've seen, I suppose the same thing could be accomplished if variables for path, filename and full pathname could be used with imagenameformat.

I should point out, I have no particular interest in XBMC. I would like to see a function that works well generally. I think saving an image "beside" a subject file is a common requirement—just as doing so with a text file is. It's also just a good file management practise. What I was expecting was something like "posternearfiles" where posternearfiles="" would result in [full filepath].jpg, posternearfiles="%t" (%y%)%ext%" would result in a renamed file in the same folder, and posternearfiles="C:\My posters\%fn%%ext%" would put them all in one folder with the same filenames ("fn") as the movies.

Nostra, is my understanding of the current capability for exporting posters beside media files correct? Or is there some way to export posters so they have exactly the same file pathname as the media file, but with the image format extension?
Title: Re: Export to XBMC
Post by: nostra on September 18, 2009, 10:01:01 am
Yes, it seems like I will need to add posternearfiles in the next version...
Title: Re: Export to XBMC
Post by: zkn on January 22, 2011, 01:33:34 pm
Yes, it seems like I will need to add posternearfiles in the next version...
so is there such new keyword like "posternearfiles" ?
or is it planned or rejected?
Title: Re: Export to XBMC
Post by: nostra on January 23, 2011, 06:33:40 pm
It is already implemented. If you have nearfiles variable set, then all image paths will be relative to this path.
Title: Re: Export to XBMC
Post by: Morgenstern72 on December 29, 2013, 11:44:09 am
I appreciate all your work and attempts to explain to us how this is working. Still: I have no idea.

Is there any possibility you could zip a configured "template" and how to use it, just to be able to use PVD as "brain" and XBMC as frontend? I am completely confused at this point how I would do that...which is my fault, since I just can't get what I have to extract out of these postings to make it work.

Thx alot if anyone takes the time to walk me through this :)
Title: Re: Export to XBMC
Post by: VVV_Easy_Programing on January 17, 2014, 07:08:49 pm
I attached a zip that can help: you just must to unzip in the folder Templates PVD (the file and the folder of the zip).
I tried to make it as complete as possible so the Template needs to have three Custom Fields 'Set' 'IMDB_Votes' 'Top_250' (with underscore because in other case it is blocking the Template). You must define in the Preferences of PVD.
In any case you can delete these lines and other information that you are not interested (eg exporting images).
If you want to renew your XBMC library, I suggest using "SQLiteSpy" or "SQLite Database Browser" to open the database XBMC "MyVideos75.db" and copy of the C09 column (code IMDB) and the column C22 (movies folder) of the table "movies" to Excel .
In Excel you get the URL of the movie like "http://www.imdb.com/title/" + tt****** + "/" and you import the table PVD.
To return to XBMC:
- With PVD scratch the information you want, you use the Template for NFO files.
- With RenameMaster you rename the images to the names of XBMC "folder.jpg" "Fanart.jpg".
- With XBMC empty library, make another tracing your movies with the scraper that you use. It will ask you if you use the Internet or NFO file.
I hope you serve  (Edito: New version down)
Title: Re: Export to XBMC
Post by: VVV_Easy_Programing on January 18, 2014, 04:07:34 pm
Fixed bug in exporting images that blocked (missing a space between the parameters)
Title: Re: Export to XBMC
Post by: VVV_Easy_Programing on January 19, 2014, 09:09:54 pm
Fixed bug seconds /minutes
Title: Re: Export to XBMC
Post by: VVV_Easy_Programing on February 12, 2014, 07:51:32 pm
New simple versión (I tried and it Works)
Title: Re: Export to XBMC
Post by: VVV_Easy_Programing on January 20, 2017, 09:22:39 pm
New version that pass artist thumb url to KODI if you have the URL in the translate name (see http://www.videodb.info/forum_en/index.php/topic,4086.0.html#new (http://www.videodb.info/forum_en/index.php/topic,4086.0.html#new) ).
You have three templates: Only NFO, NFO+fanart.jpg, NFO+folder.jpg (movie poster).
Title: Re: Export to XBMC
Post by: VVV_Easy_Programing on March 19, 2017, 10:49:12 am
New version for Kodi 17.0-Kripton: It allows several ratings. Although is made for IMDB and FilmAffinity is easy to adapt to your own ratings.

You have three templates: Only NFO, NFO+fanart.jpg, NFO+folder.jpg (movie poster).
If you have PVD with all this information, you must applies the three and so in Kodi you will not need to scrap, only to read the nfo files.
Title: Re: Export to XBMC
Post by: afrocuban on May 15, 2017, 11:19:42 pm
Hello and thank you for your contribution. I have extracted template for Kodi Krypton to a Template folder as you described, but nothing happens - after pressing Export button PVD opens root location of PVD in Explorer. No .nfo, no .jpg files anywhere, whichever Kodi template I use.

Any idea please? Thank yo in advance.
Title: Re: Export to XBMC
Post by: VVV_Easy_Programing on May 21, 2017, 07:59:55 pm
It seems that you have done all right so we must test where its the fault.
1) See if you have the folder and the templates as the capture screen 1.
2) See if you use one of the three templates export like the capture screen 2 (the other two are the same)
3) Test that the stored folder in PVD for every films is good and you have the rights for write in it (the nfo and jpg's are saved in the film folder by the template).
4) I use some custom fields: <!-- Custom PVD Fields necesaries 'Set' 'IMDB_Votes' 'Top_250' 'FilmAffinity_Votes' --> if you don't use this fields, erase the lines with this lines:
For instance for the template "KODI NFO_Files Easy.ptm" delete lines:
For 'Set': lines 48 and 49=
      <!-- The Set PVD custom field contains film collection or saga -->
      <set>{%value=Set custom="true"}</set>
For 'IMDB_Votes': line 21=
       <votes>{%value=IMDB_Votes custom="true"}</votes>
For 'Top_250': line 29
       <top250>{%value=Top_250 custom="true"}</top250>
For 'FilmAffinity_Votes': line 25=
       <votes>{%value=FilmAffinity_Votes custom="true"}</votes>
   Note: If you don't use two ratings better delete lines 23,24,25 and 26=
        <rating name="FilmAffinity" max="10">
            <value>{#StringReplace '{%value=orating}' ',' '.'}</value>
            <votes>{%value=FilmAffinity_Votes custom="true"}</votes>
        </rating>

I think that the custom fields may be the principal problem.
I use regularly the templates and they works fine and Kodi catch the information well.
Let me know if you can solve the problem.