Kodi Community Forum
Regular Expressions - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Regular Expressions (/showthread.php?tid=25349)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17


RE: Regular Expressions - xbmcuser123 - 2012-11-05

Actually, the scan for TV Series is not recursive. It searches Series in the Sub level only.
Does anyone has a clue if it is possible to use a custom regex to force XBMC to scan at SUB SUB level ?
Thanks.



RE: - un1versal - 2012-11-05

(2007-03-20, 20:10)spiff Wrote: first, there was a bug in svn that i fixed @ rev 8255.

second;

a regexp for your scheme would be:

season([0-9]+)[\\/]episode([0-9]+)[^\\/]*

now, the explanation (man, i'm patient today):

the season part should be explanatory; we need it to say 'season' at the start of of pattern. then we need 1 or more numbers. we state that we only allow numbers by the [0-9] part. this defines a list of allowed characters - 0-9 is expanded into 0 1 2 3 4 5 6 7 8 9. we say that we need one of more this using the + sign. now, since this is the season number and that's what we are after, we select this part. this is done by embracing it in parantheses - ([0-9]+). now we need either a backslash or a slash. since a backslash has a special meaning in regular expressions we tell the parser that we mean a litteral \ by doing \\. then it needs episode literally, and we do the same thing to select the episode number. finally we want to make sure we match at the end of the path and not in the middle of it. we do that by specifying a list of not allowed characters, namely \ and /. this we do by putting a ^ inside the []'s, inverting the meaning of the list. finally we need 0 or more of these non-slash characters, which we indicate by a *.

Can this explanation be added to wiki? I dont think such an effort should goto waste.

uNi




Re: Regular Expressions - Martijn - 2012-11-06

Create an account and start adding Smile


RE: Regular Expressions - un1versal - 2012-11-06

Done http://wiki.xbmc.org/index.php?title=RegEx_tutorial

uNi


RE: Regular Expressions - xbmcuser123 - 2012-11-06

Universal, thanks for your post, was this related to my question about scanning SUB SUB level ?


RE: Regular Expressions - un1versal - 2012-11-06

(2012-11-06, 13:15)xbmcuser123 Wrote: Universal, thanks for your post, was this related to my question about scanning SUB SUB level ?

No, it was related to explanation given in second post by Spiff, which explain all the options very very well, nothing to do with any other posts. I didn't want this explanation to goto waste and get buried in the forum.

However to give you some idea of how to properly add TV shows to xbmc you can read this post and forget about sub sub scanning anything any new show that are added and any episodes fed into season # folder get picked up by xbmc in scraping, as long as the source is added properly you shouldn't need to do anything else.

uNi



RE: Regular Expressions - xbmcuser123 - 2012-11-08

Thanks for your help.


RE: Regular Expressions - sierra56 - 2012-11-09

NOTE: I currently don't understand regular expressions and I don't understand how to modify them.

Can someone help me with a RegExp for the following example below

Also could you break down the RegExp so i now what each bit does so i can try and do it in the future

Thanks for any help you can give me

Quote:\TV Shows\Life On Mars\UK\Series 1\Life On Mars - 1x01 - Episode One.avi
\TV Shows\Life On Mars\US\Season 1\Life On Mars - 1x01 - Out Here In The Fields.avi

\TV Shows\Knight Rider\1982\Season 1\Knight Rider - 1x01 - Episode Title.avi
\TV Shows\Knight Rider\2008\Season 1\Knight Rider - 1x01 - Episode Title.avi
Code:
TV Shows
     |----Life On Mars
     |       +----UK
     |       |     |___ Series 1
     |       |     |         |___ TV Show Media files
     |       |     |___ Series 2
     |       |               |___ TV Show Media files
     |       |
     |       +----US
     |             |___ Season 1
     |             |          |___ TV Show Media files
     |             |___ Season 2
     |                       |___ TV Show Media files
     |
      ----Knight Rider
             +----1982
             |     |___ Season 1
             |     |          |___ TV Show Media files
             |     |___ Season 2
             |                |___ TV Show Media files
             +----2008
                   |___ Season 1
                   |          |___ TV Show Media files
                   |___ Season 2
                              |___ TV Show Media files



RE: Regular Expressions - un1versal - 2012-11-09

That's the wrong way for folder structure for proper scrapping if I ever saw one (but different folks different strokes

Should be imo I didnt draw the fancy tree things because its too much work

Code:
Source

life on mars UK
Season 1 > files
Season 2 > files

Life on mars US
Season 1 > files
Season 2 > files

Knight Rider 1982
Season 1 > files
Season 2 > files

Knight Rider 2008
Season 1 > files
Season 2 > files
Just my 2c

uNi


RE: Regular Expressions - xbmcuser123 - 2012-11-09

uNi, question for you since you are an expert in regular expression :

Can this structure be scanned properly ?

TV Shows
|--------TV Show 1
| +------------Life On Mars
| | |____________ Season 1
| | | |_______________ TV Show Media files
| | |____________ Season 2
| | |_______________ TV Show Media files
| |
| +------------Knight Rider
| |____________ Season 1
| | |_______________ TV Show Media files
| |____________ Season 2
| |_______________ TV Show Media files
|--------TV Show 2
| +------------24
| | |____________ Season 1
| | | |_______________ TV Show Media files
| | |____________ Season 2
| | |_______________ TV Show Media files
| |
| +------------Lost
| |____________ Season 1
| | |_______________ TV Show Media files
| |____________ Season 2
| |_______________ TV Show Media files
|--------TV Show 3
| +------------Heroes
| | |____________ Season 1
| | | |_______________ TV Show Media files
| | |____________ Season 2
| | |_______________ TV Show Media files
| |
| +------------Dirty Sexy Money
| |____________ Season 1
| | |_______________ TV Show Media files
| |____________ Season 2
| |_______________ TV Show Media files

TV Show 1, TV Show 2 and TV Show 3 are symbolic links, each pointing towards a different hard drive.
Can this structure be scanned properly by adding TV Shows ONLY as a source, and not individually TV Show 2 and TV Show 3 ?

Thanks.


RE: Regular Expressions - un1versal - 2012-11-09

Hello

So we are clear here, I dont understand regular expressions myself. probably less than you, for real. As for folder structures/naming, I understand a little and what I have works In library mode well. Big Grin

Having said that, the structure you posted with symlinks, it probably passes idk how xbmc or the scraper sees symlinks or if it tries to download some information about some showname TV show (literally),
If you see some fanart/poster/banners for stuff you know you dont have, you know its failed gloriously.
If on the other hand it is scanning and scraping ok then you know it works, obviously.

I cant help you with regular expression at all though. Blush

uNi.

.


RE: Regular Expressions - wsnipex - 2012-11-09

@xbmcuser123

it will work if you add each "TV Show x" folder as a path in the TV library source.
Not sure if that is clear enough, you can add multiple paths/folders into the same library source.


RE: Regular Expressions - xbmcuser123 - 2012-11-09

Thanks for your reply. I thought that maybe via a regex tweak it was possible to make it with the top directory instead of the sub directories.



RE: Regular Expressions - sjorge - 2012-12-30

Hi guys,

After 3 days of fighting, I've given up and I've come here for some help.
All my Anime has been renamed using the Anidb.net naming, I prepended a regex that makes xbmc pick up about 90% of my shows.

The renamining 10% all have the same issue, there is a number in the show title.
Here are some examples of unregonized files:
Code:
/archive/anime/K/Kidou Senshi Gundam 00 [720p@h264-AAC]/Kidou Senshi Gundam 00 - 22 - TRANS-AM - [Mendoi-Conclave](e3f1aba2).avi
/archive/anime/K/Kidou Senshi Gundam 00 2nd Season [720p@h264-AAC]/Kidou Senshi Gundam 00 2nd Season - 25 - Rebirth - [gSS](d69d4aa0).mkv
/archive/anime/B/Byousoku 5 Centimeter [1080p@h264-AC3]/Byousoku 5 Centimeter - 1-3 - The Chosen Cherry Blossoms - [THORA](772ed3c7).mkv
/archive/anime/B/Black Rock Shooter (2012) [720p@h264-AAC]/Black Rock Shooter (2012) - 1 - How Much More Do I Have to Scream - [Commie](eee53efc).mkv

As you can see they all have a number (or year) in the show title. The show is picked up just fine, just not the episodes.
This is my advance settings file:
Code:
<advancedsettings>
    <useddsfanart>true</useddsfanart> <!-- gpu acceleraated fanart  -->

    <video>
        <excludefromlisting>
            <!-- Hide the System and Storage folders on openelec -->
            <regexp>[!-._ \\/](?-i)(flash|storage|_misc)[-._ \\/]</regexp>
        </excludefromlisting>
    </video>

    <tvshowmatching action="prepend">
        <regexp>[-_ ]{1,2}([0-9]+)[^\\/]*</regexp>
    </tvshowmatching>
</advancedsettings>

I looked at a possible way to skip any number before the first ' - ' but I have not been able to figure out how to do this.
Any help would be appriciated.

Jorge


RE: Regular Expressions - scudlee - 2012-12-30

These are the regexps I use:
Code:
<tvshowmatching action="prepend">
  <regexp> - ()(\d+)((?:-\d+)*)(?:v\d+)? - [^\\/]*$</regexp>
  <regexp defaultseason="0"> - ()s(\d+)((?:-\d+)*)(?:v\d+)? - [^\\/]*$</regexp>
</tvshowmatching>

My filenames look more or less the same as yours, so you should be alright.

There's more details in the thread for my AniDB.net scraper mod (which I recommend using over the default).