Generic site tutor (1 Viewer)

sax

Portal Member
March 26, 2010
41
2
Home Country
Slovenia Slovenia
Hello
I would like to add a new generic site, but need a little help on Regular Expression.
I wonder how you can test regular expression?
Is it possible printou regular expression result?
Is there anywhere help how to add a new generic site, descriptions and explanations of the following sections
dynamicCategoriesRegEx
dynamicCategoryUrlFormatString
dynamicSubCategoriesRegEx
dynamicSubCategoryUrlFormatString
videoListRegEx
videoListRegExFormatString
videoUrlRegEx
videoUrlFormatString
nextPageRegEx
nextPageRegExUrlFormatString
prevPageRegEx
prevPageRegExUrlFormatString
playlistUrlRegEx
etc.
 

offbyone

Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    Sorry didn't have the time to write a guide for this, yet.
    For testing regex you can use tools like these:
    Expresso
    The Regulator

    When selecting these fields in the config, there is small description below.

    Hope this gets you at least started.
     

    sax

    Portal Member
    March 26, 2010
    41
    2
    Home Country
    Slovenia Slovenia
    Thanks!

    I have problem with this http://www.hrt.hr/?id=enz&tx_ttnews[cat]=119 site.
    I can get VideoUrl in videoListRegEx with this expression
    so.addParam\("flashvars","&file=(?<VideoUrl>[^&]+)
    and Title with this
    onclick="javascript:return false;">(?<Title>[^\<]+)
    If I set only VideoUrl in videoListRegEx, everything works ok.
    but when i combinate expression together
    onclick="javascript:return\sfalse;">(?<Title>[^\<]+).*(\n(.)*){0,7}\s*so.addParam\("wmode","transparent"\);so.addParam\("flashvars","&file=(?<VideoUrl>[^&]+)
    I get VideoUrl: http://www.hrt.hr:81/v/2803/sample.flv
    and Title: Dnevnik 28.3.2010.
    in Expresso but mediaportal not working.
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    When creating your regex in Expresso, please go to the Design Mode Tab and set these options:
    CultureInvariant
    Multiline
    Singleline
    IgnorePatternWhitespace
    ExplicitCapture

    These are also set in the code when using the regex. They change the behavior of the matching engine a bit.
    They are needed as there are also more complex regex that can only be done with those settings.
     

    userjan

    MP Donator
  • Premium Supporter
  • March 14, 2008
    193
    26
    USA, Greeneville, TN
    Home Country
    Netherlands Netherlands
    Thx for the explaination, i'm also fighting with this right now, Expresso made a working code but in a wrong format, gonna give it a try with those settings when i get home in the morning.

    edit: if i look for example expresions, do i have to take a certain language in account for the expressions? Java script or .NET etc ?
     

    userjan

    MP Donator
  • Premium Supporter
  • March 14, 2008
    193
    26
    USA, Greeneville, TN
    Home Country
    Netherlands Netherlands
    In this case nothing is "of course" for me ;)

    I made some progress, i can see the thumbs of the videos now but when i click them i get the msg "Unable to play Video no url"

    For instance:
    http://media.nu.nl/m/m1czlkrasxf8_m.jpg (is the picture in the RSS feed)
    http://media.nu.nl/m/m1czlkrasxf8.flv (is the direct link to the video)

    I used argument ":%s/_m.jpg/.flv/g" in section "FileUrlRegEx" to change the "_m.jpg" in ".flv" but that doesnt seem to do the trick.

    Thx for any help
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    I used "of cource", because MediaPortal and OnlineVideos is implemented fully in .Net ;) But the samples for regex are not _very_ different, as regex is a global definition, only some language parsers handle certain aspects slightly different.

    Back to your problem:

    Look at the comment for the FileUrlRegEx. You need to capture groups named m0, m1 and so on. They will be used with the fileUrlFormatString in the way that m0 replaces {0} and so on.
     

    userjan

    MP Donator
  • Premium Supporter
  • March 14, 2008
    193
    26
    USA, Greeneville, TN
    Home Country
    Netherlands Netherlands
    Thx again Offbyone, but i'm still unable to figure it out...

    I put the regex i made in group m0, my Regex looks like this now (?<m0>s/_.\.jpg/\.flv/g), i think with this, the FileUrlRegEx section should be allright.

    If I understand you correctly, by putting {0} in fileUrlFormatString it will use regex group m0

    I still get the msgs "Unable to play the video No url" tho.

    I've tride to use the full url in the regex and put dots to replace the changing characters, and i tride to just remove the "_m.jpg" extention and set the the fileUrlFormatString to "{0}.flv" but all without luck.

    I also looked at the onlinevideo xml and i see sometimes you specify the FileUrlRegEx with <file><\file> etc, i'm not sure when and what to use there, tride to alter the regex with that aswell without any luck.

    Hope you can give me another push in the right direction.

    Thx
     

    Users who are viewing this thread

    Top Bottom