Metadata agents for exported XBMC library

on SYNOLOGY with ARM, XBMC .nfo still not work even with the last version of Plex ( 9.7.12 )

Here part of my LOG
 

2013-02-12 20:31:40,400 (43545490) : INFO (__init__:15) - Searching
2013-02-12 20:31:40,437 (43545490) : DEBUG (networking:172) - Requesting 'http://localhost:32400/library/metadata/6398'
2013-02-12 20:32:00,469 (43545490) : CRITICAL (agentkit:931) - Exception in the search function of agent named 'XBMCnfoImporter', called with keyword arguments {'openSubtitlesHash': '84bd66f9bda7d756', 'name': '10 Jours en Or', 'filename': '%2Fvolume1%2Fvideo%2FFilmsTest%2F10%20Jours%20en%20Or%2F10%20Jours%20en%20Or%2Eavi', 'plexHash': 'f1b29f4354cf7649bc53f4ec8e4ac88c8bfd1763', 'duration': '5785920', 'id': '6398'} (most recent call last):
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 923, in _search
agent.search(results, media, lang)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/XBMCnfoImporter.bundle/Contents/Code/__init__.py", line 19, in search
xml = XML.ElementFromURL(pageUrl)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/parsekit.py", line 344, in ElementFromURL
method=method,
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/networkkit.py", line 67, in _http_request
req = self._core.networking.http_request(url, *args, **kwargs)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 422, in http_request
return HTTPRequest(self._core, url, data, h, url_cache, encoding, errors, timeout, immediate, sleep, opener, follow_redirects, method)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 147, in __init__
self.load()
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/networking.py", line 183, in load
f = self._opener.open(req, timeout=self._timeout)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/urllib2_new.py", line 438, in open
response = self._open(req, data)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/urllib2_new.py", line 456, in _open
'_open', req)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/urllib2_new.py", line 416, in _call_chain
result = func(*args)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/urllib2_new.py", line 1217, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Platforms/Shared/Libraries/urllib2_new.py", line 1192, in do_open
raise URLError(err)
URLError: 
 



Do you have one idea why I have this critical error and how I can resolve it ?


Here what I have when I put in my browser : http://localhost:32400/library/metadata/6398
 


 



Thank's a lot for your help


This is the same error for which my answer in [#121](http://forums.plexapp.com/index.php/topic/38402-metadata-agents-for-exported-xbmc-library/page__view__findpost__p__320376) still stands.

For me, those URLs seem to load fine now (with 0.9.7.12; tested using the web UI).

Hello, Guillaume. I started trying to use the XBMC nfo importer today, as I’d like to use it to catalog home videos (family members as “Actor”, year, summary info, etc). I’m on Plex Media Server 0.9.7.12 on Mac OS X, with Plex/Web 0.9.9.7, and the latest NFO bundle pulled from Github a few minutes ago.



Hopefully this is easy - when I look at Settings/Plex Media Server/Agents/Movies/XBMC .nfo Importer (yes, it’s loading!), the only entry listed - for “XBMC .nfo Importer” - is unchecked, and is disabled so I can’t manually check it!







As a result, this is all I get in my Plex Media Scanner.log:



Feb 12, 2013 14:22:37 [0xac671a28] DEBUG - Refreshing section 3 of type: 1<br />
Feb 12, 2013 14:22:37 [0xac671a28] DEBUG - HTTP requesting to: http://127.0.0.1:32400/:/metadata/notify/changeItemState?librarySectionID=3&metadataItemID=10&metadataType=1&state=3&metadataState=queued<br />
Feb 12, 2013 14:22:37 [0xac671a28] DEBUG - Refreshing metadata for 'testfile' (agent: com.plexapp.agents.none)<br />
Feb 12, 2013 14:22:37 [0xac671a28] DEBUG - Refreshing GUID: 'com.plexapp.agents.none://7b9ae0a52840ed9488ab7370f59bc091d1f65215?lang=xn'<br />
Feb 12, 2013 14:22:37 [0xac671a28] DEBUG - HTTP requesting to: http://127.0.0.1:32400/system/agents/update?mediaType=1&force=1&guid=com%2Eplexapp%2Eagents%2Enone:%2F%2F7b9ae0a52840ed9488ab7370f59bc091d1f65215%3Flang%3Dxn&id=10


As a result - no metadata, just a filename.

Any idea why the NFO bundle isn't being used? I even deleted "~/Library/Application Support/Plex Media Server/" and reinstalled the bundle, and same result.

**EDIT:** After I deleted the application support folder, while the checkbox is still unchecked and disabled, now it loaded the data from the NFO file. Weird. However, I'm still trying to figure out how to load a poster like it does for personal media assets.

**EDIT 2:** Ah, figured it out after looking at the code. Since this is of course designed to import XBMC data, it's looking for Frodo's custom of "filename-poster.jpg", whereas Plex's personal media plugin uses "filename.jpg". Would you mind adding an extra conditional to support the Plex behavior?


		posterFilenameEden = self.getRelatedFile(path1, '.tbn')<br />
		posterFilenameFrodo = self.getRelatedFile(path1, '-poster.jpg')<br />
		posterFilenamePlex = self.getRelatedFile(path1, '.jpg')<br />
		posterFilename = ""<br />
		if os.path.exists(posterFilenameEden):<br />
			posterFilename = posterFilenameEden<br />
		if os.path.exists(posterFilenameFrodo):<br />
			posterFilename = posterFilenameFrodo<br />
		if os.path.exists(posterFilenamePlex):<br />
			posterFilename = posterFilenamePlex



Hello Guillaume

Yes the url load fine when I load them manually but as you can see in my log file I have a critical error and my Plex database do not take any information from my .nfo file ... if you are in contact with guy from Plex team could you ask them for me if they have a solution for me ?

Thank's a lot

Pierre

A change was committed yesterday morning to fix that: https://github.com/gboudreau/XBMC-Movies-Metadata-Agent-for-Plex/commit/741141c01abccf3c2d020fb14d524243f44d3114

No, I have no special contact in the Plex development team. I use the forums for all communications, just like everybody else.
You can create a new thread about this bug in the appropriate forum; just state what the URL is, that it loads fine in the browser, but doesn't when metadata agents try to load it from Python, and show the logs.


Thank's Guillaume, I have post a new thread in the general forum but I'm not sure that I have post it in the right place :)

http://forums.plexapp.com/index.php/topic/60232-urlopen-error-timed-out/

Thanks! I hate maintaining independent patches - inevitably they either break or you forget to apply them. :) You'd have been perfectly justified not including it since XBMC doesn't generate files like that, so thank you for adding it.

I just installed both agents. Struggling with one thing, which I am not sure is a bug or expected behavior.



I have some home videos, which I added custom NFO files for TV shows. Unfortunately, the NFO files are not being used, but instead they are scraped from thetvdb (obviously wrong).



Is there any way to completely turn off all external scraping and solely rely on local media information?

Guillaume,



This is some excellent work here. I’m working on a project to have XBMC and Plex co-exist together using the same art and xml data. I really don’t know why the devs took out support for XML nfo files but either way, I want to thank you for your hard work in creating this.



I’ve started testing out your plugin and have run into an error when your for loops start scanning through each episode and importing their appropriate nfo file.



In this log, I basically have the tv show Jackass with only Season 1 and all the episodes sitting like so (done by sickbeard using the XBMC art/metadata option):



(NOTE: I copy/pasta’ed from nano hence the ‘$’ at the end of some long lines. Shouldn’t hurt too much. Tell me if you want pasties of the full files)





<br />
Jackass<br />
  Season.1/<br />
          Jackass - S01E01 Poo Cocktail.avi<br />
          Jackass - S01E01 Poo Cocktail.nfo<br />
          Jackass - S01E01 Poo Cocktail.tbn<br />
  fanart.jpg<br />
  poster.jpg<br />
  banner.jpg<br />
  season01.tbn (I know for plex this is supposed to be in the Season folder but for XBMC, it doesn't have to be. I'd like to see if theres a way we can have Plex actually support this so I don't have to make symlinks or something stupid)<br />
  tvshow.nfo<br />




Here is what "Jackass - S01E01 Poo Cocktail.nfo" looks like (top important part, rest are actors):


And here's the log from your plugin:




I had some other minor data issues for the main tvshow.nfo but those can wait. This is a bigger issue. I'm wondering if it's something on my end (wrong version of Python, etc..)..??

Thanks for your hard work and I look forward to helping you further to make this a perfectly stable working NFO importer for Plex!

-I

Just tried the movies nfo agent and everything seems to work well for nfo contents. However, there are a few fanart and poster scenarios not coded in.



In the case of my movie collection:


<br />
Date.Movie.2006<br />
   Date.Movie.2006.avi<br />
   Date.Movie.2006.nfo<br />
   fanart.jpg<br />
   poster.jpg<br />




This new in Frodo as well so I can see how you might not have factored for it. From the looks of your code, all you need to add is:


<br />
posterFilenameXBMC = folderpath + "/poster.jpg"<br />




and then of course another if statement checking for if it exists and setting your posterFilename variable accordingly.

Then for fanart, pretty much the same thing:


<br />
fanartFilenameFrodo = folderpath + "/fanart.jpg"<br />




and the the corresponding if statement checking if it exists.

Other than that, movies seem to work perfectly!!

-I


I don't see how this error can happen, with the latest codebase.
In the file specified in the above error, check that the lines 228 and following look like this:

<br />
					if(int(season_num) == 0):<br />
						seasonFileNameEden = 'season-specials.tbn'<br />
					else:<br />
						seasonFileNameEden = 'season%(number)02d.tbn' % {"number": int(season_num)}<br />
					seasonPathFilenameEden = path + '/' + seasonFileNameEden<br />
					if(int(season_num) == 0):<br />
						seasonFileNameFrodo = 'season-specials-poster.jpg'<br />
					else:<br />
						seasonFileNameFrodo = 'season%(number)02d-poster.jpg' % {"number": int(season_num)}<br />
					seasonPathFilenameFrodo = path + '/' + seasonFileNameFrodo<br />
					seasonFilename = ""<br />
					seasonPathFilename = ""<br />
					if os.path.exists(seasonPathFilenameEden):<br />
						seasonFilename = seasonFilenameEden<br />
						seasonPathFilename = seasonPathFilenameEden<br />




Line 241 is this one:

seasonFilename = seasonFilenameEden


And seasonFilenameEden is defined on line 229 or 231, using an if() else ..., so it is defined for sure.
Plus, that variable is used on line 232, to create seasonPathFilenameEden, so if it was missing, an error would have been thrown there.
Did you maybe modify those lines, or do you have an outdated version that had a bug?

I also moved your issue on Github into the right project:
https://github.com/gboudreau/XBMC-TVShows-Metadata-Agent-for-Plex/issues/5

Just pushed code that should take care of both poster.jpg and fanart.jpg
Let me know if it doesn't work.

Ah, wait! Case sensitiveness!!
Bug indeed. Will close the above issue in Github once it's fixed.


Hi,

thanks for your great work. This issue was written by me. If you don´t mind,
the next time i found a Bug, i will merge my fixes into your project.

kind regards

Sure. Just send Github pull requests whenever you'd like to fix a bug, or add support for other metadata files.
Thanks.

For the TV shows, does the agent only update metadata if a tv show.nfo is found?



Ie if tv show.nfo is missing, but the individual episode file has an nfo .nfo will the show entry be created? And the leaves processed?

For the TV shows, does the agent only update metadata if a tv show.nfo is found?

Ie if tv show.nfo is missing, but the individual episode file has an nfo .nfo will the show entry be created? And the leaves processed?

If there is no tvshow.nfo, it should take the foldersname as show name and then update epsiodes and seasons with available nfo files.

G,

Thanks for fixing those issues. Movies seems to work just fine with my setup now. 

However still getting problems with TV shows. I've pasted my log here. (my own paste service) 

Thanks,

I

However still getting problems with TV shows. I've pasted my log here. (my own paste service) 

The same issue is occuring to me on a fresh installation :

  1. path1 = media.items[0].parts[0].file
  2. File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plugins/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 110, in     _getitem_           = lambda x, y: x.__getitem__(y),
  3.  
  4. IndexError: list index out of range