mc2xml (media center TV Listings to XMLTV.xml)
bookmark: http://mc2xml.tk
mc2xml is a small and fast command line program for Windows, Linux and OSX that can download TV listings from media center, metabroadcast, rovi cloud, perc data, schedules direct, titantv, tvmedia, and xbox oneguide and convert them to an XMLTV formatted (xmltv.dtd) .xml file.

mc2xml options (case sensitive):

-aappend " *" to new programs
-Aappend " *" to live programs
-bappend " *" to not new programs
-Foutput channel "name" first (rather than "number name")
-Linclude <live /> tag (not part of xmltv.dtd)
-uoutput date/time in UTC (default = localtime)
-Uoutput UTF-8 (default = "ISO-8859-1")
-fforce re-download on media center service (use responsibly)
-d <#> set listings duration (in hours)
-s <[+/-]#> set listings relative start position (in hours)
-c <code> set country code
-g <code> set postal/zip code
-w <seconds> wait for <seconds> and exit
-r <key>:<secret> use rovi cloud service (requires consumer key & secret)
-t <id> use titantv service (requires 30 character id)
-V <apiKey> use tvmedia xmltv service (requires api key)
-M <apiKey> use metabroadcast service (requires api key)
-P <user>:<pass> use perc data service
-T <user>:<pass> use schedules direct service
-J <user>:<pass> use schedules direct json service
-i <#> increment all channel numbers by <#>
-I <xmltv file> include <xmltv file> in output
-R <filename> set ren filename (default = "mc2xml.ren")
-D <filename> set dat filename (default = "mc2xml.dat")
-C <filename> set channel file (default = "mc2xml.chl")
-o <filename> set output file (default = "xmltv.xml")

mc2xml quickstart: (see also: FAQ: nextpvr, mythtv, mediaportal, ...)

  • Windows:

    1. Run "mc2xml", it has a simple graphical user interface
    2. Input postal code and country code and press OK
    3. Select lineup number from the returned list and an xmltv.xml file will be produced

  • Other OSs and command line usage:

    1. Run mc2xml with -c and -g parameters to set country & postal/zip code

      • -r is optional, and requires a consumer key & secret (-c & -g are required)
      • -t is optional, and requires a 30 character titantv uuid (-g is required)
      • -V is optional, and requires a tvmedia API key (-c & -g are not needed)
      • -M is optional, and requires a metabroadcast API key (-c & -g are not needed)
      • -P is optional, and requires an PD account user:pass (-c & -g are not needed)
      • -T is optional, and requires an SD account user:pass (-c & -g are not needed)
      • -J is optional, and requires an SD account user:pass (-c & -g are required)
      • -U is required for languages that contain non ISO-8859-1 characters

    2. Select lineup number from the returned list and an xmltv.xml file will be produced

  • mc2xml setup examples (postal/zip codes are formatted for media center services):

    • US: mc2xml -c us -g 20006
    • CA: mc2xml -c ca -g M1N2K3
    • GB: mc2xml -c gb -g "SW1X 7LA"

    • AT: mc2xml -c at -g 1000
    • BE: mc2xml -c be -g 1000
    • BR: mc2xml -c br -g 20010-020
    • CH: mc2xml -c ch -g 1000
    • CZ: mc2xml -c cz -g "100 10"
    • DE: mc2xml -c de -g 10000
    • DK: mc2xml -c dk -g 1000
    • ES: mc2xml -c es -g 28000
    • FI: mc2xml -c fi -g 10000
    • FR: mc2xml -c fr -g 10000
    • IE: mc2xml -c ie -g 0
    • IL: mc2xml -c il -g 10000 -U
    • IN: mc2xml -c in -g 110000
    • IT: mc2xml -c it -g 00100
    • JP: mc2xml -c jp -g 1028000 -U
    • KR: mc2xml -c kr -g 100 -U
    • MX: mc2xml -c mx -g 22440
    • NL: mc2xml -c nl -g 1000
    • NO: mc2xml -c no -g 1000
    • PL: mc2xml -c pl -g 11-111
    • PT: mc2xml -c pt -g 1000
    • RU: mc2xml -c ru -g 101000 -U
    • SE: mc2xml -c se -g "100 10"
    • SK: mc2xml -c sk -g "100 10"
    • TR: mc2xml -c tr -g 01000 -U
    • TW: mc2xml -c tw -g 10000 -U

 
Downloads (v1.6)
v1.6: added perc data,
fix ISO-8859-1

Media Center Services - North America
After 10 years of Media Center legacy support Microsoft has switched their EPG provider for their North American listings from Zap2It to Rovi and have not updated their legacy service (listings run out on 2015/09/30).

zap2xml is an alternative way to get listings from Zap2it. There are also other services from which to get TV listings.

Donators using the Media Center Win7+ or OneGuide service will get listings from Rovi for North America, see here if you are having any problems.

Media Center Services - Outside North America
The Media Center legacy and Win7+ services are once again being updated after experiencing sporadic update issues. A Microsoft representative posts update notices here.

Windows (x86)
mc2xml.exe (979456 bytes)
MD5SUM: c7126ed52c319b073cc7acb6c1e57ea8
Linux (x86)
mc2xml (1277320 bytes)
MD5SUM: e255edcf19bdc43d14a48913458a6a27
OSX (x86)
mc2xml (1019904 bytes)
MD5SUM: d77c0e233bab5aa3710cbc70b1ee071d
downloads require javascript


  • please do not mirror or redistribute files; integration within other package distributions prohibited without consent. (mc2xml is for single end-user personal use.)
  • avoid malicious code by always downloading from the homepage and checking the hash!
  • verify downloaded filesize to make sure your download is complete! if the program doesn't work ("not a valid application" or "program too big to fit" error) the download was interrupted and left incomplete!
  • some anti-virus programs (like norton or windows defender) can view compressed executables as potential threats or trigger a false positive warning: mc2xml is compressed for size

DonationWare: If this software is useful to you please donate!
This software is not crippled, but it is not freeware either. If you determine that it is useful to you please donate an appropriate amount. If it isn't useful, then you probably won't be using it! :)

Service information

  1. Microsoft media center legacy service: Vista Media Center (and all previous versions of media center) offer Satellite, Cable and NTSC listings for many countries, but the data service might not fully support ATSC with subchannels for the North American market. Microsoft calls this the "legacy service".

  2. Metabroadcast ATLAS service: is a free service for UK TV listings. More info is here.

  3. Rovi Cloud service is a media API platform (with 30 day trial) for TV listings in many countries, more info is here.

  4. Perc Data service: is a subscription based service (with 7 day trial) for TV listings in North America from TMS/Gracenote. It uses the same data source as Schedules Direct. More info is here.

  5. Schedules Direct service: is a subscription based service (with 7 day trial) for TV listings in North America (and additional regions) from TMS/Gracenote. More info is here.

  6. Schedules Direct JSON service: is a subscription based service (with 7 day trial) for TV listings in many countries from TMS/Gracenote. This service has season/episode information and some other data not available in their standard service. An SD account works on both SD services. See here for more information.

  7. TitanTV service: offers TV listings for the US market only. The listings are good and the ATSC service seems complete, but the program details are not as robust as the media center service. More info is here.

  8. TVMedia XMLTV service: is a subscription based service (with 14 day trial) for TV listings for North America only. More info is here.

  9. Microsoft media center Win7+ service: If you have used Windows 7 or 8 you might have noticed more program information in the guide. It uses a completely new TV data service that seems to support everything that the microsoft legacy service supported* ----------------------------------------------------------------------- The North American data supplied by Rovi currently doesn't have star-ratings for movies and some other minor tags. There are tickets in the MS connect system. https://connect.microsoft.com/site1145/Feedback , but adds full ATSC/subchannel support ("OTA") for the US & Canada, plus listings include writer/producer credits, program images , as well as other miscellaneous program details. (note: Microsoft might have a North American focus?)

    Support for this new service in mc2xml is working, and now donators above the $20 level are welcome to request this version if they want to try it out (please specify operating system).

    (PBS offers mugs for donations; I don't have a mug for you but maybe this additional incentive will entice you to donate for the work that goes into mc2xml :) )

    2015-07-07: MS swiched EPG providers for certain countries and say they are working on the remaining conversion/lineup issues. Send an email (from same address) if you have any problems/errors (12435R/string error).
    2015-08-11: MS has added ampersands to the program images. Send an email if your PVR software has any problems importing the xmltv file (due to the icon tag with unencoded &amp;) and I will reply with an update that encodes/fixes it (a quick fix if your PVR doesn't use images: sed "/<icon/d" xmltv.xml > xmltv.out )
    There haven't been any fixes/changes to this service since 2015-08-11

    Incentive option #2 for users that would prefer a specialized linux binary for a system architecture other than x86, a cross compiled binary could be attempted. (example: mips32/lsb/uclibc, linux arm (rpi), etc) (Ensure the system has sufficient RAM!) Note: zap2xml is also available for any systems that have perl.


  10. Xbox OneGuide service: is a TV listings service for many countries. This MS service uses the same Rovi supplied guide data as the MS Media Center service but it targets real time interaction rather than bulk schedule downloads (the Media Center service has smaller pre-packaged daily downloads). Donators at the >$30 level are welcome to request support for this service. I'm not sure if it will add much value over the Media Center Win7+ service for most users. More info on service differences are here (you can view your local listings on the MSN website).

General information

  • mc2xml will save your lineup selection (and user/password and API key if required by the chosen service) to "mc2xml.dat" in the current working directory. (It does not save -o or other input/output optional parameters other than -U, -u, -F, -A, -a)

  • Run "mc2xml" from the directory where "mc2xml.dat" is located whenever you want to output a new xml file. No command line parameters are required once the "mc2xml.dat" file has been created if you use the default input/output filenames (mc2xml.chl, xmltv.xml, etc).

  • To save bandwidth, the "mc2xml.dat" file also saves the version number of the listings when using one of the media center services. If you run mc2xml again and the listings have not been updated on the server, they will not be downloaded again ("No new data available").

    If you need to temporarily force a re-download on the media center services the -f option can be used, but since this can contribute to the overloading of the servers it isn't recommended for regular use.

    It appears that media center server listings are only updated once a day at most, sometimes less frequently (and never on sunday's).

  • If you want to limit which channels are output in your xml file you can create a "mc2xml.chl" text file (in the same directory as mc2xml.dat). The channel inclusion and exclusion lists are initially empty so all channels will be included. Specifying channel numbers, channel number ranges, channel names, or channel ids on separate lines will create an inclusion list (perl style regular expressions are supported for names/ids). If the first character of a line is a "-" it will be added to the exclusion list (which is the first list consulted in the case of overlap). If you only want to select channels to exclude, only use lines that start with "-" and leave the inclusion list empty.

     mc2xml.chl 
    # include channel 5
    5
    # include channels 9 to 15 (inclusive)
    9-15
    # exclude channel 10
    -10
    # include channels 17 to 21.2 (inclusive)
    17-21.2
    # include channels named HBO
    HBO
    # exclude these channel names, escape first character of name if a digit
    -[3]DTV
    -LOOR
    # exclude these channel names, match regular expression
    -PPV(\d+)
    # include the channel that matches this channel id
    I20.515292.microsoft.com
    # include channels that match the channel id regular expression
    I51.*xboxlive.com
    I.*ec3dc96d-83da-c806-0ad0-7b566372a57a.xboxlive.com

  • If you want to rename some channel numbers or names you can create a "mc2xml.ren" text file (in the same directory as mc2xml.dat) listing the colon separated from:to channel numbers or names on separate lines:

    (the "from" can also be a channel id, to distinguish duplicate channel numbers or names)

     mc2xml.ren 
    605:2
    BBC1:BBC News
    I20.515292.microsoft.com:55

F.A.Q.
sd
  • How do I use the Schedules Direct service?

    • Sign up for an account and select your lineups and channels on the website
    • Use the -T user:pass mc2xml command line parameter (user:pass is saved in mc2xml.dat, pass can not contain a colon). On Windows the user & pass can be input in the graphical interface.
    • Default is 7 day download (you can change this with the -d <hours> command line parameter).


sd
  • How do I use the Schedules Direct JSON service?

    • Sign up for an account
    • To minimize the amount of data needed to be downloaded you can use an mc2xml.chl text file to limit the number of channels in your lineup, or limit the number of hours of schedule data (using the -d <hours> parameter). All available data for all channels in a lineup is downloaded by default. Data is not cached, so this isn't quick if you are requesting a lot of data and the server is heavily loaded.
    • Downloading multiple lineups would require the use of multiple .dat files (note: SD allows 4 lineups stored per account at once, and 6 lineup changes (add or delete) per day, but mc2xml only downloads the one stored in the current mc2xml.dat file)
    • If you wish to delete all but the current lineup from your account you can use the --delete-lineups parameter. Any lineup deletions will count towards your 6 lineup change per day limit.
    • This service sends data in chunks and mc2xml uses 4 parallel threads if there is a large amount of data (depending on the number of channels/programs/days of schedule you have requested). You can limit this with the --max-threads=# parameter if needed.
    • Episode images are within the program data and will be output as program icon urls. If you want more program icon urls (movies/shows/sports), use the --sdjs-images optional parameter; this will request more server data and take more time
    • If you want to use a user-agent string you can set the USERAGENT environment variable (set USERAGENT=email or any string) before running mc2xml (requires latest version)
    • The country and postal/zip code formats supported by the Schedules Direct JSON service are in the following table of examples: The -J parameter sets your user and password (passwords can not contain a colon), -U outputs UTF8 characters instead of ascii. On Windows the graphical interface has input boxes for these options, but you must follow the expected postal/zip code format.


    • US: mc2xml -J user:pass -U -c us -g 12345
    • CA: mc2xml -J user:pass -U -c ca -g H0H0H0
    • GB: mc2xml -J user:pass -U -c gb -g CF31

    • AI: mc2xml -J user:pass -U -c ai -g AI-2640
    • AG: mc2xml -J user:pass -U -c ag -g AG
    • AR: mc2xml -J user:pass -U -c ar -g A4190
    • AT: mc2xml -J user:pass -U -c at -g 6886
    • AW: mc2xml -J user:pass -U -c at -g AW
    • BB: mc2xml -J user:pass -U -c bb -g BB14001
    • BM: mc2xml -J user:pass -U -c bm -g CR01
    • BQ: mc2xml -J user:pass -U -c bq -g BQ
    • BR: mc2xml -J user:pass -U -c br -g 01419
    • BS: mc2xml -J user:pass -U -c bs -g BS
    • BZ: mc2xml -J user:pass -U -c bz -g BZ
    • CH: mc2xml -J user:pass -U -c ch -g 3303
    • CL: mc2xml -J user:pass -U -c cl -g 1000000
    • CO: mc2xml -J user:pass -U -c co -g CO
    • CR: mc2xml -J user:pass -U -c cr -g 10101
    • CW: mc2xml -J user:pass -U -c cw -g CW
    • DE: mc2xml -J user:pass -U -c de -g 14050
    • DK: mc2xml -J user:pass -U -c dk -g 9260
    • DM: mc2xml -J user:pass -U -c dm -g DM
    • DO: mc2xml -J user:pass -U -c do -g 10101
    • EC: mc2xml -J user:pass -U -c ec -g 170950
    • ES: mc2xml -J user:pass -U -c es -g 28001
    • FI: mc2xml -J user:pass -U -c fi -g 91980
    • FR: mc2xml -J user:pass -U -c fr -g 38800
    • GD: mc2xml -J user:pass -U -c gd -g GW
    • GT: mc2xml -J user:pass -U -c gt -g 01001
    • GY: mc2xml -J user:pass -U -c gy -g GY
    • HN: mc2xml -J user:pass -U -c hn -g HN
    • IT: mc2xml -J user:pass -U -c it -g 00100
    • JM: mc2xml -J user:pass -U -c jm -g JMAAW01
    • KN: mc2xml -J user:pass -U -c kn -g KN
    • KY: mc2xml -J user:pass -U -c ky -g KY1-0001
    • LC: mc2xml -J user:pass -U -c lc -g LC
    • MX: mc2xml -J user:pass -U -c mx -g 11500
    • NO: mc2xml -J user:pass -U -c no -g 0001
    • PA: mc2xml -J user:pass -U -c pa -g PA
    • PE: mc2xml -J user:pass -U -c pe -g 23006
    • PR: mc2xml -J user:pass -U -c pr -g 0061
    • SE: mc2xml -J user:pass -U -c se -g 10005
    • SX: mc2xml -J user:pass -U -c sx -g 97150
    • TC: mc2xml -J user:pass -U -c tc -g TKCA1ZZ
    • TT: mc2xml -J user:pass -U -c tt -g TT
    • UY: mc2xml -J user:pass -U -c uy -g 11000
    • VC: mc2xml -J user:pass -U -c vc -g VC0100
    • VE: mc2xml -J user:pass -U -c ve -g 1010
    • VG: mc2xml -J user:pass -U -c vg -g VG1110


pd
  • How do I use the Perc Data service?

    • Sign up for an account and select your lineups and channels on the website
    • Use the -P user:pass mc2xml command line parameter (user:pass is saved in mc2xml.dat, pass can not contain a colon). On Windows the user & pass can be input in the graphical interface.
    • Default is 7 day download (you can change this with the -d <hours> command line parameter).


tvmedia
  • How do I use the TVMedia XMLTV service?

    • TVMedia is a source for North American TV listings which can be viewed online at TV Passport
    • Sign up on their xml service and select your lineups, and get an API Key. Input that key into mc2xml with the -V <apiKey> parameter and all selected lineups will be downloaded and output into an xmltv.xml file. On Windows this can be done through the graphical interface.
    • All selected lineups are output in a single xmltv.xml file
    • If you have conflicting channel numbers over multiple lineups you can use the mc2xml.ren channel rename feature.


TITANTV
  • How do I use the TitanTV service?

    • TitanTV is a source for US TV listings
    • Add -t <id> -g <zipcode> to the command line when initially selecting your lineup. Service selection, id and zipcode are saved in mc2xml.dat On Windows this can be input in the graphical interface.
    • The xml service requires your 30 character ID (not the same as a username on their web service). If your ID has expired you will receive a "-t" error and will need to delete the mc2xml.dat file and specify another (or find one on ye olde interweb).
    • This service doesn't seem to compress its listings so the downloads can be large
    • By default a week of listings are downloaded, but this is configurable with the -d <hours> parameter
    • This service occasionally seems slow or overloaded (or is running on a 286?) so if it is taking a few minutes to connect or download, it isn't stuck!, it really is just that slow
    • When the service is so busy that it is rejecting connections a status message is displayed and mc2xml will immediately exit with code 2 (to aid retry scripts)


metabroadcast
  • How do I use the Metabroadcast ATLAS service?

    • Metabroadcast ATLAS is a source for UK TV listings
    • Sign up on their ATLAS service and get your free API Key. On the website (Atlas Administration) create an application and enable "UK Channel Lineups" and "PA" for that application/API key and SAVE it. Input that API key into mc2xml with -M <apiKey> and you can select a lineup from their regional channel groups. On Windows this can be done through the graphical interface.
    • If you want the iPlayer/4OD/etc url links in the xmltv output you would need to request access to those services for your API key
    • To minimize the amount of data needed to be downloaded you can use an mc2xml.chl text file to limit the number of channels in your lineup, or limit the number of hours of schedule data. Seven days of data for all channels in a lineup is downloaded by default (but can be increased/decreased with the -d <hours> parameter). Data is not cached, so this isn't quick if you are requesting a lot of data and the server is heavily loaded.
    • This service sends data in chunks and mc2xml uses 4 parallel threads if there is a large amount of data (depending on the number of channels/programs/days of schedule you have requested). You can limit this with the --max-threads=# parameter if needed.
    • If you know the atlas channel ids you'd like to download and do not want to use the lineup selection you can use the optional --atlas-channels= parameter to manually specify the comma delimited list of ids (example: --atlas-channels=hkq7,hkrh,hkvb)

rovi
  • How do I use the Rovi Cloud service?

    • Rovi Cloud is a media API platform with TV listings for many countries
    • Sign up and get your trial Consumer Key and Consumer Secret (64 char keys). They are listed in the My Account -> Entitlements section of their website.
    • Select a lineup using a country code and a postal/zip code following the format in the table below (the key/secret/zip/country are saved to the mc2xml.dat file). On Windows this can be done through the graphical interface.
    • This service targets real time interaction rather than bulk downloads. There is a limit on the number of requests one can make per day (10,000 on trial), and most program detail (aside from the title and airing time) must be requested individually per program. This adds up very quickly if you have a lot of channels or hours of schedule data, therefore this service (on trial) is not appropriate for daily collecting of 14 days of schedule data for a full lineup of channels with complete detail.
    • To minimize the amount of data needed to be downloaded you can use an mc2xml.chl text file to limit the number of channels in your lineup, or limit the number of hours of schedule data (using the -d <hours> parameter). 24 hours of data for all channels in a lineup is downloaded by default. Data is not cached, so this isn't quick if you are requesting a lot of data and the server is heavily loaded.
    • This service sends data in chunks and mc2xml uses 4 parallel threads if there is a large amount of data (depending on the number of channels/programs/days of schedule you have requested). You can limit this with the --max-threads=# parameter if needed (Rovi has limited requests per second). The download progress dots can be suppressed with --no-progress
    • This service offers a downloadable template.json file describing the current service URLs to use. There are defaults built in to mc2xml, but you can optionally use this file with the --rovi-template=<template.json> parameter.
    • Because program detail must be requested per program you can specify which additional information you want by appending the appropriate optional command line parameters. Remember, this requests information for every program! (1 http request per program per tag type). If on trial it is recommended to start with a very limited number of channels in your mc2xml.chl file, a low number of -d <hours>, and to use a minimal number of optional command line parameters. (mc2xml will print the number of scheduled programs in the console output so you can calculate how many requests it would take to get the detail you want)

      • --rovi-airing adds program ratings and HD video tags to all programs
      • --rovi-airing_synopses adds program descriptions to all programs
      • --rovi-airing_credits adds program cast credits to all programs

      • --rovi-episode adds categories, year, and season/episode #'s to "episode" program types (requires --rovi-airing)
      • --rovi-movie adds categories and year to "movie" program types (requires --rovi-airing)
      • --rovi-other adds categories and year to "other" program types (requires --rovi-airing)
      • --rovi-series adds categories to "series" program types (requires --rovi-airing)

      Example (after having selected a lineup and created a chl file):
      mc2xml -d 24 -C small.chl --max-threads=1 --rovi-airing_synopses


    • US: mc2xml -r key:secret -U -c us -g 12345
    • CA: mc2xml -r key:secret -U -c ca -g "H0H 0H0"
    • GB: mc2xml -r key:secret -U -c gb -g CF31
    • AG: mc2xml -r key:secret -U -c ag -g 0
    • AR: mc2xml -r key:secret -U -c ar -g A4190
    • AT: mc2xml -r key:secret -U -c at -g 6886
    • AW: mc2xml -r key:secret -U -c at -g 0
    • BB: mc2xml -r key:secret -U -c bb -g 0
    • BE: mc2xml -r key:secret -U -c be -g 1000
    • BM: mc2xml -r key:secret -U -c bm -g 0
    • BO: mc2xml -r key:secret -U -c bo -g 0
    • BR: mc2xml -r key:secret -U -c br -g 01000001
    • BS: mc2xml -r key:secret -U -c bs -g 0
    • CH: mc2xml -r key:secret -U -c ch -g 3303
    • CL: mc2xml -r key:secret -U -c cl -g 1000000
    • CO: mc2xml -r key:secret -U -c co -g 110111
    • CR: mc2xml -r key:secret -U -c cr -g 10101
    • DE: mc2xml -r key:secret -U -c de -g 14050
    • DK: mc2xml -r key:secret -U -c dk -g 9260
    • DO: mc2xml -r key:secret -U -c do -g 10101
    • EC: mc2xml -r key:secret -U -c ec -g 170950
    • ES: mc2xml -r key:secret -U -c es -g 28001
    • FI: mc2xml -r key:secret -U -c fi -g 91980
    • FR: mc2xml -r key:secret -U -c fr -g 38800
    • GD: mc2xml -r key:secret -U -c gd -g 0
    • GT: mc2xml -r key:secret -U -c gt -g 01001
    • HN: mc2xml -r key:secret -U -c hn -g 0
    • IE: mc2xml -r key:secret -U -c ie -g 0
    • IT: mc2xml -r key:secret -U -c it -g 00100
    • JM: mc2xml -r key:secret -U -c jm -g 0
    • LU: mc2xml -r key:secret -U -c lu -g 0
    • MX: mc2xml -r key:secret -U -c mx -g 11500
    • NI: mc2xml -r key:secret -U -c ni -g 0
    • NL: mc2xml -r key:secret -U -c nl -g 1000
    • NO: mc2xml -r key:secret -U -c no -g 0001
    • PA: mc2xml -r key:secret -U -c pa -g 0
    • PE: mc2xml -r key:secret -U -c pe -g 23006
    • PL: mc2xml -r key:secret -U -c pl -g 00-001
    • PT: mc2xml -r key:secret -U -c pt -g 1000
    • SE: mc2xml -r key:secret -U -c se -g 10005
    • SV: mc2xml -r key:secret -U -c sv -g 0
    • TC: mc2xml -r key:secret -U -c tc -g 0
    • TT: mc2xml -r key:secret -U -c tt -g 0
    • VC: mc2xml -r key:secret -U -c vc -g 0
    • VE: mc2xml -r key:secret -U -c ve -g 1010
    • VG: mc2xml -r key:secret -U -c vg -g 0


XBOX
  • How do I use the Xbox OneGuide service?

    • This service requires your Xbox Live account userEmail and password (or you can create another here). It uses your Microsoft Live account, but that account must be activated for use on xboxlive.com. (if you have login problems check their system status for any current issues.)
    • Also run by Microsoft, OneGuide serves a slightly different group of countries than the Media Center services. OneGuide data also provides some season and episode numbers (the xmltv_ns tag in XMLTV) and channel logos, but does not have movie ratings (star-rating) and some other data tags. Some lineups did not have radio stations like the comparable media center listings. You can view the provider lineups and data by clicking on your country code in the following table (MSN online TV listings) Unfortunately MSN has removed these online listings. They can be viewed on the XBOX.
    • Use an mc2xml.chl text file to limit the number of channels in your lineup, or limit the number of hours of schedule data (using the -d <hours> parameter) if you want to reduce the amount of download data.
    • Downloading multiple lineups would require the use of multiple .dat files
    • This service sends data in uncompressed chunks and mc2xml uses 4 parallel threads if there is a large amount of data (depending on the number of channels/programs/days of schedule you have requested). You can limit or increase this with the --max-threads=# parameter. The download progress dots can be suppressed with --no-progress
    • The country and postal/zip code formats supported by the Xbox OneGuide service are in the following table of examples. On Windows the graphical interface has input boxes for these options.


    • US: [mc2xml command] -c us -g 12345
    • CA: [mc2xml command] -c ca -g "H0H 0H0"
    • GB: [mc2xml command] -c gb -g CF31

    • AR: [mc2xml command] -c ar -g 1001
    • AT: [mc2xml command] -c at -g 1010
    • AU: [mc2xml command] -c au -g 0000
    • BE: [mc2xml command] -c be -g 1000
    • BR: [mc2xml command] -c br -g 01000001
    • CH: [mc2xml command] -c ch -g 1000
    • CL: [mc2xml command] -c cl -g 1000000
    • CO: [mc2xml command] -c co -g 200001
    • DE: [mc2xml command] -c de -g 01067
    • DK: [mc2xml command] -c dk -g 1000
    • ES: [mc2xml command] -c es -g 01001
    • FI: [mc2xml command] -c fi -g 10120
    • FR: [mc2xml command] -c fr -g 01000
    • IE: [mc2xml command] -c ie -g 00000
    • IT: [mc2xml command] -c it -g 00010
    • MX: [mc2xml command] -c mx -g 01000
    • NL: [mc2xml command] -c nl -g 1000
    • NO: [mc2xml command] -c no -g 1001
    • PL: [mc2xml command] -c pl -g 11-001
    • PT: [mc2xml command] -c pt -g 1000
    • RU: [mc2xml command] -c ru -g 101000
    • SE: [mc2xml command] -c se -g 10012



  • How would I use mc2xml with NextPVR?

    Note: This example assumes mc2xml.exe was downloaded to the C:\ folder and installs to the C:\EPG\ folder. Any folder name can be used but the contents of UpdateEPG.bat must point to the chosen folder name.

    1. Create a folder for the EPG data and put the mc2xml.exe binary in that folder (use a GUI file manager, Windows Explorer or the command line) (make sure folder is not read-only)

       command line example 
      md "C:\EPG"
      copy "C:\mc2xml.exe" "C:\EPG\"

    2. Optionally create an mc2xml.chl file listing the channels you want included in your EPG (see above for file format) (make sure that notepad doesn't append a ".txt" extension to this filename)

      If you do not specify which channels to grab all available channels and programme data for them will be downloaded resulting in a much larger xmltv.xml file size.


       command line example 
      notepad "C:\EPG\mc2xml.chl"

    3. Create a file called UpdateEPG.bat in the scripts folder of the NextPVR data directory and edit it with a text editor (notepad). Add any optional command line parameters to mc2xml that you might want. (make sure that notepad doesn't append a ".txt" extension to this filename)

       Location on Windows XP, Server 2003 
      C:\Documents and Settings\All Users\Application Data\NPVR\Scripts\UpdateEPG.bat

       Location on Windows 7, Vista, Server 2008 
      C:\Users\Public\NPVR\Scripts\UpdateEPG.bat

       UpdateEPG.bat 
      C:
      cd "C:\EPG"
      mc2xml

    4. Navigate to this UpdateEPG.bat file and run it (double click on UpdateEPG.bat) and mc2xml will ask you to input your Postal/Zip code (ie: "10000"), Country Code (ie: "us"), and will allow you to toggle any options (check "-a" and/or "-A" if you want *'s in your listings to indicate new programs).

      It will then ask you to select a lineup number. mc2xml will save this selection to mc2xml.dat and create an xmltv.xml file in this folder. (If you select the wrong lineup delete mc2xml.dat and try again)

    5. Configure NextPVR according to the type of capture device(s) on your system:
      1. For Analog devices:
        1. Select the analog device in the "Devices" section of the NextPVR "Settings" screen.
        2. Select "Device Setup" and use the "Import" option and browse to the location of the newly created xmltv.xml file.
        3. All available channels will be loaded. If you have not specified only the channels you wish to use in the mc2xml.chl file use the "Delete" option to remove channels you do not wish to view.
        4. "OK" all settings.
        5. Select the "UpdateEPG" button in the "Channels" section of the "Settings" screen which will populate the EPG with programme data.
      2. For Digital devices:
        1. Make sure to have run a channel scan on each device you wish to map the XML EPG data to in the "Devices" section of the NextPVR "Settings" screen and choose "Channels".
        2. Select a channel for which you wish to use the XML EPG source. From the drop down list select XMLTV and browse to locate the newly created xmltv.xml file.
        3. If NextPVR does not automatically match the channel name to the name in the XMLTV file use the dropdown list to choose the channel.
        4. "OK" this setting.
        5. If mapping multiple channels to your xmltv.xml file choose the "Bulk Map" option to easily edit the rest of the channels.
        6. Once finished editing use the "UpdateEPG" button to populate the EPG with programme data.
      3. For Analog and Digital devices on the same system use a combination of the above.

    6. Set the "EPG Update Hour" in the "Misc" section of the "Settings" screen and NextPVR will automatically run UpdateEPG.bat at the set time before it imports the programme data from the xmltv.xml file and updates the EPG.







  • How would I use mc2xml with MediaPortal? *

    1. Create a folder for the EPG data (example: c:\mc2xml) and put the mc2xml.exe binary and a copy of xmltv.dtd in that folder (use a GUI file manager or command line)
    2. Optionally create an "mc2xml.chl" file listing the channels you want included in your EPG (see above for file format) (make sure that notepad doesn't append a ".txt" extension to this filename)
    3. MediaPortal wants the produced .xml file to be called "tvguide.xml", so you must open a DOS box, change to the EPG data directory and specify the output filename on the mc2xml command line.

      On the first run of mc2xml on Windows it will ask you to input your Postal/Zip code (ie: "10000"), Country Code (ie: "us"). If not using windows, you must specify this info on the command line.

      mc2xml will then ask you to select a lineup number. mc2xml will save this selection to mc2xml.dat and create a tvguide.xml file in this folder. (Delete mc2xml.dat if you selected the wrong lineup, and try again)

      • md "C:\mc2xml"
      • cd "C:\mc2xml"
      • copy "C:\downloads\mc2xml.exe" "C:\mc2xml"
      • copy "C:\downloads\xmltv.dtd" "C:\mc2xml"
      • notepad "C:\mc2xml\mc2xml.chl"
      • mc2xml -c us -g 10000 -o tvguide.xml

    4. Start MediaPortal's "TVserver configuration"
    5. Go to plugin "XmlTv" (make sure XmlTv plugin box is checked) and select the folder with the newly generated tvguide.xml (example: c:\mc2xml)
    6. Go to Tab "Mappings"
    7. Select your "Group"
    8. Press "Load/Refresh"
    9. The list box will now show your "channels" with drop down boxes to select the descriptions from the tvguide.xml file
    10. After selecting descriptions, press "Save"
    11. Verify the selections by pressing "Load/Refresh" again (all boxes should now be white)
    12. Go back to the "Settings" tab and press "Import" (you should see your channels/programs after importing (takes a few seconds))
    13. Close "TVserver configuration"
    14. Optionally schedule a daily task to keep the tvguide.xml file up-to-date:

      • Start->Control Panel->Scheduled Tasks->Add Scheduled Task (Press Next)
      • Browse and Select C:\mc2xml\mc2xml.exe
      • Select daily -> Next
      • Set desired time -> Next
      • Set computer username/password -> Next
      • Check "Open Advanced Properties when I click finish", and click Finish, and set these options (modify paths if necessary):

        • Run: c:\mc2xml\mc2xml.exe -o "c:\mc2xml\tvguide.xml"
        • Start in: C:\mc2xml

      • Press OK


  • How do I crop the output of the schedules?

    • Use the -s and/or -d command line parameters (media center listings usually have 14 days worth of data by default). Make note of the "+" and "-" signs!

      mc2xml -s -5 -d 10
      output programs that start later than 5 hours ago, and include only the following 10 hours of programming
      mc2xml -s +5
      output programs that start later than 5 hours from now
      mc2xml -s 5
      output programs that start later than 5 hours after the downloaded listing's start time

  • Can I combine channels from multiple lineups and put them in one xml file?

    • If you are mindful of duplicate channels when creating your .chl files you can save your lineups to different .dat files and then chain them with the "-I xmlfile" insertion parameter

      • mc2xml -D NL.dat -C NL.chl -o NL.xml
      • mc2xml -D UK.dat -C UK.chl -I NL.xml -o UK_NL.xml
      • mc2xml -D DE.dat -C DE.chl -I UK_NL.xml -o DE_UK_NL.xml

    • Example #2 (note: -C file.chl is optional and limits which channels are downloaded and/or output in the xmltv.xml file, see here)

      • mc2xml -D lineup1.dat -C lineup1.chl -o lineup1.xml
      • mc2xml -D lineup2.dat -C lineup2.chl -I lineup1.xml -o lineup1and2.xml

  • Are there example retry scripts for the titantv service?

    • Example for windows:

     mc2xml-retry.bat 
    @ECHO OFF
    SET CNT=0
    SET MAX=15
    c:
    cd c:\mc2xml
    :START
      mc2xml
      IF ERRORLEVEL 2 GOTO RETRY
      GOTO END
    :RETRY
      SET /A CNT += 1
      IF %CNT% == %MAX% GOTO END
      mc2xml -w 30
      GOTO START
    :END
    • Example for linux:

     mc2xml-retry.sh 
    #!/bin/sh
    CNT=0
    MAX=15
    cd ~/mc2xml
    while [ $CNT -lt $MAX ];
    do
      ./mc2xml
      if [ $? -eq 2 ]
      then
        CNT=`expr $CNT + 1`
        ./mc2xml -w 30
      else
        break
      fi
    done

sed
  • How can I customize the listings?

    • It is easy to use sed (sed for windows) to automate the modification of the xmltv.xml text file. Here are some user contributed examples that could be added to the end of your EPG update script/bat file:

    • "Use sed to change the "-b" added asterisks into an [R] for "rerun" (or [N] for "new" when using "-a"). Since news programs usually are classified as reruns you can then change the [R] to NEWS for them. This solution is not perfect due to sed.exe control metacharacters commonly found in xml files, but it is close."

       command line 
      sed.exe -e "/<title lang=/ s/"*"/[R]/g" < "C:\mc2xml\xmltv.xml" > "C:\mc2xml\tvguidetemp.xml"
      sed.exe -e "/.*News.*"[R]"/ s/"[R]"/"NEWS"/g" < "C:\mc2xml\tvguidetemp.xml" > "C:\mc2xml\tvguide.xml"

    • "Add the team names from the sub-title to the title of NBA and College basketball games"
      • sed -f c:\mc2xml\sedscript.txt < c:\mc2xml\xmltv.xml > c:\mc2xml\newxmltv.xml

       sedscript.txt (cut&paste to read more easily)
      :a;N;$!ba;s/\(<programme[^<]*\)\(<t[^>]*>\)\(College Basketball[^<]*\)\(<[^<]*\)\(<sub-title[^>]*>\)\([^<]*\)[^<\/programme]*/\1\2\3: \6\4\5\6/g
      :a;N;$!ba;s/\(<programme[^<]*\)\(<t[^>]*>\)\(NBA Basketball[^<]*\)\(<[^<]*\)\(<sub-title[^>]*>\)\([^<]*\)[^<\/programme]*/\1\2\3: \6\4\5\6/g
      :a;N;$!ba;s/\(<programme[^<]*\)\(<t[^>]*>\)\(MLB Baseball[^<]*\)\(<[^<]*\)\(<sub-title[^>]*>\)\([^<]*\)[^<\/programme]*/\1\2\3: \6\4\5\6/g

    • "Change channel display-name order to match mythtv xmltvparser name callsign channum"
      • sed -f sedscript.txt < /home/mc2xml/xmltv.xml > /home/mc2xml/newxmltv.xml

       sedscript.txt (cut&paste to read more easily)
      :a;N;$!ba;s/\(<channel[^<]*\)\(<display*[^>]*>\)\([^ ]*\) \([^<]*\)\(<\/display-name>*\)/\1\2\4\5\n\t\t\2\4\5/g

    • "Remove all descriptions"

       command line 
      sed "/<desc/d" xmltv.xml > xmltv-nodesc.xml

    • "Change ChannelID of channel 73 to a specific static number"

       command line 
      c:\programs\sed\bin\sed.exe "s/I73\.[^\.]*\.micro/I73\.999999999\.micro/g" c:\mc2xml\xmltv.xml > c:\mc2xml\xmltv-new.xml

    • "Remove the Channel# from ChannelIDs"

       command line 
      c:\programs\sed\bin\sed.exe "s/I[[:digit:]]\+\.\(.*microsoft.com\)/I\1/" c:\mc2xml\xmltv.xml > c:\mc2xml\xmltv-new.xml

    • "Delete all programmes"

       command line 
      c:\programs\sed\bin\sed.exe "/<programme/,/<\/programme/d" c:\mc2xml\xmltv.xml > c:\mc2xml\xmltv-new.xml

    • "Delete some tags to make a smaller xmltv.xml file"

       command line 
      c:\programs\sed\bin\sed.exe "/<icon\|<actor\|<director\|<writer\|<producer\|<presenter\|<credits\|<\/credits/d;" xmltv.xml > xmltv-small.xml


  • Miscellaneous

    • Not all media center lineups have data available. If you select a lineup and receive a "No new data" status, try a different source.
    • Channel ids are currently a concatenation of number and id, since some listings have duplicate numbers while others have duplicate ids.
    • The linux binary is statically compiled.
    • Error: TCP 124363R = usually means the MS server to which you are connecting is temporarily overloaded or down
    • Error: TCP 124391R = server disconnected during connection, usually due to a broken MS server - might work upon retry
    • Error: TCP 124412R = if you use ESET NOD32 Antivirus "Web Access Protection" (or similar) you may need to make an exception for mc2xml if this setting is preventing EPG downloads

    • Definitions:
      • NTSC: analog terrestrial OTA (Over the air) aka Antenna (the US discontinued this service June 12 2009, Canada discontinued it on August 31, 2011.)
      • ATSC: digital terrestrial OTA (Over the air) aka Antenna: some channels are broadcast in High Definition but not all! Digital does not mean HD :)
      • ATSC sub channels: A digital channel has a certain amount of bandwidth (6MHz). Six 480i (standard definition) or two 1080i (high definition) streams can fit on one channel, so ATSC allows stations to divide a channel into subchannels. Example: 4.1, 4.2, 4.3.

  • Comments
  • mc2xml (at) gmail.com
© mc2xml