|
Batch Metadata Tools This forums is for discussing the user-created Batch Metadata Tools for SageTV. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Use media path for title and season?
I'm sure this has probably come up before, but I'm having no luck searching for the answer. Actually, I'm pretty sure I know what will be involved - MediaTitles.xml - but I have no clue what I'm doing in there...
From SageTV's perspective, all my TV series media files are stored in this kind of structure: TV Series\ All Creatures Great and Small\ Series 01\ Series 02 etc...Series 03 The files themselves, using Series 01 of the above example, are named like this: 01 Horse Sense.mkv 02 Dog Days.mkv 03 It Takes All Kinds.mkv etc.... Note that I'm calling the seasons "series" for UK shows and "seasons" for US shows... All I want BMT to do is to take the Title from the first level folder name (from the root of TV Series), take the Season from the last two characters of the second level folder, and take the Episode from the first two characters of the filename. So "All Creatures Great and Small S01E01" etc... That should scrape well, shouldn't it? Possible? RLW |
#2
|
||||
|
||||
This is definately possible but it will require a new "scraper". If you are same person that PM'd me, then I alluded that there as well.
Basically a scraper takes a complete filename path and then parses out the relevant pieces of information, including Series, Season, and Episode. The scrapers for Phoenix/BMT tv files, are located in the SAGE_HOME/STVs/Phoenix/Scrapers/xbmc/tvfilenames/ directory. If you go there, you'll see a number of existing scrapers, and if you are technical enough, you may be able to create your scraper that matches your directory structure. (It's regex and xml). If you don't feel comfortable doing that, I can certainly help. Here's the sXXeXX scraper Code:
<?xml version="1.0" encoding="UTF-8"?> <!-- TV Filename Scraper. Used to Scrape Show Name, Season and Episode from a given file URI $$1 is always the complete file path --> <scraper name="title-s00e00" content="filename" thumb="thumb.png"> <!-- input: $1=complete file uri --> <!-- returns: show name --> <GetShowName dest="3"> <RegExp input="$$1" output="\1" dest="3"> <expression>.*[/\\](.*)[es]([0-9]{1,2})[sexp]{1,2}([[0-9]]+)</expression> </RegExp> </GetShowName> <!-- input: $1=complete file uri --> <!-- returns: Season #--> <GetSeason dest="3"> <RegExp input="$$1" output="\2" dest="3"> <expression>.*[/\\](.*)[es]([0-9]{1,2})[sexp]{1,2}([[0-9]]+)</expression> </RegExp> </GetSeason> <!-- input: $1=complete file uri --> <!-- returns: Episode #--> <GetEpisode dest="3"> <RegExp input="$$1" output="\3" dest="3"> <expression>.*[/\\](.*)[es]([0-9]{1,2})[sexp]{1,2}([[0-9]]+)</expression> </RegExp> </GetEpisode> </scraper> This expression is only looking at the filename to pull the information, so your expression will be a little more complex as it will look at the entire directory structure to pull the same information. Sean.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#3
|
|||
|
|||
Thank you for clearing up the distinction between what the scraper does vs. customized mediatitles.xml. So it's really the scraper I need to work on. I'll study it and perhaps there is someone here at my work who can assist. If so, I'll post the solution back here. If not... well, it won't be the first time I'll depend on the kindness of others!
Thanks for the hint Sean! RLW |
#4
|
||||
|
||||
Here's a tip when creating a new expression...
I tend to use the exact same regular expression for each "function". ie, in the case above they all use Code:
<expression>.*[/\\](.*)[es]([0-9]{1,2})[sexp]{1,2}([[0-9]]+)</expression> By using the same expression, it means that you can just copy and paste the expression and just change the output= attribute to pull the group you want from the expression. For testing... I'd recommend that you use the online site... http://www.regexplanet.com/advanced/java/index.html I just quickly created the expression. Code:
TV Series\\([^\\]+)\\Series ([0-9]+)\\([0-9]+) Code:
C:\TV Series\All Creatures Great and Small\Series 01\01 Horse Sense.mkv Code:
group(1 -- Show) All Creatures Great and Small group(2 -- Season) 01 group(3 -- Episode) 01 Sean.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient Last edited by stuckless; 11-19-2012 at 03:18 PM. |
#5
|
|||
|
|||
Thanks very much, Sean. I'm sure this is spoon-feeding at the extreme and I should be able to just implement this and carry on. But I can't. I have no coding skills beyond a mildly complex batch file (remember those?) and even at that it's been a long time.
Anyone care to take a crack at this and shoot me a scraper file I can test? RLW |
#6
|
||||
|
||||
Code:
<?xml version="1.0" encoding="UTF-8"?> <!-- TV Filename Scraper. Used to Scrape Show Name, Season and Episode from a given file URI $$1 is always the complete file path --> <scraper name="phydeaux" content="filename" thumb="thumb.png"> <!-- input: $1=complete file uri --> <!-- returns: show name --> <GetShowName dest="3"> <RegExp input="$$1" output="\1" dest="3"> <expression>TV Series\\([^\\]+)\\Series ([0-9]+)\\([0-9]+)</expression> </RegExp> </GetShowName> <!-- input: $1=complete file uri --> <!-- returns: Season #--> <GetSeason dest="3"> <RegExp input="$$1" output="\2" dest="3"> <expression>TV Series\\([^\\]+)\\Series ([0-9]+)\\([0-9]+)</expression> </RegExp> </GetSeason> <!-- input: $1=complete file uri --> <!-- returns: Episode #--> <GetEpisode dest="3"> <RegExp input="$$1" output="\3" dest="3"> <expression>TV Series\\([^\\]+)\\Series ([0-9]+)\\([0-9]+)</expression> </RegExp> </GetEpisode> </scraper>
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#7
|
|||
|
|||
Thanks so much Sean. It never fails to amaze me, the generosity of the folks who frequent this site. Much appreciated. I'll provide feedback after I test tonight.
RLW |
#8
|
|||
|
|||
I think this probably works fine, but I have yet to verify as I'm running into a different issue. I'll surf it down elsewhere in this forum since I'm sure I've seen reference to it before.
To test I browsed to one of the series of the program in the example above (All Creatures Great and Small) and fetched the metadata. However BTM saw each episode as a movie. If I do each episode individually I can change the media type to TV and change the provider to thetvdb, and it works fine IF I provide it with title, season and episode. But I'm obviously not going to do that for each file. There must be a way to tell BMT that the entire directory is TV media. RLW |
#9
|
||||
|
||||
Well... typically, bmt will applies all the TV scrapers to the filename, and if one matches, then it does a TV search. It nothing matches, then it a default movie search, so, in your case, the scraper isn't matching
When you do a manual lookup in BMT the scrapers are not used (except when you click on "Discover Defaults"). So, forcing a TV search will always work, but in your case, it doubt it is finding a match using the scraper. Are you sure you copied the scraper file to the correct location? If you email me the logs/phoenix.log, I can see if it is picking up the new scraper file. Sean.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#10
|
|||
|
|||
Hi Stuckless,
Yes, I followed the directions closely and created the directory structure you indicated. Of course, /userdata/Phoenix already existed, so I just created the /scrapers/xbmc/tvfilenames directories. I copied the code from your post into a new notepad file called phydeaux.xml and placed that in the tvfilenames directory. Then stopped and restarted my SageTV service before logging into BMT. I'll track down the log file tonight and post it tomorrow. Thanks, RLW |
#11
|
|||
|
|||
I can sent the entire phoenix.log file if you like, but a quick look and I think this is likely an issue:
Code:
2012-11-20 17:49:30,646 [Timer-8] WARN sagex.phoenix.metadata.search.TVScraperManager - Failed to load User TV scraper: .\userdata\Phoenix\scrapers\xbmc\tvfilenames\phydeaux.xml org.xml.sax.SAXParseException: Content is not allowed in trailing section. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) at sagex.phoenix.scrapers.xbmc.XbmcScraperParser.parseScraper(XbmcScraperParser.java:20) at sagex.phoenix.metadata.search.XbmcFilenameScraper.<init>(XbmcFilenameScraper.java:17) at sagex.phoenix.metadata.search.XbmcTVFilenameScraper.<init>(XbmcTVFilenameScraper.java:20) at sagex.phoenix.metadata.search.TVScraperManager.loadXmbcScraper(TVScraperManager.java:13) at sagex.phoenix.metadata.search.ScraperManager.visitConfigurationFile(ScraperManager.java:54) at sagex.phoenix.common.SystemConfigurationFileManager.visitFiles(SystemConfigurationFileManager.java:100) at sagex.phoenix.common.SystemConfigurationFileManager.accept(SystemConfigurationFileManager.java:89) at sagex.phoenix.metadata.search.ScraperManager.loadConfigurations(ScraperManager.java:31) at sagex.phoenix.Phoenix.initServices(Phoenix.java:304) at sagex.phoenix.plugin.PhoenixPlugin.onPluginsLoaded(PhoenixPlugin.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at sagex.plugin.AbstractPlugin$1.run(AbstractPlugin.java:254) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) |
#12
|
||||
|
||||
Delete your file. Unzip and use this one. I've verified the xml is valid.
Sean.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#13
|
|||
|
|||
Will do Sean, but a quick look at the file I created revealed what I've suspected all along: I'm an idiot. Apparently when I selected the code you provided here I dragged the mouse a little too far and included the following in the code, right after the final </scraper>:
Put this in the SAGE_HOME/userdata/Phoenix/scrapers/xbmc/tvfilenames/ directory Yeah, nice. Thanks. Sorry for the goose chase. RLW |
#14
|
|||
|
|||
Works perfectly. Now I can get to work.....
Thanks again Sean. RLW |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
season Title no banner | bikesquid | Diamond | 2 | 12-13-2011 01:15 PM |
Question for Developers: imported video title, episode, and relative import path | Opus4 | SageTV Studio | 36 | 06-03-2011 06:47 PM |
Full-Path as Title? | ChaOConnor | Batch Metadata Tools | 5 | 05-16-2011 07:01 AM |
BMT Media Type by Path ? | Jabroni | Batch Metadata Tools | 9 | 03-14-2011 08:46 PM |
Looking for Title/Season/Episode naming formats to support for metadata scraper | evilpenguin | General Discussion | 17 | 01-08-2009 04:43 PM |