SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations > Batch Metadata Tools
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

Batch Metadata Tools This forums is for discussing the user-created Batch Metadata Tools for SageTV.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-22-2010, 12:34 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Regex help for tv shows

Sean,

Not that good at regex how would I change the title mask for tv shows to do as I am doing

\\showtitle\season\episodenumber.mpg

is that possible?
Reply With Quote
  #2  
Old 05-22-2010, 01:14 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Plucky,

I'm sure what you are asking... the TitleMask in BMT is used to set the display title for a media item... and it has nothing to do with regex. Or are you asking how to build a tv filename parser for the format that you are asking?
Reply With Quote
  #3  
Old 05-22-2010, 01:23 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by stuckless View Post
Plucky,

I'm sure what you are asking... the TitleMask in BMT is used to set the display title for a media item... and it has nothing to do with regex. Or are you asking how to build a tv filename parser for the format that you are asking?
Yes that is what I am asking sorry if I worded it wrong. I just though I needed the right regex method/parser needed to replace the default

tvtitle-season-epsiode-epsiodename

so it would get metadata on the tv files I have organized/named as per above

if this isn't possible and I need to rename everything sorry for the dumb question
Reply With Quote
  #4  
Old 05-22-2010, 02:02 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
BMT uses an XBMC scraper for processing the filename patterns. They are included in the scrapers/xbmc/tvfilenames/ directory. You can drop a new file in there and it will be picked up (restart may need to be required)

Heres a sample scraper that uses Show Seaon ## Disc ##/Episode.avi format...
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 uri
-->
<scraper name="title-s00d00" content="filename" thumb="thumb.png">
	<!-- 	input: 		$1=complete file uri -->
	<!-- 	returns: 	show name -->
	<GetShowName dest="3">
		<RegExp input="$$1" output="\1" dest="3">
			<expression>.*[/\\](.*)Season\s+([0-9]{1,2})\s?Disc\s+([[0-9]]{1,2})</expression>
		</RegExp>
	</GetShowName>

	<!-- 	input: 		$1=complete file uri -->
	<!-- 	returns: 	Season #-->
	<GetSeason dest="3">
		<RegExp input="$$1" output="\2" dest="3">
			<expression>.*[/\\](.*)Season\s+([0-9]{1,2})\s?Disc\s+([[0-9]]{1,2})</expression>
		</RegExp>
	</GetSeason>
	
	<!-- 	input: 		$1=complete file uri -->
	<!-- 	returns: 	Disc #-->
	<GetDisc dest="3">
		<RegExp input="$$1" output="\3" dest="3">
			<expression>.*[/\\](.*)Season\s+([0-9]{1,2})\s?Disc\s+([[0-9]]{1,2})</expression>
		</RegExp>
	</GetDisc>
</scraper>
TV Scraper Files have can contain the following functions
GetShowName
GetSeason
GetDisc
GetEpisode
GetAiredDate
GetAiringId

At a minimum you need to implement GetShowName, GetSeason and GetEpisode.
GetShowName is the Series Name.

Typcially when I'm creating scrapers, I tend to use Java and create a single regex pattern for that contains groups for Show,Season,Episode, and then when I put them into a regex scraper, I then change the output attribute to select the group that I want. ie, in the sample I posted here, the regex expression is exactly the same, but the output attribute selects either group 1,2,3.

A regex for what you want, may look something like...
Code:
.*[/\\]([^/\\]+)[/\\]([0-9]+)[/\\]([0-9]+)\.avi
In this case, group 1 is the showname, group 2 is the season number and group 3 is the episode number. You'll want to test this regex, since I just typed here without testing.

If you build the scraper, I can include it in future bmt builds.
Reply With Quote
  #5  
Old 05-23-2010, 09:35 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Thanks sean I will look at doing this and appreciate the examples regex is not a strong point for me

Also haven't used bmt in a long time and just wanted to say downloaded painfully the other day from the plugin manager and v4.0 is working very well nice job
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex, pulling internet pages, dev environment bluenote SageTV Studio 4 01-28-2010 03:03 PM
RegEx for Favorites? matterw SageTV Software 2 01-23-2010 11:47 PM
Regex in Favorites??? zoundz SageTV Software 0 10-20-2008 10:56 AM
SageTV - lost my favorite shows/series and recorded shows seaverd SageTV Software 4 09-20-2007 05:56 AM


All times are GMT -6. The time now is 01:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.