Expressions/Rules exchange

Discussion in 'My TVSeries' started by Inker, April 12, 2007.

  1. Inker
    • Team MediaPortal

    Inker Retired Team Member

    Joined:
    December 6, 2004
    Messages:
    2,055
    Likes Received:
    319
    Ratings:
    +319 / 0
    Please use this thread to share your generated logo rules and parsing expressions that you think might be useful for other users. Please do not reply with requests and any other small talk ;-) Stay on topic. Questions/discussussions pls into the request thread.



    To copy a Parsing expression, select it in configuration and hit Ctrl+C. Then paste it between the
    Code (Text):
    1.  tag in the template.
    2. To copy a Logo Rule, bring up its configuration and click "Copy". All nesessary info is now in your clipboard. Paste it between the [CODE] tag in the template. This only works for versions dated 2007-04-13 and up.
    3.  
    4. To paste a Parsing Expression Copy it (Ctrl+C) and paste it into a new entry field in your configuration (Ctrl+V) and make sure you select the correct type (Simple/Regex).
    5. To paste a Logo Rule, copy everything between the Code tags in the template (Ctrl+C), Click Add Rule and click Paste. You might want to/have to change the path to the filename. Then save the result. This only works for versions dated 2007-04-13 and up.
    6.  
    7. For everyones convinience I suggest everybody use this template:
    8.  
    9. Template for Parsing expressions:
    10.  
    11. [B]Type:[/B] Parsing - simple/Regex
    12. [B]<TITLE>[/B]
    13. [B]Description:[/B]
    14. <describe in a few words what the goal is/was and maybe its limitations>
    15. [B]Expression:[/B]
    16. [CODE]<add the parsing expression here>
    Template for Parsing expressions:

    Type: Logo Rule
    <TITLE>
    Description:
    <describe in a few words what the goal is/was and maybe its limitations>
    Expected Filename: static/dynamic
    <give an example filename if dynamic, or the static filename expected>
    Rule:
    Code (Text):
    1. <add the copied rule here>
    Let's help each other out :)
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Inker
    • Team MediaPortal

    Inker Retired Team Member

    Joined:
    December 6, 2004
    Messages:
    2,055
    Likes Received:
    319
    Ratings:
    +319 / 0
    OK, to get us started, and maybe to show you some real life examples (I know it isn't documented very well) let me start off.

    Type: Logo Rule
    Episode Images
    Description:
    Display a manually downloaded/created episode image. The Image should be in the banners/Seriesname folder (where your banners reside) and in the format SeasonxEpisode.jpg.
    Expected Filename: dynamic
    plugins\windows\banners\Lost/3x1.jpg
    Rule:
    Code (Text):
    1. plugins\windows\banners\<Series.Pretty_Name>\<Episode.SeasonIndex>x<Episode.EpisodeIndex>.jpg;-;;-;=;-;;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
    *************************************************

    Type: Logo Rule
    Network (Channel) Logo
    Description:
    Display an Network (Channel) Logo.
    Expected Filename: dynamic
    Plugins\Windows\Logos\Networks\abc.png
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\Networks\<Series.Network>.png;-;;-;=;-;;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
    *************************************************

    Type: Logo Rule
    HD 720p
    Description:
    Display a Logo for files with a dimension of 1280x720 (HD 720p)
    Expected Filename: static
    Plugins\Windows\Logos\hd_720p_logo.png
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\hd_720p_logo.png;-;<Episode.videoWidth>;-;=;-;1280;-;AND;-;<Episode.videoHeight>;-;=;-;720;-;AND;-;;-;=;-;;-;
    *************************************************


    Type: Logo Rule
    Surround Sound Logo
    Description:
    Display a surround sound logo for files with more than (or equal) 5 Audio channels (surround).
    Expected Filename: static
    Plugins\Windows\Logos\dolby_logo.png
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\dolby_logo.png;-;<Episode.AudioChannels>;-;>=;-;5;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
    *************************************************

    Type: Logo Rule
    Video Codec
    Description:
    Display a logo depending on the Video Codec for a given file.
    Note that some codecs are parsed not in their "friendly" name. Check the Episode Details in the Configuration to find out what a codec parses as.
    Examples:
    DivX: divx
    XVID: xvid
    H264: V_MPEG4_ISO_AVC
    Expected Filename: dynamic
    Plugins\Windows\Logos\logo_V_MPEG4_ISO_AVC.png
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\logo_<Episode.VideoCodec>.png;-;;-;=;-;;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
    *************************************************

    Type: Logo Rule
    Audio Codec
    Description:
    Display a logo depending on the Audio Codec for a given file.
    Note that some codecs are parsed not in their "friendly" name. Check the Episode Details in the Configuration to find out what a codec parses as.
    Examples:
    MP3: MPEG-1A L3
    AC3: A_AC3
    Expected Filename: dynamic
    Plugins\Windows\Logos\logo_MPEG-1A L3.png
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\logo_<Episode.AudioCodec>.png;-;;-;=;-;;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
    *************************************************

    Type: Logo Rule
    16:9 Logo
    Description:
    Display a logo for files in 16:9 (Widescreen) Aspect Ratio. Values from 1.7 - 1.85 are accepted.
    Expected Filename: static
    Plugins\Windows\Logos\logo_16-9.png
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\logo_16-9.png;-;<Episode.VideoAspectRatio>;-;>;-;1.7;-;AND;-;<Episode.VideoAspectRatio>;-;<;-;1.85;-;AND;-;;-;=;-;;-;
    *************************************************

    Type: Logo Rule
    4:3 Logo
    Description:
    Display a logo for files in 4:3 (Fullscreen) Aspect Ratio. Values from 1.3 - 1.5 are accepted.
    Expected Filename: static
    Plugins\Windows\Logos\logo_16-9.png
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\logo_4-3.png;-;<Episode.VideoAspectRatio>;-;>;-;1.3;-;AND;-;<Episode.VideoAspectRatio>;-;<;-;1.5;-;AND;-;;-;=;-;;-;
     
  4. Sh4nn0w
    • Premium Supporter

    Sh4nn0w MP Donator

    Joined:
    September 14, 2006
    Messages:
    321
    Likes Received:
    14
    Gender:
    Male
    Occupation:
    Telecommunications
    Ratings:
    +23 / 0
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    For anyone doing dynamic logos, i've come across the following so far:

    *************************************************
    Type: Logo Rule
    Video Codec


    Other Divx Variations:
    DIV3
    DX50

    *************************************************
    Type: Logo Rule
    Audio Codec


    AC3 is also sometimes just identified as AC3 not A_AC3

    *************************************************

    Just duplicate as instructed & change filename to alternative
     
  5. JonJon

    JonJon Portal Member

    Joined:
    April 30, 2007
    Messages:
    25
    Likes Received:
    9
    Ratings:
    +9 / 0
    Home Country:
    For anyone that needs to get double episodes

    Type: Parsing - Regex
    Description:
    Had a lot of downloaded files with their original file such as
    [DB]_Bleach_50_[23A18CB4].avi
    [DB]_Bleach_52-53_[069BE2EB].avi
    [DB]_Bleach_63_Special_[C70774F3].avi
    [DB]_Bleach_75-76_Special_[31E39A56].avi

    This expression will always return the series and episode and extension, if episode2 exists then it will also return it.

    Expression:
    Code (Text):
    1.  
    2. \[DB\]_(?<series>[^_]*?)_(?<episode>[0-9]{1,3})(-(?<episode2>[0-9]{1,3}))?[\w\[\]]*.(?<ext>[^\\]*)
    3.  
     
  6. Anthrax

    Anthrax Portal Pro

    Joined:
    February 15, 2007
    Messages:
    157
    Likes Received:
    46
    Location:
    pretty much in the center
    Ratings:
    +48 / 0
    Home Country:
    Germany Germany
    Just my two cents...

    You can find the logos used in these rules over at: this thread...

    Following rules will show the:
    - favorite logo
    - genre logo
    - runtime logs

    ************************************************************
    Type: Logo Rule
    Favorite Show
    Description:
    Display a favorite logo for shows you marked as favorites from within the tv-series plugin.
    Expected Filename: static
    Thumbs\MPTVSeriesBanners\!logos\Favorite.png
    Rule:
    Code (Text):
    1. Thumbs\MPTVSeriesBanners\!logos\Favorite.png;-;<Series.isFavourite>;-;=;-;1;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
    ************************************************************
    Type: Logo Rule
    Genre
    Description:
    Display a logo for a show according to it's genre on thetvdb.com.
    Expected Filename: static
    Thumbs\MPTVSeriesBanners\!logos\Adventure.png
    Rule:
    Code (Text):
    1. Thumbs\MPTVSeriesBanners\!logos\Adventure.png;-;<Series.Genre>;-;contains;-;adventure;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
    ************************************************************
    Type: Logo Rule
    Runtime (i.e.: approx. 20min playtime)
    Description:
    Display a 1/3 filled clock logo when the runtime for an episode is just below 25mins or 1500000millisecs (don't believe me? ask google :D ).
    Expected Filename: static
    Thumbs\MPTVSeriesBanners\!logos\20min.png
    Rule:
    Code (Text):
    1. Thumbs\MPTVSeriesBanners\!logos\20min.png;-;<Episode.localPlaytime>;-;<;-;1500000;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;

    bye,
    Anthrax

    PS: the runtime stuff is object to heavy tweaking - this was just a glimpse hint on how it could be done ;)
     
  7. Vergo

    Vergo Portal Pro

    Joined:
    August 30, 2005
    Messages:
    162
    Likes Received:
    59
    Occupation:
    Student
    Location:
    Brugge
    Ratings:
    +59 / 0
    Home Country:
    Belgium Belgium
    WS

    Type: Logo Rule
    16:9 Logo
    Description:
    This is in my humble opinion the best way to get this right. Since every 4:3 has 1.33 as aspect ratio, all others are widescreen
    Expected Filename: static
    169 wide black
    Rule:
    Code (Text):
    1. Plugins\Windows\Logos\169 wide black.png;-;<Episode.VideoAspectRatio>;-;!=;-;1.333;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
     
  8. quanfer

    quanfer Portal Member

    Joined:
    December 13, 2007
    Messages:
    29
    Likes Received:
    1
    Ratings:
    +1 / 0
    Template for Parsing expressions:

    Type: Parsing - Regex
    Band of Brothers
    Description:
    For files labeled as "Ep01", such as Band.of.Brothers.Ep05.2001.720p.HDDVD.DTS.x264-ESiR.mkv
    However, you will have to set a simple expression to replace "x264" with <empty> before matching. Also, make sure that the files are in a folder under "season 1"

    Expression:
    Code (Text):
    1. (?<season>[0-9])[\\](?<series>[\w.]*)\.Ep(?<episode>[0-9]*)(?:[-.\w])*\.(?<ext>[^\\]{0,3})
     
    • Like Like x 1
  9. mascot4hire

    mascot4hire New Member

    Joined:
    February 2, 2008
    Messages:
    3
    Likes Received:
    0
    Ratings:
    +0 / 0
    Home Country:
    Type: Parsing - Regex

    Description:
    made for me by Karyudo for files named like this "Z:\TV Shows\Entourage\Season 1\104 - Date Night.avi"
    the 1 in the filename meaning season 1 and 04 the episode number.
    works great so long as your files are exactly like this.

    Expression:

    Code (Text):
    1. (?<series>[\w .,'!&$]*)\\[\w\s0-9]*\\(?<season>[0-9]{1})(?<episode>[0-9]{2}).{3}(?<title>[\w .,'!&$]*)\.
     
  10. spuck

    spuck Community Skin Designer

    Joined:
    April 6, 2007
    Messages:
    397
    Likes Received:
    59
    Gender:
    Male
    Ratings:
    +59 / 0
    Home Country:
    Sweden Sweden
    Here are a few of my formatting rules that I use in the Aeon skin port.

    Type: Formatting Rule
    VIDEOFILE INFORMATION
    Result: 1280x720 (1,78) 23,976fps

    Rule:
    Skin Variable: #TVSeries.Episode.InfoPanelLine1Value
    Code (Text):
    1. <Enabled>1<Format><Episode.InfoPanelLine1Value><FormatAs><Episode.videoWidth>x<Episode.videoHeight> (Eval(Round(<Episode.VideoAspectRatio>*100)/100)) Eval(Round(<Episode.VideoFrameRate>*1000)/1000)fps


    Type: Formatting Rule
    CODEC/BITRATE INFORMATION
    Result: (H264) 5,9 Mbps, (AC3) 384 Kbps

    Rule:
    Skin Variable: #TVSeries.Episode.InfoPanelLine2Value
    Code (Text):
    1. <Enabled>1<Format><Episode.InfoPanelLine2Value><FormatAs>(<Episode.VideoCodec>) Eval(Round(PrettyBytes1000(<Episode.VideoBitrate>)*10)/10-> | Kbps| Mbps| Gbps), (<Episode.AudioCodec>) Eval(Round(PrettyBytes1000(<Episode.AudioBitrate>)*10)/10-> | Kbps| Mbps| Gbps)


    Type: Formatting Rule
    VIDEO/CODEC/BITRATE CRAP CLEANUP
    Result: Result will be empty. Note: You can make it say whatever.
    Description:
    If the file that is highlighted doesn't exist some crap will still be displayed. These Rules will remove it completely. Or maybe write some text saying the file is not present.

    Rule:
    Code (Text):
    1. <Enabled>1<Format>x () fps<FormatAs>
    2. <Enabled>1<Format>() , ()<FormatAs>


    Type: Formatting Rule
    RATING STARS
    Result: "tvseries\star0.png" -> "tvseries\star10.png"
    Description: You can use full paths as well but this way the stars are always in "[your skin]\Media\tvseries\" folder. Be sure to put the star pngs in that folder. "tvseries\star.png" can be used to display 10 empty stars when it's not rated yet, looks a lot better IMO.

    Rule: (My Episode Rating)
    Skin Variable: #TVSeries.Episode.myRatingPath
    Code (Text):
    1. <Enabled>1<Format><Episode.myRatingPath><FormatAs>tvseries\star<Episode.myRating>.png
    Rule: (My Series Rating)
    Skin Variable: #TVSeries.Series.myRatingPath
    Code (Text):
    1. <Enabled>1<Format><Series.myRatingPath><FormatAs>tvseries\star<Series.myRating>.png
    Rule: (TVDB Episode Rating)
    Skin Variable: #TVSeries.Episode.RatingPath
    Code (Text):
    1. <Enabled>1<Format><Episode.RatingPath><FormatAs>tvseries\starEval(Round(Abs(<Episode.Rating>))).png
    Rule: (TVDB Series Rating)
    Skin Variable: #TVSeries.Series.RatingPath
    Code (Text):
    1. <Enabled>1<Format><Series.RatingPath><FormatAs>tvseries\starEval(Round(Abs(<Series.Rating>))).png
     
  11. z3us
    • Team MediaPortal

    z3us Super Moderator

    Joined:
    December 4, 2007
    Messages:
    1,047
    Likes Received:
    118
    Ratings:
    +123 / 0
    Home Country:
    Spain Spain
    Type: Logo Rule
    EPISODE IN DVD
    Description:
    Shows a DVD logo if the episode file is stored in a DVD. You should have added it to the DB in the DVD and u should change "e:\" for the letter of your DVD unit
    Expected Filename: static/dynamic
    thumbs\TVseries\DVD.png
    Rule:
    Code (Text):
    1. thumbs\TVseries\DVD.png;-;<Episode.EpisodeFilename>;-;contains;-;e:\;-;AND;-;;-;=;-;;-;AND;-;;-;=;-;;-;
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!