Recorded file name has wrong episode number (1 Viewer)

Doron

MP Donator
  • Premium Supporter
  • February 11, 2006
    206
    12
    Nahariya
    Home Country
    Israel Israel
    TV-Server Version:
    MediaPortal Version: 1.0 RC2 mediaportal-svn-09-06-2008--11-16-Rev20143
    MediaPortal Skin:
    Windows Version: XP Home
    CPU Type:
    HDD:
    Memory:
    Motherboard:
    Video Card:
    Video Card Driver:
    Sound Card:
    Sound Card AC3:
    Sound Card Driver:
    1. TV Card: ATI AIW 8500DV
    1. TV Card Type: analog
    1. TV Card Driver:
    2. TV Card: Hauppauge 150 MCE
    2. TV Card Type: analog
    2. TV Card Driver:
    3. TV Card:
    3. TV Card Type:
    3. TV Card Driver:
    4. TV Card:
    4. TV Card Type:
    4. TV Card Driver:
    MPEG2 Video Codec:
    MPEG2 Audio Codec:
    h.264 Video Codec:
    Satelite/CableTV Provider:
    HTPC Case:
    Cooling:
    Power Supply:
    Remote:
    TV:
    TV - HTPC Connection:


    I set recording of 3 programs, to be recorded evry day at the same time.
    In all of them, the names of the mpg and xml files always get an episode number which is higher by 1 than the correct number.
    The program info inside the recording's xml file is of the correct episode.


    For example,
    I attached the file "צעירים חסרי מנוח - 4573 - 2008-09-14 - 17_30.xml". The name is in Hebrew, but it means "Young and Restless episode 4573".
    Inside the file you can see the correct textual information, which means "episode 4572".
    The information in my tvguide.xml, also seems correct and points to episode 4572:

    <programme start="20080914173000 +0300" stop="20080914181000 +0300" channel="hot3">
    <title lang="he_IL">צעירים חסרי מנוח</title>
    <sub-title lang="he_IL">The Young and the Restless - *פרק 4572</sub-title>
    <desc lang="he_IL">אופרת סבון. פרק 4572: ג'ק עולה להעיד נגד ויקטור ומשתמש בכול האמצעים כדי להטות את דעת השופט. אשלי יוצאת מהמקום נסערת במהלך עדותו של ג'ק; ג'יי.טי פוגש את קווין בבית הקפה ומטיף לו על אופן ההתנהלות שלו.</desc>
    <category lang="he_IL">סדרה,אופרת סבון</category>
    <episode-num system="onscreen">4572</episode-num>
    </programme>
     

    Attachments

    • צעירים חסרי מנו&#1.xml
      31 KB

    Doron

    MP Donator
  • Premium Supporter
  • February 11, 2006
    206
    12
    Nahariya
    Home Country
    Israel Israel
    Is it only me? Is everyone else's episode numbers are correct?

    Maybe this may spread some light on my case -
    Initialy all series episodes were given names as if they were movies. To make them use the episode number, I copied the name setting in TvServer configuration from series to movies :
    %title% - %channel%\%title% - %episode% - %date% - %start%
     

    Doron

    MP Donator
  • Premium Supporter
  • February 11, 2006
    206
    12
    Nahariya
    Home Country
    Israel Israel
    Source code of the bug

    Ok, I think I have found the bug in the source code. The episode number is clearly being added 1. Maybe there was a reason for doing this, but that reason is probably relevent just in some cases.

    It is in file XMLTVImport.cs. In both cases below, you can see return Convert.ToString(epnum + 1).

    Code:
       string CorrectEpisodeNum(string episodenum)
        {
          if(episodenum == "")
            return episodenum;
    
          // Find format of the episode number
          int slashpos = episodenum.IndexOf("/", 0);
          if (slashpos == -1)
          {
            // No slash found => assume it's just a plain number
            try
            {
              int epnum = Convert.ToInt32(episodenum);
              return Convert.ToString(epnum + 1);
            }
            catch (Exception)
            {
              Log.WriteFile("XMLTVImport::CorrectEpisodeNum, could not parse '{0}' as plain number", episodenum);
            }
          }
          else
          {
            try
            {
              // Slash found -> assume it's formatted as <episode number>/<episodes>
              int epnum = Convert.ToInt32(episodenum.Substring(0, slashpos));
              int epcount = Convert.ToInt32(episodenum.Substring(slashpos + 1));
              return Convert.ToString(epnum + 1) + "/" + Convert.ToString(epcount);
            }
            catch (Exception)
            {
              Log.WriteFile("XMLTVImport::CorrectEpisodeNum, could not parse '{0}' as episode/episodes", episodenum);
            }
          }
          return "";
        }

    And CorrectEpisodeNum() is always being called, in the import function:
    (I don't know why the example says 'Episode #FFEE'. The number with 'onscreen' can be just '5'.)

    Code:
                          else if (nodeEpisodeNumSystem == "onscreen")
                          {
                            // example: 'Episode #FFEE' 
                            serEpNum = ConvertHTMLToAnsi(nodeEpisodeNum);
                            int num1 = serEpNum.IndexOf("#", 0);
                            if (num1 < 0) num1 = 0;
                            episodeNum = CorrectEpisodeNum(serEpNum.Substring(num1, serEpNum.Length - num1));
                          }
     

    Nephilim

    Extension Developer
    February 8, 2007
    805
    499
    Home Country
    Italy Italy
    Hi,

    it's correct becouse the episode numbers in the XMLTV format are 0 based.
    Look here.

    Bye,
    Nephilim
     

    Doron

    MP Donator
  • Premium Supporter
  • February 11, 2006
    206
    12
    Nahariya
    Home Country
    Israel Israel
    Thanks, but I must disagree.
    First of all practically I do get this problem. All recorded episode numbers are higher by 1.
    Second, I see tvguide.xml files, and the episode numbers for "onscreen" are not zero-based in those files.
    Last, because the meaning of "onscreen" is "the way it is displayed on screen".
    I see what you meant in the link that you sent. But it is about the "xmltv_ns" system, not about "onscreen".
    Regarding "onscreen" it says clearly:
    The other predefined system, onscreen, is to simply copy what the programme makers write in the credits


    Thanks again.
     

    Doron

    MP Donator
  • Premium Supporter
  • February 11, 2006
    206
    12
    Nahariya
    Home Country
    Israel Israel
    Who can fix this?

    This fix would be simply to remove 2 lines of calling CorrectEpisodeNum() for the 2 cases which are not "xmltv_ns".
    NephilimDM, are you authorized to do that?
     

    Doron

    MP Donator
  • Premium Supporter
  • February 11, 2006
    206
    12
    Nahariya
    Home Country
    Israel Israel
    Hello? Is there any programmer out there? It is a small fix. Can you do it please?
     

    Seidelin

    Retired Team Member
  • Premium Supporter
  • August 14, 2006
    1,755
    652
    Kgs. Lyngby
    Home Country
    Denmark Denmark
    I will try to get this bugfix implemented. Not sure it will make it into RC3 though.

    I added this bug to mantis. Thanks for a good bug report and possible solution.
     

    Broceliande

    Retired Team Member
  • Premium Supporter
  • April 26, 2006
    186
    2
    This fix would be simply to remove 2 lines of calling CorrectEpisodeNum() for the 2 cases which are not "xmltv_ns".
    NephilimDM, are you authorized to do that?


    Hi Doron , it looks like the issue you described was a bit forgotten, though it's in mantis.

    I agree with your arguements, only xmltv_ns should be 0 based.
    onscreen shouldn't.
    However i haven't check webepg's code since a pretty while and am not fully sure of the format james used. As far as i can remember episodes nums weren't decreased after they were parsed on web pages. So webepg users should have encountered the very same troubles than you did.

    Removing the calls of CorrectEpisodeNum(), when node system type differs <> xmltv_ns , is not the best way though.
    CorrectEpisodeNum() also does some parsing/conversion stuff on the nums. I don't wanna add redondant code so i guess i'll tune the method itself, by adding and extra parameter with the system used.

    This should be in next weekly release , if i found some free testers in the team to check the changes and may try with some different xmltv files.

    In any case we will fix it.

    Edit : just added a 'must be fixed" dll if you wanna test, just stop both tvservice/tvsetup bef4

    Thanx for your report,
    Eric
     

    Users who are viewing this thread

    Top Bottom