Subscribe

Wiki Script-Minor Alter

  1. 2008-09-09 07:52:08 PDT
    I'm not sure if this is the best place for this but, I couldn't get one of the scripts to work on the site wiki for sorting Video files by name/season/episode so I altered the code slightly if anyone was having problems getting it to work. Basically I added a couple of regex for checking other patterns in the title name as well as preserved case. I alos could not for the life of me find out what |>, meant (I'm assuming it was just a join of some sort for the next line but it kept erroring on me).

    Anyway ... I created a single file with the original against my changes and just made a patch of that so if you want the changes either manually put them in, or create a new file with the code on the site and patch it using the patch file :)

    --- import.2.js 2008-09-09 08:25:41.000000000 -0600
    +++ import.1.js 2008-09-09 08:24:01.000000000 -0600
    @@ -2,11 +2,15 @@
    {
    var excludeSamples = true;
    var fixEpisodeNames = true;
    -
    - var patterns = [ /(.*)s(\d\d)e(\d\d)(\D.*)/i|>,
    - /(.*)s(\d\d)(\D)(.*)/i|>,
    - /(\D*)[\.|\-|_](\d)(\d\d)([\.|\-|_]\D.*)/i|>,
    - /(\D*)(\d)[^0-9](\d\d)(\D.*)/i|> ];
    +
    + var patterns = [ /(.*)s(\d\d)e(\d\d)(\D.*)/i,
    + /(.*)s(\d)e(\d\d)(\D.*)/i,
    + /(.*)s(\d)e(\d)(\D.*)/i,
    + /(.*|_*|-*)s(\d\d)e(\d\d)(\D.*)/i,
    + /(.*)s(\d\d)(\D)(.*)/i,
    + /(\D*)[\.|\-|_](\d)(\d\d)([\.|\-|_]\D.*)/i,
    + /(\D*)(\d)[^0-9](\d\d)(\D.*)/i ];
    +
    for(var i=0;i<patterns.length;i++){
    var match = patterns[i].exec(obj.title);
    if(match){
    @@ -29,7 +33,7 @@
    leftover = obj.title;
    }

    - var chain = new Array('Video', 'TV Shows');
    + var chain = new Array('Videos', 'Sorted TV Shows');
    chain.push(name);
    var paddedSeason = 'Season ' + padLeft(season, '0', 2);
    chain.push(paddedSeason);
    @@ -77,7 +81,7 @@
    name = removeStartingDashesAndSpaces(name);
    name = removeEndingDashesAndSpaces(name);

    - return toProperCase(name);
    + return name;
    }
    function removeStartingDashesAndSpaces(name){
    if(name.length == 0)
    @@ -99,12 +103,7 @@
    }
    return name;
    }
    -function toProperCase(s)
    -{
    - return s.toLowerCase().replace(/^(.)|\s(.)/g|>,
    - function($1) { return $1.toUpperCase(); });
    -}
    -
    +
    function padLeft(str, pad, count) {
    str += '';
    while(str.length < count){

    regards,
    Lonny
  2. 2008-09-12 23:52:58 PDT
    Posted a link to this on the mediatomb.cc wiki page that had the script examples. I also had the same problem and was trying to figure it out what the |> could possibly be. I fixed up the regexes according to the patch and everything works fine now.

    Thanks a bunch Lonny.

    -Eric
  3. 2008-11-04 02:10:21 PST
    I have now fixed the problem in the wiki by removing the javascript coloring. It added the mysterious |> characters.
Jump To:
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.