mc2xml and Episode Numbers (1 Viewer)

david_31262

Portal Member
September 21, 2015
13
1
62
Home Country
United States of America United States of America
(Media Portal 1.17)
I've been using mc2xml to get guide data from the "new" Microsoft servers. It generally works, but will go down occasionally. Considering that Media Center has been removed from Windows 10 I've been working on a switch to SchedulesDirect.

I'm still using mc2xml to pull data from SchedulesDirect. I haven't tried the schedules direct plug-in, but from reading I prefer mc2xml because it's using the newer schedulesdirect JSON database and also has the ability to flag new programs with an " *" in the title to allow for recording new episodes only. Plus, I didn't have to recreate my scheduled events.

I've been experimenting to figure out why episode numbers are not showing up, and poking around tvguide.xml it seems like xmltv doesn't like that mc2xml is putting two "episode-num" lines in the database (example below). If I remove the line with "<episode-num system="dd_progid">EP02695634.0003</episode-num>" then the episodes numbers display in the Media Portal GUI.

Is this an error on mc2xml, or should xmltv be smart enough to ignore the "episode-num" line it doesn't care about ?

Note: I also tried reversing the order of the two "episode-num" lines, but it didn't help.

=================================================
Program example from tvguide.xml:

<programme start="20170921200100 -0600" stop="20170921210000 -0600" channel="I21.1.34801.schedulesdirect.org">
<title lang="en">The Orville *</title>
<sub-title lang="en">About a Girl</sub-title>
<desc lang="en">The Orville travels to Bortus' planet; the crew debates controversial surgeries for newborns.</desc>
<credits>
<actor>Seth MacFarlane</actor>
<actor>Adrianne Palicki</actor>
<actor>Penny Johnson Jerald</actor>
<actor>Scott Grimes</actor>
<actor>Peter Macon</actor>
<actor>Halston Sage</actor>
<actor>J. Lee</actor>
<actor>Mark Jackson</actor>
<actor>Chad L. Coleman</actor>
<producer>Seth MacFarlane</producer>
<producer>Brannon Braga</producer>
<producer>David A. Goodman</producer>
<producer>Jason Clark</producer>
<producer>Liz Heldens</producer>
<guest>Norm Macdonald</guest>
<guest>Lamont Thompson</guest>
<guest>DeObia Oparei</guest>
<guest>Antonio Charity</guest>
<guest>Rena Owen</guest>
<guest>Jonathan Adams</guest>
<guest>D. Elliot Woods</guest>
</credits>
<date>20170921</date>
<category lang="en">Comedy drama</category>
<category lang="en">Science fiction</category>
<episode-num system="dd_progid">EP02695634.0003</episode-num>
<episode-num system="xmltv_ns">0.2.</episode-num>
<video>
<aspect>16:9</aspect>
<quality>HDTV</quality>
</video>
<audio>
<stereo>dolby digital</stereo>
</audio>
<new />
<subtitles type="teletext" />
<rating system="Canadian Parental Rating">
<value>14+</value>
</rating>
<rating system="USA Parental Rating">
<value>TV14</value>
</rating>
</programme>
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello

    Please read the posts here:
    UK: Atlas shutting down Radio Times feed from June 16 & also stopping free access to MetaBroadcast
    XMLTV Idiot's guide please....hoping there is one!!

    Is this an error on mc2xml...?
    Technically no.

    ...or should xmltv be smart enough to ignore the "episode-num" line it doesn't care about ?
    Unfortunately TV Server's XMLTV plugin is not that smart.

    Facts are:
    • TV Server's XMLTV plugin only takes the first episode-num element.
    • TV Server's XMLTV plugin doesn't support the dd_progid episode number system for reasons explained in the second link above.
    Therefore the season/episode numbers for the program that you gave as an example will not be imported, as you've noticed.

    Potential solutions:
    • remove all dd_progid lines; TV Server can't use them so there's no harm in getting rid of 'em
    • switch the order of the dd_progid and xmltv_ns lines
    ...which brings me to:

    Note: I also tried reversing the order of the two "episode-num" lines, but it didn't help.
    That should have worked! (y)

    Therefore I suspect you may have missed something else.

    Make sure you:
    • switched the order of a program that:
      • shows in the future (the XMLTV plugin doesn't import past program details)
      • is associated with a mapped channel (ie. a guide channel which is associated with a TV Server tunable/visible-in-guide channel)
    • after making the change:
      • saved and re-imported the XMLTV file
      • waited for the import to complete (can take several minutes; the more channels you have, the longer it takes)

    Also, very important: how are you determining whether season/episode numbers are imported successfully?
     

    david_31262

    Portal Member
    September 21, 2015
    13
    1
    62
    Home Country
    United States of America United States of America
    Thanks for the comments.

    Also, very important: how are you determining whether season/episode numbers are imported successfully?

    I have the media portal GUI configured to display the Episode Title and Number in the guide. So, I:
    1) stopped the TV server
    2) edited tvguide.xml (removing the dd_progid lines)
    3) restarted the TV server
    4) went into the TV server configuration xmltv and force loaded the guide
    5) went into media portal and looked at the TV guide (with the mod I'm seeing the episode numbers in the guide)

    I had initially tried the same experiment with the reverse order of the "episode-nun" entries experiment. I didn't notice any change. Perhaps that was some error on my part. I'll have to try this again.

    I did E-Mail the author of mc2xml (I contributed to him a couple of times). He did respond. He doesn't seem inclined to change something that he doesn't think is his bug.

    I'll play around with it some more. I just mass edited the tvguide.xml (with a quick/dirty emacs macro) and removed all the offending lines. I now have lots of episode numbers showing in the media portal guide. I have a timer setup for tonight and will hopefully now get the episode number as part of the recorded file name.

    I may have to batch up a script to do the edit automatically 5 minutes after the guide update is scheduled to run.
     

    dazedcrazy

    New Member
    January 31, 2016
    2
    1
    54
    Home Country
    Afghanistan Afghanistan
    I just use a powershell script to fix it

    1.ps1
    PHP:
    C:\path\to\mc2xml.exe -J USERNAME:PASSWORD -U -u -d 52 -D C:\path\to\first.dat -C C:\path\to\first.chl -R C:\path\to\first.ren -o C:\path\to\firstoutput.xml

    2.ps1
    PHP:
    C:\path\to\mc2xml.exe -J USERNAME:PASSWORD -U -u -d 52 -D C:\path\to\second.dat -C C:\path\to\second.chl -R C:\path\to\second.ren -I C:\path\to\firstoutput.xml -o C:\path\to\mergedoutput.xml

    3.ps1
    PHP:
    Get-Content C:\path\to\tvguide.xml | Where-Object {$_ -notmatch '>Movie<'} | Where-Object {$_ -notmatch 'dd_progid'} | % { $_ -replace '>football<', '>American Football<' } | % { $_ -replace '>soccer<', '>Football<' } | Set-Content C:\path\to\fixed-tvguide.xml

    4.p1
    PHP:
    C:\path\to\WG2MP.exe C:\path\to\fixed-tvguide.xml "C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv\tvguide.xml"

    Have a master.p1 that i run from task scheduler
    PHP:
    &"$PSScriptroot\1.ps1"
    &"$PSScriptroot\2.ps1"
    &"$PSScriptroot\3.ps1"
    &"$PSScriptroot\4.ps1"

    So 1.ps1 grabs epg, 2.ps1 grabs epg from somewhere else and merges with 1 to output a single xml, 3.ps1 then removes and replaces stuff, 4.p1 then runs WG2MP.exe to do a final fix on it way to tvserver xmltv folder. Probably over complicated for a simple task but it works. I have moved to xmltv.exe over mc2xml.exe and requires 1 less ps1
     

    david_31262

    Portal Member
    September 21, 2015
    13
    1
    62
    Home Country
    United States of America United States of America
    I just use a powershell script to fix it
    Thanks for posting this. I looked at using powershell to rework the mc2xml file, but got turned off by having to modify my powershell user permissions on the PC. I ended up just using a single .bat script which I'll attach below. I've changed my tv guide update daily scheduler to call this bat file under my (admin) users permissions pointing it all to the folder where I do my mc2xml tv stuff.

    When I have a few minutes I'll look over your powershell version for my own edification. I realize it's a much more powerful tool. You're also pulling guide info from multiple sources which is cool (but not something I need at this time).

    I'm also still considering reporting a bug on xmltv. It seems like is should be smart enough to ignore the extra episode-num lines.

    My .bat file:
    Code:
    mc2xml.exe -J USERNAME:PASSWORD -o tvguide_raw.xml -d 360 -a
    findstr /V "dd_progid" tvguide_raw.xml > tvguide_epfixed.xml
    del tvguide.xml
    ren tvguide_epfixed.xml tvguide.xml
     

    dazedcrazy

    New Member
    January 31, 2016
    2
    1
    54
    Home Country
    Afghanistan Afghanistan
    If you use xmltv.exe instead of mc2xml.exe it puts the <episode-num system="xmltv_ns"> first so it's read first and you'll see season/episode in mediaportal
    Similar to above i use powershell for this too
    1.ps1
    PHP:
    C:\xmltv\xmltv.exe tv_grab_zz_sdjson --days 3 --output C:\xmltv\guide.xml
    2.ps1, removing <episode-num system="dd_progid"> isn't needed but i do it anyway
    PHP:
    Get-Content C:\xmltv\guide.xml | Where-Object {$_ -notmatch 'dd_progid'} | % { $_ -replace '>football<', '>American Football<' } | % { $_ -replace '>soccer<', '>Football<' } | Set-Content C:\xmltv\fixed-guide.xml
    3.ps1
    PHP:
    C:\xmltv\WG2MP.exe C:\xmltv\fixed-guide.xml "C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv\tvguide.xml"
     

    Philip Churchill

    Portal Member
    August 2, 2012
    17
    0
    58
    Home Country
    United Kingdom United Kingdom
    Thanks for posting this. I looked at using powershell to rework the mc2xml file, but got turned off by having to modify my powershell user permissions on the PC. I ended up just using a single .bat script which I'll attach below. I've changed my tv guide update daily scheduler to call this bat file under my (admin) users permissions pointing it all to the folder where I do my mc2xml tv stuff.

    When I have a few minutes I'll look over your powershell version for my own edification. I realize it's a much more powerful tool. You're also pulling guide info from multiple sources which is cool (but not something I need at this time).

    I'm also still considering reporting a bug on xmltv. It seems like is should be smart enough to ignore the extra episode-num lines.

    My .bat file:
    Code:
    mc2xml.exe -J USERNAME:PASSWORD -o tvguide_raw.xml -d 360 -a
    findstr /V "dd_progid" tvguide_raw.xml > tvguide_epfixed.xml
    del tvguide.xml
    ren tvguide_epfixed.xml tvguide.xml

    could you explain how do set this up please also where and what is your tv guide update daily scheduler and do you use task scheduler for the bat file?
     

    wjw

    Portal Pro
    July 13, 2008
    380
    44
    Home Country
    United Kingdom United Kingdom
    This has been covered elsewhere and MM1352000 gave you some pointers to follow. It's not a bug in xmltv. However, if you're still struggling - as I did - here is my .bat file to get the daily grab and modify it to remove the problem line:

    cd C:\Users\john\Desktop\XMLTVstuff
    C:\Users\john\Desktop\XMLTVstuff\mc2xml
    C:\Users\john\Desktop\XMLTVstuff\XMLTV\xmltv-0.5.68-win32\SED "/"dd_progid"/d" C:\Users\john\Desktop\XMLTVstuff\xmltv.xml > C:\Users\john\Desktop\XMLTVstuff\tvguide.xml

    Use Task Scheduler to run this daily at whatever time you want.

    Obviously you will need to change all the locations to your own and you will need to download the SED software into your chosen location.

    Hope this helps.
     

    Anthony Gagnon

    MP Donator
  • Premium Supporter
  • March 11, 2016
    26
    2
    123
    Home Country
    United States of America United States of America
    Should this forum post be marked as Solved?
    Is there any downside with removing lines with "dd_progid" from the tvguide.xml file in MP1?
    It seems the discussion implies they are ignored.
     
    Last edited:

    dabineri

    Portal Pro
    February 16, 2013
    82
    0
    80
    Home Country
    United States of America United States of America
    WJW, Thank you for all your suggestions. I am making progress but it is not yet working for me.

    I see, in your batch file, that you rename the xml file to tvguide.xml which I believe is the file that the mp plugin is looking for.

    I do have the SED program in the same folder with all the xml stuff.

    In TV Server, when I click the import button on the plugin screen, nothing seems to happen, the status below the import button id not listed. There is no progress bar so I don't know how long I should expect it take to import.

    If I use the IMPORT button under the Import/export tab then I get the attached error.

    So, bottom line is that I cannot get the tv schedule into mp from sd yet.

    What might I be missing here?

    Thanks for all your advice.
     

    Attachments

    • status.PNG
      status.PNG
      31.5 KB
    • error importing.PNG
      error importing.PNG
      145.2 KB

    Users who are viewing this thread

    Top Bottom