|
| Author |
Message |
jczorkmid

Joined: 07 Oct 2010 Posts: 7
|
Posted: Tue Mar 06, 2012 10:51 pm Post subject: fork of wmcbrine that parses metadata from XBMC NFO files |
|
|
I'm not sure if this is of general interest or not, but I added support for TV and Movie metadata from XBMC NFO files rather than have redundant .nfo and pyTivo .txt files around. I'm on a Mac, so I just wanted to use the data from the built in XBMC scrapers for pyTivo (previously I had been using pyTivoMetaThis). I started looking into writing a converter, but it seemed easier to just add NFO support to pyTivo instead.
The only other change I made was making the pyTivo text parser continue up the directory tree when loading default.txt.
https://github.com/jpenney/pytivo |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2010 Location: Maryland
|
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2010 Location: Maryland
|
|
| Back to top |
|
 |
jczorkmid

Joined: 07 Oct 2010 Posts: 7
|
Posted: Wed Mar 07, 2012 12:07 pm Post subject: |
|
|
Excellent!
| wmcbrine wrote: | This makes me a bit ill |
Oh dear. I admit I didn't handle that. My understanding is doing things like that is to basically seed the scraper in XBMC so it can get the full details into the DB. If you then export the DB as the updated NFO files they should be just the XML.
Still, I'll take a look and see what happens, because I'm guessing that the XML parser won't like those files if it encounters them. |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2010 Location: Maryland
|
Posted: Wed Mar 07, 2012 3:31 pm Post subject: |
|
|
Well, it's a broken spec; I'm not sure you should handle it. But my preferred method of handling it would be extreme violence against whoever decided that was OK.
I tested it and yes, the parser barfs. _________________ My pyTivo fork . My page |
|
| Back to top |
|
 |
jczorkmid

Joined: 07 Oct 2010 Posts: 7
|
Posted: Wed Mar 07, 2012 3:39 pm Post subject: |
|
|
I whipped together a "fix" this morning that handles cases where there is a line of non-xml data somewhere after the xml data (the samples on the wiki would pass). By handle it, I mean pretend it's not there. I'm not having pyTivo go retrieve the metadata from the URL like XBMC would. Any other xml errors will cause it to just ignore the .nfo file rather than barf.
I'll push it to my repo later today. |
|
| Back to top |
|
 |
KyleR96
Joined: 14 Jun 2008 Posts: 4 Location: Lewisville, TX
|
Posted: Tue Mar 13, 2012 4:36 am Post subject: |
|
|
| Thanks a lot for setting this up! I use XBMC also so it really nice to have pyTivo using the .nfo files! |
|
| Back to top |
|
 |
jczorkmid

Joined: 07 Oct 2010 Posts: 7
|
Posted: Wed Mar 14, 2012 7:52 pm Post subject: |
|
|
| KyleR96 wrote: | Thanks a lot for setting this up! I use XBMC also so it really nice to have pyTivo using the .nfo files! |
No problem. Glad to hear someone else finds it useful. Let me know if you encounter any issues. |
|
| Back to top |
|
 |
wkearney99
Joined: 10 Apr 2012 Posts: 10 Location: Bethesda, MD USA
|
Posted: Tue Apr 10, 2012 3:12 pm Post subject: |
|
|
| wmcbrine wrote: | Well, it's a broken spec; I'm not sure you should handle it. But my preferred method of handling it would be extreme violence against whoever decided that was OK. |
Seriously, that's just garbage. It's either an XML file or it's not. Half-assing it by putting what looks like XML into a text file is totally brain-dead stupid. A beating should be rendered unto the idiots that thought it was anything remotely resembling a good idea.
Rather than trying to parse that crap on the fly all the time, wouldn't it be better to check timestamps to see if the garbage has changed and then special-case handle it? Seems safer to have parallel metadata that's reliable instead of integrated crap that's randomly wrong. |
|
| Back to top |
|
 |
lucasnz
Joined: 13 Sep 2010 Posts: 251
|
Posted: Fri Apr 20, 2012 11:30 am Post subject: |
|
|
I get the following error when I have an 'invalid' nfo file in the folder with the movie;
File "metadata.py", line 442, in _parse_nfo
import ipdb; ipdb.set_trace()
ImportError: No module named ipdb
It seems I don't have the module it's referencing, but the nfo is not an XMBC nfo file at all...
Luke |
|
| Back to top |
|
 |
jczorkmid

Joined: 07 Oct 2010 Posts: 7
|
Posted: Fri May 18, 2012 12:31 pm Post subject: |
|
|
| lucasnz wrote: | I get the following error when I have an 'invalid' nfo file in the folder with the movie;
File "metadata.py", line 442, in _parse_nfo
import ipdb; ipdb.set_trace()
ImportError: No module named ipdb
|
Ugh! That should have been removed before I committed. Just delete that line (it drops to the debugger). I don't understand how it's still in there. |
|
| Back to top |
|
 |
jczorkmid

Joined: 07 Oct 2010 Posts: 7
|
Posted: Fri May 18, 2012 12:58 pm Post subject: |
|
|
| wkearney99 wrote: | Seriously, that's just garbage. It's either an XML file or it's not. Half-assing it by putting what looks like XML into a text file is totally brain-dead stupid. A beating should be rendered unto the idiots that thought it was anything remotely resembling a good idea. |
The use case for these files is to give a hint to the XBMC scraper so it can get the correct data. When you re-export your library to .NFO files (unless you tell it not to) the non-XML .NFO file will be overwritten with a valid XML one, so it's not like these should be hanging around long term. |
|
| Back to top |
|
 |
philhu
Joined: 04 Jan 2008 Posts: 474
|
Posted: Mon Apr 22, 2013 4:06 am Post subject: |
|
|
Hi
I found this is working ok. I did find a bug with it though. I have shows with NFO files, created by other programs and dumping them directly into a pytivo setup directory.
The title, show episode, etc are right.
It does not seem to parse the actors, director, etc.
It *DOES* get the season/episode and add it to the episode title, very cool. So I know it is working.
Also, the download program DOES put a .txt file in the .meta directory, under 'Season', like:
D:\TV\Program Name\Season 01\.meta\Episode Name.mkv.txt
with program:
D:\TV\Program Name\Season 01\Episode Name.mkv
D:\TV\Program Name\Season 01\Episode Name.nfo
So, what would be used in this case?
Here is a sample just downloaded:
<episodedetails xsd="http://www.w3.org/2001/XMLSchema" xsi="http://www.w3.org/2001/XMLSchema-instance">
<title>Under Siege</title>
<season>4</season>
<episode>1</episode>
<aired>2013-04-19</aired>
<plot>A hurricane isnΓÇÖt the only thing brewing in this season's premiere. A blacklisted visitor shows up mid storm. An important order's mishandling wreaks havoc on the shop; meanwhile the largest weapon in Red Jacket history may also prove to be the most problematic.</plot>
<displayseason />
<displayepisode />
<thumb />
<watched>false</watched>
<credits />
<director />
<rating />
<actor>
<name>Will Hayden</name>
<role>Founder</role>
<thumb>http://thetvdb.com/banners/actors/283221.jpg</thumb>
</actor>
<actor>
<name>Stephanie Hayden</name>
<role>Office Manager</role>
<thumb>http://thetvdb.com/banners/actors/283219.jpg</thumb>
</actor>
<actor>
<name>Vincent "Vince" Buckles</name>
<role>Head Gunsmith / Shop Manager</role>
<thumb>http://thetvdb.com/banners/actors/283220.jpg</thumb>
</actor>
<actor>
<name>Kris Ford</name>
<role>Shop Apprentice / Builder</role>
<thumb>http://thetvdb.com/banners/actors/283222.jpg</thumb>
</actor>
</episodedetails> |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2010 Location: Maryland
|
Posted: Mon Apr 22, 2013 8:09 am Post subject: |
|
|
In general, pyTivo will combine all available sources of metadata. As pyTivo's "native" metadata format, the .txt takes precedence over everything else, except for the internal metadata in .TiVo files. But, that's only on a field-by-field basis. If, for example, there's a description in the .nfo, but none in the .txt, the lack of it in the .txt doesn't cause it to be reset; the .nfo's description is carried through. _________________ My pyTivo fork . My page |
|
| Back to top |
|
 |
philhu
Joined: 04 Jan 2008 Posts: 474
|
Posted: Mon Apr 22, 2013 1:58 pm Post subject: |
|
|
Ok, thats cool. But the show info seems to be missing actors and Genres. Here is the .txt file found in the .meta folder
| Code: |
pi@rasputil:/cifs/TV_Underground/Sons of Guns/Season 04/.meta$ cat Sons.of.Guns.S04E01.Under\ Siege.mkv.txt
title : Sons of Guns
seriesTitle : Sons of Guns
episodeTitle : 4x01 Under Siege
episodeNumber : 1
isEpisode : true
description : A hurricane isn't the only thing brewing in this season's premiere. A blacklisted visitor shows up mid storm. An important order's mishandling wreaks havoc on the shop; meanwhile the largest weapon in Red Jacket history may also prove to be the most problematic.
seriesId : EP01361285
callsign : Discovery
originalAirDate : 2013-04-19T00:00:00Z
vActor : Will Hayden
vActor : Stephanie Hayden
vActor : Vincent "Vince" Buckles
vActor : Kris Ford
starRating : 3.4
tvRating : TV-14
vProgramGenre : Documentary
vProgramGenre : Reality
|
Also, note, the actors are in both the .txt and .nfo files |
|
| Back to top |
|
 |
|