XMLtv Channel tag Replacer Python script.

Discussion in 'xmlTV' started by gibman, March 9, 2007.

  1. gibman
    • Premium Supporter

    gibman Retired Team Member

    October 4, 2006
    Likes Received:
    +1,372 / 0
    Home Country:
    Denmark Denmark
    What a sucky subject tagline I know hehe.

    I have attached a python script that helps me replace user-defined tags within the tvguide.xml file with my own.

    ex. I want to change all the occurences of channel="TV2.dr.dk" to

    <programme channel="TV2" start="20070303181000 +0100">

    Why do I want this ? In order to have MP map the XMLTV epg data to the right channel, the "channel" XML tag needs to have the same name/value as the associated channelname within MP. So they need to match each other.

    Often you can configure the .config files of the perl/python XMLtv grabber scripts to change the channelnames to your needs.
    But in my case this is not possible.
    I use multiple tv grabbers.
    This is a way for me to have the channel name mapping configuration defined in one file.

    The python script can in theory do search/replace on all kinds of files.
    It is not limited to XML files in any way.

    U need to DL python for windoze.

    run the replace.py file.
    config is replacevalues.py (edit it)

    'channel="hallmark.dr1.dk"' : 'channel="Hallmark"',

    The parser will look for all occurences of channel="hallmark.dr1.dk" and replace them all with channel="Hallmark"

    It is possible to do a "python to exe" thing, for those who are lazy.
    Although the replacevalues.py should be changed to a replacevalues.config file, otherwise it will be compiled into the final EXE.

    • Like Like x 1
  2. Google AdSense Guest Advertisement

    to hide all adverts.
  3. mayankel

    mayankel Portal Member

    January 25, 2006
    Likes Received:
    +0 / 0
    Home Country:
    Spain Spain
    Great job, gibman...

    I've tried today and it works perfect for me, but i have one question:

    I want to replace every <sub-title>year</sub-title> to <date>year</date>, where "year" is a number, usually betwen 1950-2007, so i can make 57 translation, (i.e. <sub-title>1951</sub-title> to <date>1951</date>...) and i'm sure it works, but could i use any "*" or somethig to make: <sub-title>1***</sub-title> to <date>1***</date>.

    Thanks and best regards

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!