Regular Expressions

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Junior Member
Posts: 2
Joined: Dec 2012
Reputation: 0
Post: #241
Thank you scudlee, that regex indeed works fine from my quick look. The missings ones I know of were now found.
I'll look into the AniDB Mod later, it seems interesting.

Thanks again!
find quote
Posts: 382
Joined: Sep 2012
Reputation: 65
Post: #242
Hello RegEx Gurus,

I hope you guys can help me understand how to apply the following (by example) to various sites/streams...I guess one of the pre-requisites to help out would be to have RegEx expertise as well as flash video streams, source code understanding, and rtmp savoir-faire Smile (Courtesy of C420)

I love this idea/tool & I'd like to master it!!!

I have downloaded C420's LiveStreams addon and it works GREAT! I have since tried applying the same concept to other sites, but could not get them to work!!! I've contacted C420 and he was very helpful and patient with a couple of extra examples I've sent him, but then right b4 the holidays, he went radio-silent on me!!! I guess he realized I was a just rookie who asks too many questions Smile

One of the areas I need help with is how to get the <page> section (in C420's code), as I know it differs from one site or stream to the other.

I do have tools like wireshark, url helper, and firebug, a firefox's addon to help extract source code, but I often get stuck trying to get the correct regex syntax, what exactly to look for? and where?...I know there is NO "one size fits all "of this sort of things, but a step by step generic FLOW or PROCEDURE would be nice...

Please advise if you can help me out... and I can PM you a couple of streams/links I need some hand-holding with...

Thank You In Advance!
find quote
Junior Member
Posts: 18
Joined: Nov 2013
Reputation: 0
Post: #243
I have been trying for more than a week to get raspbmc read and understand my names.

I have also read through this thread but still I can't find out how to get it to work.

I have been using a WDTV player and have developed quite some 5000 move sheets for the movie and TV show folders as well as for the video files themselves, so I am quite a bit reluctant to rename all of them, so they would work for either, the WDTV player as for my Pi with raspbmc.

First, I can't name every season folder below a TV show as 'season 01' and so on as the respective season sheet for that folder, that the WDTV player understands has to be unique, if not the WDTV player would not show the correct season sheet but the first one named 'season 01_sheet.jpg' regardless the TV show.

I also have an issue with the movie file convention.

Here is my own naming convention:

│ ├ 1 SERIES
│ │ ├ Arrow
│ │ │ ├ Arrow S01
│ │ │ │ ├ Arrow S01E01 Pilot.mp4
│ │ │ │ ├ Arrow S01E01
: : : : :
: : : : :
│ │ │ ├ Arrow S02
│ │ │ │ ├ Arrow S02E01 City Of Heroes.mp4
│ │ │ │ ├ Arrow S02E01 City Of
: : : : :
: : : : :
│ │ │ ├ Boardwalk Empire
│ │ │ │ ├ Boardwalk Empire S01
│ │ │ │ ├ Boardwalk Empire S02
│ │ │ │ ├ Boardwalk Empire S03
: : : : :
: : : : :
│ ├ 2 MOVIES
│ │ ├ 1 new movies
│ │ │ ├ 2 Guns - 2013
│ │ │ │ ├ 2Guns_2013_en_109min.mkv
│ │ │ │ └
│ │ │ ├ Elysium - 2013
│ │ │ │ ├ Elysium_2013_en_109min.mkv
│ │ │ │ └
: : : :
: : : :

So I came across the 'advancedsettings.xml' file and also saw the 'Regular Expressions' but I can't figure out how to use them to get my names being understood by raspbmc.

I also am not sure if <tvshowmatching> would help me not only with the TV shows but also with my movies.

I saw this but am not sure how to use the tags:
    <regexp>[Ss]([0-9]+)[][ ._-]*[Ee]([0-9]+)([^\\/]*)$</regexp> <!-- foo.s01.e01, foo.s01_e01, S01E02 foo, S01 - E02 -->
    <regexp>[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$</regexp> <!-- foo.ep01, foo.EP_01 -->
    <regexp>([0-9]{4})[\.-]([0-9]{2})[\.-]([0-9]{2})</regexp> <!--* (byDate=true) -->
    <regexp>([0-9]{2})[\.-]([0-9]{2})[\.-]([0-9]{4})</regexp> <!--* (byDate=true) -->
    <regexp>[\\/\._ \[\(-]([0-9]+)x([0-9]+)([^\\/]*)$</regexp> <!-- foo.1x09* or just /1x09* -->
    <regexp>[\\/\._ -]([0-9]+)([0-9][0-9])([\._ -][^\\/]*)$</regexp> <!-- foo.103*, 103 foo -->
    <regexp>[\/._ -]p(?:ar)?t[_. -]()([ivx]+)([._ -][^\/]*)$</regexp> <!-- Part I, Pt.VI -->

In fact, in case of a TV show file, the video file name already contains all info but, as I omitted spaces in earlier TV shows to separate multiple word titles and also used underscore instead of a space to separate the show name from the season/episode info, I guess the best is to get the show name from the top folder.

All these name types appear in my files:

Boardwalk Empire S01E02 The Ivory Tower.avi
GOT_S01E01 Winter is Coming.avi ( Game of Thrones)
FallingSkies_S01E02 Prisoner of War.avi

Could anyone explain to me what these tags do in detail so I could try to put them together? Or, maybe if this is too extensive, could anyone just give me the code that attends to my naming convention?

I could however rename all the show names in front of the season/episode info to i.e.

TV show name SxxExx Episode Name.avi


TV show name_SxxExx Episode Name.avi

This would be quite some work but it would be doable, however the more elegant way is to get the right regEx to do recognize everything.
find quote
Posts: 35
Joined: Feb 2012
Post: #244
anyone help me with some regex code?

this expression used to work but now is failing because of an extra ]]> at the end of the stream hash
how can i get it to read the whole
without the extra bit? this is the expression which used to work for the following but now it doesnt' (rtmp://[^<]+)


any help much appreciated
find quote
Junior Member
Posts: 14
Joined: Nov 2012
Reputation: 0
Post: #245
Can someone please help me with this? I really don't understand these regular expressions. I just don't get it. If you don't want to help me, please don't jump down my throat, please just ignore this post. I name my shows as follows:

Show_name/season#-episode#(+extra_episode#) - Episode_name

Some shows just do not match the scrapers, so I would like to just not use them, and let the program just get the info from the filenames. I couldn't care less about the content that scrapers give me. The extra episode thing is there in the off-chance that there are two episodes combined into one file. They do this on disc, but not when they air things, so this is why my stuff just doesn't match scrapers, because they are from physical discs, not pirated TV caps. I really just don't get how to incorporate the extra episode part.

EDIT: I guess this isn't going to ever do what I want. All I want is for the program to get the show name, the season number, the episode number(s), and the title, and do its own breaking-down of things, all from the file name. That's as clearly as I can explain it. I don't want to use scrapers, because they don't work, even when I try to name things correctly, they find files that aren't even there, and it's just a huge mess. I don't want to use the file view, because it just lists all of the files and shows the extension, and doesn't break things down by season. I will pay someone money if they help me with this, if it's even possible to get the behavior that I want. I don't need posters or anything like that. Just for the program to structure things based on the path and name.
(This post was last modified: 2016-04-29 23:50 by ramicio.)
find quote
Post Reply