NFO agent



Definitely +1 for me!!!
Thank you so much!
You guys are awesome!

Dan,



are you using an actual xbmc .nfo output or are these special .nfo’s you made? The log says that this file does not exist. \TV Show Name vshow.nfo. XBMC outputs this file inside of the root folder for each tv show. This holds the metadata for the show in general, and will hold the display name of your tv show. It’s needed.

AHAH! Thank you–totally my bad, then; I’d only created “exact_name_of_EPISODE_file.nfo” paired with each episode within the /SeriesRoot/SeasonWhatever directory, as I thought I only needed to intervene, as it were, in relation to the data I wanted to override.



I will create matching tvshow.nfo files for the root directory of any show where I’m then trying to customize the metadata for the individual episodes with a matching individual episode nfo.



Your patience and advice–and, hey, there was an awful lot of coding in there somewhere, too–deeply appreciated!



Dan

I have one more question about local media again…



So with Harleys NFO Agent, is there any change to still get local posters, fanart and trailer files but use Harleys code to also read the NFO file?

I tried using the Freebase agent and but the XBMC .nfo Importer on top of the list, second local media. But this way it did not use the infos stored in my .nfo files.

And if i choose the XBMC .nfo Importer as primary agent it does not look for local media at all… :frowning:

Is there any way to get this going?



Oh and by the way… i once read that Harley is making an exported as well that will save information to a .nfo file again for backup reasons… any news on that? :slight_smile:

I haven’t looked at the framework in a little while so I don’t know if a certain change has been implemente yet. But there is a change coming where I say in XBMCnfo what gents it pulls info from. Once this is in place, everything will work. For now though, you can put a thumb tag in your nfo and put a link to a poster you like, and XBMCnfo will find it.

As for the exporter and all the other stuff I’ve mentioned, it’s all on hold for about 6 weeks. Working in something really badass for plex.

My adventure continues: Having surrendered any illusion that I was competent to copy the model NFO files at the XBMC board, I loaded Ember onto my girlfriend’s laptop, copied over the files I wanted to force metadata for, and got them edited within Ember. Then I copied the resulting NFO files over into the appropriate directories on the Mac Mini I’m actually running Plex from.


  1. All clips showed up with my desired metadata, but in the Movies section.
  2. If I experimentally rename a video file and its matching NFO file so the filename includes a season and episode number–information already included in the NFO–it pops up in the TV SHOWS/THIS SHOW/SEASON WHATEVER/ directory…but named generically, i.e. “Episode 15.”



    At the moment, I’m stuck with either NFO-driven metadata in the MOVIES section…or filename-driven generic episode numbering in the TV SHOW/SHOW/SEASON section. Would a console log help, or is there something more obvious that I’m screwing up?



    I rooted my android phone just fine…but seem to be demonstrating fundamental incompetence with this… :slight_smile:

Here is my version of the agent based on Harley’s great work. I’ve tried to clean up the code a bit, mostly so that I better understand what is going on.



At the moment it does not gather genre (obtained by the Plex Movie agent instead) or actor thumbs from the NFO files. Also, I’ve change the name to Movie NFO Agent, because I didn’t like anything related to XBMC :slight_smile:



import os, re<br />
<br />
class movienfo(Agent.Movies):<br />
	name='Movie NFO Agent'<br />
	primary_provider=False<br />
	languages = [Locale.Language.English]<br />
	contributes_to = ['com.plexapp.agents.imdb']<br />
	<br />
	def search(self, results, media, lang):<br />
		metadata=(media.primary_metadata)<br />
		m = re.search('(tt[0-9]+)', media.guid)<br />
		if m:<br />
			id=m.groups(1)[0]<br />
		score=100<br />
		name="NFO_temp"<br />
		results.Append(MetadataSearchResult(id=id,name=name,year=metadata.year,score=100))<br />
		<br />
	def update(self, metadata, media, lang):<br />
		results=MediaContainer()<br />
		(id, metadata)=self.parseNfo(metadata, media, lang)<br />
		name=metadata.title<br />
		year=metadata.year<br />
		results.Append(MetadataSearchResult(id=id,name=name,year=year,score=100))<br />
		<br />
	def parseNfo(self, metadata, media, lang):<br />
		Log("+++Parsing NFO+++")<br />
		filename = media.items[0].parts[0].file.decode('utf-8')<br />
		Log("Movie filename: " + filename)<br />
		nfoFile=os.path.splitext(filename)[0]+".nfo"<br />
		Log("NFO filename: " + nfoFile)<br />
		nfoText=Core.storage.load(nfoFile)<br />
		nfoXML=XML.ElementFromString(nfoText)<br />
		#title<br />
		try: metadata.title=nfoXML.xpath('./title')[0].text<br />
		except: pass<br />
		Log("Title: " + metadata.title)<br />
		#tagline<br />
		try: metadata.tagline=nfoXML.xpath('./tagline')[0].text<br />
		except:pass<br />
		Log("Disk: " + metadata.tagline)<br />
		#summary<br />
		try: metadata.summary=nfoXML.xpath('./plot')[0].text<br />
		except:pass<br />
		Log("Plot: " + metadata.summary)<br />
		#studio<br />
		try: metadata.studio=nfoXML.xpath('./studio')[0].text<br />
		except:pass<br />
		Log("Studio: " + metadata.studio)<br />
		#year<br />
		try: metadata.year=int(nfoXML.xpath('./year')[0].text)<br />
		except:pass<br />
		Log("Year:")<br />
		Log(metadata.year)<br />
		#rating<br />
		try: metadata.rating=float(nfoXML.xpath('./rating')[0].text)<br />
		except:pass<br />
		Log("Rating:")<br />
		Log(metadata.rating)<br />
		#directors<br />
		try:<br />
			tempdirectors=nfoXML.xpath('./director')[0].text<br />
			directors=tempdirectors.split("/")<br />
		except:pass<br />
		Log("Directors:")<br />
		Log(directors)<br />
		if directors != "":<br />
			metadata.directors.clear()<br />
			for r in directors:<br />
				metadata.directors.add(r)<br />
		#actors<br />
		metadata.roles.clear()<br />
		for actor in nfoXML.findall('./actor'):<br />
			role=metadata.roles.new()<br />
			try: role.role=actor.xpath("role")[0].text<br />
			except: pass<br />
			try: role.actor=actor.xpath("name")[0].text<br />
			except: pass<br />
		Log("Actors:")<br />
		for r in metadata.roles:<br />
			Log("Actor: " + r.actor + " | Role: " + r.role)<br />
		Log("+++Done Parsing NFO+++")<br />
<br />
		return id, metadata




Bundle attached.


I guess I don't understand why your movies section has any impact on your tv section. You need to setup a separate movies section and TV section. You can use the XBMCnfo info provider for movies, and Plex Series Scanner for TV's if you want.

First of all, Thanks for an exelent plugin! :slight_smile:



I noticed two problems in the code.

if director or genre isn’t spesified in the nfo file the plugin wil terminate.

This could be fixed by moving the expect statement a bit in the code.

I have attached my quick hotfix for this :slight_smile:



<br />
#director<br />
                  try:<br />
                    tempdirector=nfoXML.xpath('./director')[0].text<br />
                    directors=tempdirector.split("/")<br />
                  #except: pass<br />
                    Log(directors)<br />
                    if directors != "":<br />
                        metadata.directors.clear()<br />
                        Log("cleared directors")<br />
                        for r in directors:<br />
                            Log(r)<br />
                            metadata.directors.add(r)<br />
                  except: pass<br />
<br />
<br />
.............<br />
<br />
#genre, cant see mulltiple only sees string not seperate genres<br />
                  metadata.genres.clear()<br />
                  try:<br />
                    tempgenre=nfoXML.xpath('./genre')[0].text<br />
                    genres=tempgenre.split("/")<br />
 <br />
                    Log(genres)<br />
                    if genres != "":<br />
                        metadata.genres.clear()<br />
                        Log("cleared genres")<br />
                        for r in genres:<br />
                            Log(r)<br />
                            metadata.genres.add(r)<br />
                            Log(metadata.genres)<br />
                  except: pass<br />
<br />
<br />
<br />
<br />





I hope this plugin wil be included in the official distribution when every bug is sorted out.. :)

you are absolutely right with your fix. that will be incorporated when I update next. anyone wanting this fix before I release it can modify their version with your code. Awesome! Thank you

Hi everybody!



In the past I was using XBMC on Windows. In this case I created .nfo-files with MediaCompanion for my TV-shows and movies. They worked in XBMC without any problems. Now I want to switch to the Mac and Plex. I downloaded the newest version of Plex from its page and all 3 files from the first page of this thread and installed them. I created a new section with XBMC TV .nfo Importer as the primary metadata agent. I added my whole folder of my series including its .nfo and tbn-files. But when I try to scrape nothing works. Media Manager is searching for some infos but doesn’t find anything. What am I doing wrong? Are the .nfo-files from MediaCompanion not working? Or do I have the wrong files? I hope you can held me.



Greetz

Screamer

can you post you ~/Library/Logs/PMS Plugin Logs/com.plex.agent.xbmc.log files? there should be one for each agent.

Hm, strange. There are 3 logfiles for com.plexapp.agents.xbmcnfo and 5 logfiles for com.plexapp.agents.xbmcnfotv. Here are in each case the first and the last log of it

do you have your tv sections in the correct folder structure (check the wiki)? Also, the movie version is not running at all.

I use the structure, XMBC has to use. I.e. one folder for each series and season. The episodes are named after S01E01 - Episodename

For the movies section, which is the most up to date, make sure your setup looks like this:

I didn’t check the movie section yet. I will test it tomorrow and post my results. But do you have any idea why my series don’t work? Btw I installed XBMC for Mac and tested my Tv-series-folder. I could add it without any problems

Thanks for the great agent!



Everything is working fine for me except that I’m having trouble trying to get local files to work as the thumb. I’ve tried a number of different syntaxes and all have failed. The only way I have found to specify the thumb image is if it is encoded as an url with “http:/” at the beginning.



For example, all of the following do not work:



file:/localhost/Volumes/Elements2/Movies/Toy Story (1995)/ToyStory.jpg

file://localhost/Volumes/Elements2/Movies/Toy Story (1995)/ToyStory.jpg

file://Volumes/Elements2/Movies/Toy Story (1995)/ToyStory.jpg

file:/Volumes/Elements2/Movies/Toy Story (1995)/ToyStory.jpg

/Volumes/Elements2/Movies/Toy Story (1995)/ToyStory.jpg



Is the NFO agent just not set up to use local images as thumbs?



if not, would this be possible?



Thanks!

Local media agent handles local folders. No plans to include on my part.