Jump to content


Photo

Metadata agents for exported XBMC library

posters

  • Please log in to reply
521 replies to this topic

#1 Guillaume Boudreau

Guillaume Boudreau

    Member

  • Members
  • PipPip
  • 68 posts
  • Location: Montreal, Canada

Posted 04 March 2012 - 10:00 PM

If you already have metadata in XBMC, and would like to use that in Plex.

I took the code posted by Harley Hooligan, and changed it to work with my files.

In XBMC, go in Settings > Videos > Library > Export Video Library. Choose Separate files & Export Thumbnails and fanart, and optionally overwrite existing files.
This will create .nfo & .jpg files for your TV Shows and Movies, in the appropriate directories.

The following Plex Plug-ins will then import those into your Plex library.

To use them in Plex, first install them: unzip both files, rename them to end with .bundle, and move both .bundle packages into ~/Library/Application Support/Plex Media Server/Plug-ins/

Image%202012.04.14%206:40:12%20.png

Then, create a new section (or edit an existing one), and choose "XBMC .nfo importer" as the Primary metadata agent.

Image%202012.04.14%206:56:06%20.png or Image%202012.04.14%207:02:42%20.png

Note: For TV Shows sections, the folder(s) you choose in your section settings should be a folder that contains TV shows folders. i.e. adding a folder that contains media files will NOT work!

Good:
Screen%20Shot%202012-07-08%20at%2011.16.

Bad:
Screen%20Shot%202012-07-08%20at%2011.18.

What it will import:
- Title, summary, tagline, rating, year, director, actors, genre, etc. from .nfo files.
- Artwork files: posters, banners & fanarts.

XBMC Movies Metadata Agent
XBMC TV Shows Metadata Agent

The source is available on Github, so anyone who would like to make changes can fork my branch, and submit a pull request with their change(s).

Movies agent: https://github.com/g...Importer.bundle
TV Shows agent: https://github.com/g...Importer.bundle



#2 elan

elan

    Sheriff of Plexville

  • Sheriff Of Plexville
  • PipPipPipPipPipPip
  • 7412 posts
  • Location: Maui

Posted 06 March 2012 - 04:09 AM

Very nice, thanks for writing it!

Instagram: @elan
The Plex blog.
The wife's photography site.
The brother's photography blog.
The dog's twitter feed.


#3 chander

chander

    Dedicated Member

  • Members
  • PipPipPip
  • 155 posts

Posted 14 March 2012 - 10:30 PM

Great, it works fine except for the duration/runtime...

Any hints?

Thanks

#4 Guillaume Boudreau

Guillaume Boudreau

    Member

  • Members
  • PipPip
  • 68 posts
  • Location: Montreal, Canada

Posted 14 March 2012 - 11:22 PM

Great, it works fine except for the duration/runtime...
Any hints?

For movies, or TV Shows?

If for movies: Can you open one of the .nfo that doesn't work with the duration, and look for the <runtime> tag, and tell me what you have in there?

If for TV ShowsL I see it uses the <aired> tag, which doesn't make sense! But then, there is no duration or runtime tags in the nfos I have for TV Shows episodes...
*But* there is one (runtime) in the tvshow.nfo I have, but it's always empty. What about you? Do you have runtime tags in tvshow.nfo or in your episodes .nfo?
If you have runtimes in your episodes nfo, just re-download the latest zip from Github, and replace it. That should fix your problem.

#5 chander

chander

    Dedicated Member

  • Members
  • PipPipPip
  • 155 posts

Posted 15 March 2012 - 08:05 AM

Thanks for your quick answer, let's try to fix this.

First, for movies: here is the beginning of .nfo that doesn't work for duration:

<?xml version="1.0" encoding="utf-8"?>
<movie xmlns:xsi="http://www.w3.org/20...chema-instance" xmlns:xsd="http://www.w3.org/20...001/XMLSchema">
<id>tt0086606</id>
<title>8 Diagram Pole Fighter</title>
<originaltitle>8 Diagram Pole Fighter</originaltitle>
<year>1984</year>
<releasedate>17 February 1984</releasedate>
<top250>0</top250>
<country>Hong Kong</country>
<rating>7.6</rating>
<votes>697</votes>
<mpaa>Rated PG-13</mpaa>
<genre>Martial Arts</genre>
<studio>Shaw Brothers</studio>
<director>Chia-Liang Liu</director>
<runtime>93</runtime>

I've done many tests with all my movies but duration always returning "0:00" in the latest Plex client (mediastream or retroflex skin).

Hope that helps...

#6 chander

chander

    Dedicated Member

  • Members
  • PipPipPip
  • 155 posts

Posted 15 March 2012 - 09:41 AM

I've just checked the sqlite plex database after applying the nfo importer and it appears that the duration is still in minutes (93) rather than in ms (93*60000=5580000). Plex understand only ms for duration, the bug is here. Just multiplying by 60000 and it works:

metadata.duration = int(re.compile('^([0-9]+)').findall(runtime)[0]) * 60 * 1000


#7 chander

chander

    Dedicated Member

  • Members
  • PipPipPip
  • 155 posts

Posted 15 March 2012 - 10:14 AM

I've also added a line for importing the original title:

# Original Title
try: metadata.original_title = nfoXML.xpath('./originaltitle')[0].text
except: pass

And just pasted & modified the genres parser for the countries tags:

#countries
try: 
	countries = nfoXML.xpath('./country')
	metadata.countries.clear()
	for countryXML in countries:
		cs = countryXML.text.split("/")
		if cs != "":
			for c in cs:
				metadata.countries.add(c)
except: pass

Also modified the directors parser cause just the first one was taken:

#director
try: 
	directors = nfoXML.xpath('./director')
	metadata.directors.clear()
	for directorXML in directors:
		ds = directorXML.text.split("/")
		if ds != "":
			for d in ds:
				metadata.directors.add(d)
except: pass

Now, i'm trying to import the release date (originally_available_at) and the sort title tags but i need your help cause i'm really a total noob with python...

Thanks anyway.

#8 Guillaume Boudreau

Guillaume Boudreau

    Member

  • Members
  • PipPip
  • 68 posts
  • Location: Montreal, Canada

Posted 15 March 2012 - 11:43 AM

Now, i'm trying to import the release date (originally_available_at) and the sort title tags but i need your help cause i'm really a total noob with python...


try:
	try:
		release_date = time.strptime(nfoXML.xpath("releasedate")[0].text, "%d %B %Y")
	except:
		release_date = time.strptime(nfoXML.xpath("releasedate")[0].text, "%Y-%m-%d")
	if release_date:
		metadata.originally_available_at = datetime.datetime.fromtimestamp(time.mktime(release_date)).date()
except: pass

I also added your code for country, director & original_title, and fixed duration. It all in Github now.
Thanks for the help here.

#9 chander

chander

    Dedicated Member

  • Members
  • PipPipPip
  • 155 posts

Posted 15 March 2012 - 12:35 PM

I don't really know why but if you move the clearing line for genres/directors/countries (metadata.directors.clear()...) like you do in your last modifications on github, you only get one country, one director or one genre. Replacing the clearing lines and all works perfectly...

#10 Jon of theHTPC.net

Jon of theHTPC.net

    Newbie

  • Members
  • Pip
  • 6 posts
  • Location: Lawrenceville, GA

Posted 22 March 2012 - 06:20 PM

Hello, have been waiting for a reliable agent for local metadata for some time and had high hopes for this one. The agent for movie NFO files works perfectly, however, the TV scraper for local metadata pulls nothing. No images, no metadata...zilch.

I do not use Plex, but have been waiting to use it for some time...the use of local metadata being my only reservation at the moment. I have looked into the logs, but am not really sure what I am looking for. The series and containing files are there and discovered, just no metadata or images. My structure is as follows:

/Seriesname
- tvshow.nfo
- fanart.jpg
- season##.tbn
/Season #
- #x## - episodename.ext
- #x## - episodename.nfo
- #x## - episodename.tbn

Using the TVDB agent, my TV is picked up fine, but I have a very large collection with many incomplete series, so I would rather use my local files. If there is anything specific I can provide, I will do so. I am on the very latest Plex Media Server available for download (as of yesterday 3/21).

#11 psycik

psycik

    Dedicated Member

  • Members
  • PipPipPip
  • 250 posts

Posted 22 March 2012 - 06:50 PM

Hi I had a play with this yesterday as I only just found it. I noticed it didn't support tv shows in season folders.

But I had a hack around in code file and managed to add support for it. It's fairly simple, but I think someone who can actually write python should have a go, and I've done it fairly messily as I don't understand how variables etc work.

Plex for IOS, PlexConnect, Roku3 and NextPVR Plugin

Plex PMS on AMD A10 for movies and TV, and Plex PMS on AMD A8 with NextPVR custom scanner and Agent


#12 Jon of theHTPC.net

Jon of theHTPC.net

    Newbie

  • Members
  • Pip
  • 6 posts
  • Location: Lawrenceville, GA

Posted 22 March 2012 - 07:15 PM

Hi I had a play with this yesterday as I only just found it. I noticed it didn't support tv shows in season folders.

But I had a hack around in code file and managed to add support for it. It's fairly simple, but I think someone who can actually write python should have a go, and I've done it fairly messily as I don't understand how variables etc work.


Ah, didn't realize it didn't support season folders...that would explain the problem for me then. I'd be interested in your code though...I've been mucking around with it and got it close, but is not quite there. I don't know python either, but would still like to see your workaround.

#13 psycik

psycik

    Dedicated Member

  • Members
  • PipPipPip
  • 250 posts

Posted 22 March 2012 - 07:23 PM

Ah, didn't realize it didn't support season folders...that would explain the problem for me then. I'd be interested in your code though...I've been mucking around with it and got it close, but is not quite there. I don't know python either, but would still like to see your workaround.



It's really hacky, I'm not proud of it, couldn't get it to keep that Season folders were used from the search to the update, so had to do the test twice. So I wont be putting it up to github. But here's the code file (so you can keep your original) - I've tried to add the season posters as well, but they may be a bit hit and miss. YMMV

Attached Files


Plex for IOS, PlexConnect, Roku3 and NextPVR Plugin

Plex PMS on AMD A10 for movies and TV, and Plex PMS on AMD A8 with NextPVR custom scanner and Agent


#14 Guillaume Boudreau

Guillaume Boudreau

    Member

  • Members
  • PipPip
  • 68 posts
  • Location: Montreal, Canada

Posted 23 March 2012 - 02:49 AM

I don't really know why but if you move the clearing line for genres/directors/countries (metadata.directors.clear()...) like you do in your last modifications on github, you only get one country, one director or one genre. Replacing the clearing lines and all works perfectly...

I know why. Fixed. :)

#15 Guillaume Boudreau

Guillaume Boudreau

    Member

  • Members
  • PipPip
  • 68 posts
  • Location: Montreal, Canada

Posted 23 March 2012 - 03:09 AM

It's really hacky, I'm not proud of it, couldn't get it to keep that Season folders were used from the search to the update, so had to do the test twice. So I wont be putting it up to github. But here's the code file (so you can keep your original) - I've tried to add the season posters as well, but they may be a bit hit and miss. YMMV

I committed something I think should work for you guys on Github.
Let me know if it does or doesn't work.
(I didn't add anything for the seasons thumbs.)

#16 aloooiut

aloooiut

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 24 March 2012 - 06:12 AM

Hi

I install your bundle and select it for scraping i export my xbmc data base to the movie folders but it cant do any thing and dont show movie information or fanarts and pictures please help me
it is one of my info file
thanks
Attached File  A Love Song for Bobby Long 2004.zip   1.61KB   17 downloads

#17 Pete_

Pete_

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 01 April 2012 - 07:23 PM

This is a great start -- but it doesn't seem like it will pull metadata from NFOs for DVD or BluRay folder structures (/VIDEO_TS, etc.) -- is that the case or am I doing something wrong?

I've tried:

/Movie/movie.nfo (generic XBMC)
/Movie/VIDEO_TS.nfo (matching subfolder)
/Movie/VIDEO_TS/VTS_01_1.nfo (matching .VOB)

None work. The log just shows the title getting skipped over. Thoughts?

#18 Guillaume Boudreau

Guillaume Boudreau

    Member

  • Members
  • PipPip
  • 68 posts
  • Location: Montreal, Canada

Posted 01 April 2012 - 10:18 PM

This is a great start -- but it doesn't seem like it will pull metadata from NFOs for DVD or BluRay folder structures (/VIDEO_TS, etc.) -- is that the case or am I doing something wrong?

I've tried:

/Movie/movie.nfo (generic XBMC)
/Movie/VIDEO_TS.nfo (matching subfolder)
/Movie/VIDEO_TS/VTS_01_1.nfo (matching .VOB)

None work. The log just shows the title getting skipped over. Thoughts?

My XBMC exported the following files for the VIDEO_TS folders I have:
- Movie Name/VIDEO_TS/VIDEO_TS.nfo
- Movie Name/VIDEO_TS/VIDEO_TS.tbn
- Movie Name/VIDEO_TS/VIDEO_TS-fanart.jpg

Plex, using this plugin, seems to use those without problems, since the media file it lists for those folders is VIDEO_TS.IFO

#19 ghostknyght

ghostknyght

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 07 April 2012 - 09:51 PM

I don't know if its because Im using Yet Another Media Manager to scrape for my nfo files, but all I'm getting is the title, year and cover for my media. This shouldnt be a problem because the program states that it pulls .nfo files for the purpose of XBMC consumption. Anyone have any ideas as to what I'm doing wrong?

edit: I just realized that all of my movie nfos are named movie.nfo, not actually matching the video file name. Could this be causing the problem?

Edited by ghostknyght, 07 April 2012 - 10:04 PM.


#20 gwarkyle

gwarkyle

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 08 April 2012 - 12:43 AM

I committed something I think should work for you guys on Github.
Let me know if it does or doesn't work.
(I didn't add anything for the seasons thumbs.)


I tried using the script and everything runs great except for artwork for season folders still. I tried psycik's script as well but no luck with that either. Any suggestions?





Also tagged with one or more of these keywords: posters

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users