0

I've been unsuccessfully trying to update the tvshowmatching's in raspbmc.

my tv show library is in the format ".../Show Name/Season ##/## episode name.ext" firstly i'd like to add this matching rule but i'm looking to find a more robust set of matching rules as well.

by default xbmc is expecting the season number in the file name itself. after a bit of searching it seems possible to modify that behaviour through ~/.xbmc/advancedsettings.xml file

So far I've tried to use the advancedsettings.xml file I found here. Extra REGEX for TV Show Episode matching. Note it's made for xbmc, not specifically raspbmc. it's also from 2009. unsurprisingly it didn't work out of the box.

<!--
This REGEX is UNOFFICIAL/EXPERIMENTAL and may in places require a strict folder structure.
See forum link for README, changelog and support.

Version:    V2.3
Author:     Xe
Link:       http://forum.xbmc.org/showthread.php?t=51614

################################################################################-->

<advancedsettings>

    <!-- Customise/remove/comment this section to your personal preferences -->

    <useddsfanart>true</useddsfanart> <!-- Enable GPU accelerated fanart-->
    <navigatevirtualkeyboard>true</navigatevirtualkeyboard> <!-- Activates virtual keyboard navigation, default is false -->
    <cputempcommand>cputemp</cputempcommand> <!-- OpenELEC Specific -->
  <gputempcommand>gputemp</gputempcommand> <!-- OpenELEC Specific -->

  <samba>
    <clienttimeout>30</clienttimeout> <!-- Set a sensible SAMBA timeout -->
  </samba>

    <lcd> <!-- This is for my Antec LCD. Edit for your own -->
        <rows>2</rows>
        <columns>16</columns>
        <scrolldelay>4</scrolldelay>
        <dimonscreensave>true</dimonscreensave> <!-- Turns of the LCD/VFD backlight while screensaving. Defaults to false. -->
    </lcd>

    <videolibrary>
        <hideallitems>true</hideallitems>  <!-- Remove the "*All" items from the video library -->
        <hideemptyseries>false</hideemptyseries>  <!-- Dont hide empty series in the video library -->
        <hiderecentlyaddeditems>false</hiderecentlyaddeditems> <!-- Dont remove the "Recently added ..." items from the video library. -->
        <recentlyaddeditems>300</recentlyaddeditems> <!-- Increase number of recently added items from default 25 -->
        <backgroundupdate>false</backgroundupdate> <!-- Set to hide the video scanner dialog from the gui -->
        <flattentvshows>0</flattentvshows> <!-- Never flatten TV show seasons, 0=never 1=if one season (default) 2=all -->
    </videolibrary>

  <musiclibrary>
    <backgroundupdate>false</backgroundupdate> <!-- set to hide the music scanner dialog from the gui -->
   </musiclibrary>

    <myvideos>
        <extractthumb>false</extractthumb> <!-- Dont create random thumbnails. Either scrape them from the internet or dont have them -->
    </myvideos>

    <sorttokens>
    <token separators="">&quot;</token> <!-- Ignore " when sorting. Senisble due to IMDB naming policy -->
    </sorttokens>

    <video> <!-- Stop XBMC indexing some unwanted common items -->
        <excludefromscan action="prepend">
            <regexp>(?i)extras</regexp> <!-- Greedy, whole path, case insensitive ignore -->
            <regexp>(?i)sample</regexp> <!-- Greedy, whole path, case insensitive ignore -->
            <regexp>(?i)uTorrentPartFile</regexp>  <!-- Ignore common scrap files -->
        </excludefromscan>
        <excludetvshowsfromscan action="prepend">
            <regexp>(?i)extras</regexp> <!-- Greedy, whole path, case insensitive ignore -->
            <regexp>(?i)sample</regexp> <!-- Greedy, whole path, case insensitive ignore -->
            <regexp>(?i)uTorrentPartFile</regexp>  <!-- Ignore common scrap files -->
        </excludetvshowsfromscan>
    </video>

    <tvshowmatching action="prepend"> <!-- Catch some troublesome formats before XBMC -->

        <!-- DIRFIX Handling -->
    <regexp>(?i)[\. _-]s(\d{1,2})[\. _-]?e(\d{1,2})(.*)dirfix</regexp> <!-- DIRFIX Handling show.name.S01E10E11.ep.name.here.DiRFiX.PROPER.HDTV.XviD-XEE-->

        <!-- Edge case scene handling -->
        <regexp>(?i)[/\\]tpz-(?:24|30rock|4400)(\d)(\d{2})(\d{2})?(?:r|fix|dc|-repack|int|d)?\.</regexp> <!-- tpz-SPECIFICSHOW12324.avi This attempts to cater for some odditys -->
        <regexp>(?i)[/\\]tpz-\D*(\d)(\d{2})(\d{2})?(?:r|fix|dc|-repack|int|d)?\.</regexp> <!-- tzp-show12324.avi    -->
        <regexp>(?i)[/\\]tpz-johnadams(\d).avi</regexp> <!-- tpz-johnadams2.avi. Another TPZ divergence from their own naming scheme. XBMC will assume Season 1 if only one match-->
        <regexp>(?i)[/\\]tpz-\D*(\d)(\d{2})(\d{2})?(?:r|fix|dc|-repack|int|d)?\.</regexp> <!-- tzp-show12324.avi    -->
        <regexp>(?i)[.a-z](\d{1,2})(\d\d)-notv([^/\\]*)</regexp> <!-- frng101-notv.avi  -->
        <regexp>(?i)[/\\]\w+-\w+(\d)(\d\d)\.</regexp> <!-- mtn-tts104.avi  -->

        <!-- Anime specific matching. YMMV with this one as anime naming is oddball. REQUIRES CRC in name -->
        <regexp>(?i)()(?:[\. _-]|ep)(\d{1,3})[\. _-v].*[[({][\da-f]{8}[])}]</regexp> <!--  [Doki]_Asobi_ni_Iku_yo!_-_03v2_(1280x720_h264_AAC)_[B5B9C6F3].mkv -->

    </tvshowmatching>

    <tvshowmatching action="append"> <!-- XBMC has tried, now its our turn again -->

        <!-- Use the season number from the folder name and ep number from video file -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\]\D+[\. _-](\d{1,2})[\. _-]\D+</regexp> <!-- /Season 1/the_episode_8.avi HUGE potential for false positives. Comment out if you are unsure  -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\D\1(\d\d)(?!.*])</regexp> <!-- /Action/Season 1/Action101 Pilot.avi  Last (?!.*]) helps with anime false positives. not a perfect solution -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\](\d{1,2})\W([^/\\]*)</regexp> <!-- /UFO/Season 1/02.Computer.Affair.Divx e.g. lame sequntial numbering witout season  -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\Wep?\.?(\d{1,2})\W([^/\\]*)</regexp> <!-- /Ulysses 31/Season 1/Ulysses 31 E12 Trapped.avi e.g. lame sequntial numbering witout season  -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\W?episode\W?(\d{1,2})\W([^/\\]*)</regexp> <!-- /The Chronicles/Season 1/Chronicles.Of.01.The.episode.6.DVDRip.DivX-movies.avi  -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\Wpart\W?(\d{1,2})\W([^/\\]*)</regexp> <!-- /NASA Missions/Season 1/nasa.missions.part.3.hdtv.xvid-fqm.avi -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\Wchapter\W?(\d{1,2})\W([^/\\]*)</regexp> <!-- /The Young/Season 1/The.Young.Chapter.01.My.First.Adventure.DVDRip.XviD-SAiNTS.avi  -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\1\W?x\W?(\d{1,2})([^/\\]*)</regexp> <!-- /season 5/Lost - 5 x 05.mkv  -->
        <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?s0?\1[ex.]{0,2}(\d{1,2})([^/\\]*)</regexp> <!-- /Season 1/Grange Hill S01xE01.avi  -->

    </tvshowmatching>

    <moviestacking> <!-- Tokens - (Title)(Volume)(Ignore)(Extension). If you have a "one pile file" system of movie organization then DONT run these -->

        <regexp>(?i)(.*-done[\. _-])(\d)(\.)(\w{3})$</regexp> <!-- movie name.blah.DVDRip.XviD-DoNE.1.avi -->
        <regexp>(?i)(.*?[\. _-]cd)(\d)([\. _-].*?\.)(\w{3})$</regexp> <!-- movie name.blah.iNTERNAL.DVDRip.XViD.CD1-TWiST.avi -->
        <regexp>(?i)(.*?[\. _-]cd)(\d)(\.)(\w{3})$</regexp> <!-- group-40yearoldv-cd1.avi -->
        <regexp>(?i)(.*?cd)(\d)(\.)(\w{3})$</regexp> <!-- group-30doncd1.avi -->
        <regexp>(?i)(.*[\. _-])([abc])(\.)(\w{3})$</regexp> <!-- group-310ty-a.avi -->
        <regexp>(?i)(.*?)([abc123])(\.)(\w{3})$</regexp> <!-- group-outa.avi -->
        <regexp>(?i)(.*?)([abc123])([\. _-](?:xvid|divx|int)\.)(\w{3})$</regexp> <!-- group-moviea-xvid.avi -->
        <regexp>(?i)(.*)(\d{1,2})(\.)(\w{3})$</regexp> <!-- group-movie2.avi -->
        <regexp>(?i)(.*)(\d{1,2})([\. _-]\w{3,10}\.)(\w{3})$</regexp> <!-- movie1-grp.avi -->
        <regexp>(?i)(.*?[\. _-])(\d{1,2})(\.)(\w{3})$</regexp> <!-- movie-name-01.avi.avi -->
        <regexp>(?i)(.*?[\. _-]part)(\d{1,2})([\. _-].*?\.)(\w{3})$</regexp> <!-- Movie.name.DvDrip.Part1-group.avi -->

    </moviestacking>

</advancedsettings>

When I tried to reboot I ended up in a "relax, reboot" loop. I deleted the advancedsettings.xml file, restarted and the relax loop ended. Searching for 'relax reboot loop advancedsettings' didn't come up with anything useful. I assume a main source of the error were the OpenElec cpu/gpu settings.

Instead commenting various pieces out I decided to recreate the advancedsettings file more minimally with just the tvshowmatching settings I was looking for.

I extracted the tvshowmatching tags I was interested in and created this new, simpler advancedsettings.xml file

<advancedsettings>

  <tvshowmatching action="prepend"> <!-- Catch some troublesome formats before XBMC -->
    <!-- DIRFIX Handling -->
    <regexp>(?i)[\. _-]s(\d{1,2})[\. _-]?e(\d{1,2})(.*)dirfix</regexp> <!-- DIRFIX Handling show.name.S01E10E11.ep.name.here.DiRFiX.PROPER.HDTV.XviD-XEE-->
  </tvshowmatching>

  <tvshowmatching action="append"> <!-- XBMC has tried, now its our turn again -->
    <!-- Use the season number from the folder name and ep number from video file -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\]\D+[\. _-](\d{1,2})[\. _-]\D+</regexp> <!-- /Season 1/the_episode_8.avi HUGE potential for false positives. Comment out if you are unsure  -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\D\1(\d\d)(?!.*])</regexp> <!-- /Action/Season 1/Action101 Pilot.avi  Last (?!.*]) helps with anime false positives. not a perfect solution -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\](\d{1,2})\W([^/\\]*)</regexp> <!-- /UFO/Season 1/02.Computer.Affair.Divx e.g. lame sequntial numbering witout season  -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\Wep?\.?(\d{1,2})\W([^/\\]*)</regexp> <!-- /Ulysses 31/Season 1/Ulysses 31 E12 Trapped.avi e.g. lame sequntial numbering witout season  -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\W?episode\W?(\d{1,2})\W([^/\\]*)</regexp> <!-- /The Chronicles/Season 1/Chronicles.Of.01.The.episode.6.DVDRip.DivX-movies.avi  -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\Wpart\W?(\d{1,2})\W([^/\\]*)</regexp> <!-- /NASA Missions/Season 1/nasa.missions.part.3.hdtv.xvid-fqm.avi -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\Wchapter\W?(\d{1,2})\W([^/\\]*)</regexp> <!-- /The Young/Season 1/The.Young.Chapter.01.My.First.Adventure.DVDRip.XviD-SAiNTS.avi  -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?\1\W?x\W?(\d{1,2})([^/\\]*)</regexp> <!-- /season 5/Lost - 5 x 05.mkv  -->
    <regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\].*?s0?\1[ex.]{0,2}(\d{1,2})([^/\\]*)</regexp> <!-- /Season 1/Grange Hill S01xE01.avi  -->
  </tvshowmatching>

</advancedsettings>

This time I at least didn't run into the relax loop however the video information still can't be found.

Any ideas would be appreciated.

I've tried rescanning/updating the library in as many ways as possible. It seems to me the regexp's I'm using either aren't matching my files or they are and xbmc doesn't care.

It looks to me like this regex should work. Though I'm not even sure which type of regular expressions advancedsettings/xbmc is using.

<regexp>(?i)[/\\](?:s|season)\W?(\d{1,2})\D*[/\\](\d{1,2})\W([^/\\]*)</regexp> <!-- /UFO/Season 1/02.Computer.Affair.Divx e.g. lame sequntial numbering witout season  -->
<!-- Broken down regexp
   (?i)         - case insensitive?
   [/\\]        - either \ or /
   (?:s|season) - either s or S or season or Season
   \W?          - optional whitespace
   (\d{1,2})    - one or two digits - season ##
   \D*          - any number of non-digits (should this allow digits?)
   [/\\]        - either \ or /
   (\d{1,2})    - one or two digits - episode ##
   \W           - whitespace (required?)
   ([^/\\]*)    - anything but \ or /
-->

* UPDATE ** I found this

<tvshowmatching action="prepend">
     <regexp>Season[\._ ]([0-9]+)[\\/]([0-9]+)([^\\/]*)$</regexp>
 </tvshowmatching>

from '''wiki. xbmc. org/index.php ? title=TV_Shows_(Video_Library)#Examples'''

trying now to make it a little more robust. i've modified my regex to allow a little leniency.

Now it's case insensitive allows 's', 'season' or 'series' for the season folder name

<tvshowmatching action="prepend">
     <regexp>(?i)(?:s|season|series)[\._ ]([0-9]+)[\\/]([0-9]+)([^\\/]*)$</regexp>
 </tvshowmatching>

I've found www . debuggex . com to be very useful in building/breaking down the regular expressions.

1
<!-- ~/.xbmc/userdata/advancedsettings.xml: --->
<advancedsettings>
    <tvshowmatching action="prepend">
        <regexp>(?i)(?:s|season|series)[\._ ]([0-9]+)[\\/]([0-9]+)([^\\/]*)$</regexp>
    </tvshowmatching>
</advancedsettings>

Not a very exhaustive set of matching instructions. This will handle a tv show library in the format ".../Show Name/Season XX/YY show name.ext" as well as a few slight variations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.