Regular Expressions

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
sjorge Offline
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
pmolson Offline
Fan
Posts: 475
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

http://forum.xbmc.org/showthread.php?tid...pid1274417 (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
derwildemann Offline
Junior Member
Posts: 9
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:

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

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:
<tvshowmatching>
    <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> <!-- foo.yyyy.mm.dd.* (byDate=true) -->
    <regexp>([0-9]{2})[\.-]([0-9]{2})[\.-]([0-9]{4})</regexp> <!-- foo.mm.dd.yyyy.* (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 -->
</tvshowmatching>

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

or

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
bhatti00 Offline
Banned
Posts: 68
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
Code:
rtmp://server.live.net/liveorigin/play1?token=c3RhcnRfdGltZT0yMDE0MDMyNzIyMDI1NSZlbmRfdGltZT0yMDE0MDMyNzIyMDM1NSZk​​aWdlc3Q9NWU2NmNjMzE5MGZjMmEyNWIwYzMzMWExMjQ4ZjIyZWQ=
without the extra bit? this is the expression which used to work for the following but now it doesnt' (rtmp://[^<]+)

Code:
<xml>
<version>1.0</version>
<restart_app/>
<items>
<item>
<type>RTMP</type>
<link>
<![CDATA[
rtmp://server.live.net/liveorigin/play1?token=c3RhcnRfdGltZT0yMDE0MDMyNzIyMDI1NSZlbmRfdGltZT0yMDE0MDMyNzIyMDM1NSZk​​aWdlc3Q9NWU2NmNjMzE5MGZjMmEyNWIwYzMzMWExMjQ4ZjIyZWQ=
]]>
</link>
<status>1</status>
<geofilter_allowed>1</geofilter_allowed>
<sub_status>1</sub_status>
</item>
</items>
</xml>

any help much appreciated
find quote
Post Reply