Helper to swap "Category" order in XMLTV

Discuss XMLTV grabbers or get help with XMLTV grabbing here
Post Reply
Christoph21x
Posts: 1070
Joined: Wed Oct 19, 2011 9:39 am
Location: Berne / Switzerland

Helper to swap "Category" order in XMLTV

Post by Christoph21x » Thu Jun 28, 2012 5:03 pm

== EDIT 2012-09-19: Download link to currently most recent post: viewtopic.php?f=70&t=3922#p25395 ==


Dear All,

I use the brillant WegGrab+Plus (see other thread).
Grabbing from various sites, it may result in a result like this, as the category is a "multiple entry" (eg. tvtoday.ini et al.):

Code: Select all

    <category lang="de">USA 2008</category>
    <category lang="de">Horrorthriller</category>
.. which is not the fault of WG++, but of an inconsistent handling of the site.

In ARGUS TV only the first category entry is shown... which is obviously unusable for me using suggestions containing categories for selection.

Anyone any idea?

EDIT: See post #2 to find download of a tool that swaps the order of those multiple entries

Greetz from Switzerland - Christoph
Last edited by Christoph21x on Sun Jul 29, 2012 7:51 am, edited 3 times in total.
"One must still have chaos within oneself, to give birth to a dancing star." (F. Nietzsche)

Christoph21x
Posts: 1070
Joined: Wed Oct 19, 2011 9:39 am
Location: Berne / Switzerland

Re: [Solved] Mutliple fields like "Category" usable in 4TR?

Post by Christoph21x » Sat Jul 21, 2012 2:57 pm

== EDIT 2012-09-19: Download link to currently most recent post: viewtopic.php?f=70&t=3922#p25395 ==

I wrote a tiny application to solve my issues - maybe also interesting to others (see attachment below) , facing a similar issue:

Using several scrapers on several Internet guide sites and a variety of front-ends may lead to the fact, that various EPGs may show "irrelevant" category information as the main category for a show in ARGUS TV.
Reason is, that ARGUS TV only uses the FIRST category defined for its EPG, recordings and suggestions.

Getting started: Download and try out the attached ZIP archive, read the SwapCat.readme.txt for an quick start AND extensive explanatory.

Most of the scrapers support (as defined) "multiple fields" for the category information, whereas most of the EPG viewers (including ARGUS TV and MediaPortal) only reference the first entry of all those categories (per programme).
If you encounter categories like "USA 2009" in your main EPG - you should use SwapCat.
If you encounter categories like "Thriller" in your EPG and the online view of the grabbed website shows something like "Thriller; Comedy; Thriller Comedy" and you want to see the latter in your EPG (maybe it's even the Sub-Category, depending on your grabber, and you want to see rather THIS) - you should use SwapCat.
(For a quick check, whether SwapCat will be able to serve you, read the SwapCat.readme.txt of the archive and jump to the section "2.1. Quick start guide".)

Two basic modes are available: the interactive and the automated run.
The interactive mode will let you do step by step whatever you want or simply run an analysis on the given source file. In this mode you may safely run this analysis (only) on your source TV guide XML file without changing anything - it will tell you, if SwapCat will be of use for you on the given source file - and then invoke run the swap.
You may select the target TV guide XML file (which MUST be different from the source) and select a logging file to give you more details on analysis or swapping.
The automated run is performed when you call SwapCat with the appropriate command line arguments - see below.

SwapCat will open your source TV guide XML file (read-only; no changes are done), parsing the file and find multiple field-entries of categories in your XMLTV file.
Finding them (if not running analysis only) will make SwapCat to swap the order of the category occurrences within a EPG entry. The last entry will become the first one, the order will be inverted. Everything else in your TV guide source XML will simply be copied to the target.

EXAMPLE:

Code: Select all

	Your source TV guide XML file shows:   ...will convert to...   Order in your newly created TV guide target XML file:
	
	<category>USA 2009</category>                                  <category>Thriller-Comedy</category>
	<category>Thriller</category>                                  <category>Comedy</category>
	<category>Comedy</category>                                    <category>Thriller</category>
	<category>Thriller-Comedy</category>                           <category>USA 2009</category>
	
	Your EPG shows as category:                                    Your EPG shows as category:
	"USA 2009"                                                     "Thriller-Comedy"


Usage of SwapCat - interactively or automated with command line parameters:
'SwapCat.exe': starts the interactive SwapCat (supports analyzing a source)
'SwapCat.exe <guide source xml file> <swapped target guide xml file>': automated run: swaps the order into a newly created guide xml file, switches to interactivity on error
'SwapCat.exe <guide source xml file> <swapped target guide xml file> <log file>': automated run: swaps the order into a newly created guide xml file, writes log file but exits on error

Details are described in the package. Interaqctive run, automated run with error detection, unconditional automated rn with log creation... see it in the package.

If you have any questions or suggestions, please post them here.

Kind regards from Switzerland - Christoph
"One must still have chaos within oneself, to give birth to a dancing star." (F. Nietzsche)

4thip
Posts: 5
Joined: Tue Jul 24, 2012 5:56 pm

Re: [Solved] Helper to swap "Category" order in XMLTV

Post by 4thip » Mon Aug 13, 2012 4:39 pm

@Christoph21x
It is easier to correct this in the tvtoday.ini file.Comment out one line (*index_category.scrub ...)

Christoph21x
Posts: 1070
Joined: Wed Oct 19, 2011 9:39 am
Location: Berne / Switzerland

Re: [Solved] Helper to swap "Category" order in XMLTV

Post by Christoph21x » Tue Aug 14, 2012 9:55 am

4thip wrote:@Christoph21x
It is easier to correct this in the tvtoday.ini file.Comment out one line (*index_category.scrub ...)
Thanks, 4thip!
THAT was, what I was actually looking for and asked in WG++ forum - but there was no answer. :)
Actually, in the meantime I built in some more functionality (like proper episode numbering etc.) and currently am adding *.4tr -to- *.nfo converter functionalities... won't miss it anymore ;)

Nevertheless - thanks a lot & greetings - Christoph
"One must still have chaos within oneself, to give birth to a dancing star." (F. Nietzsche)

Christoph21x
Posts: 1070
Joined: Wed Oct 19, 2011 9:39 am
Location: Berne / Switzerland

Re: [Solved] Helper to swap "Category" order in XMLTV

Post by Christoph21x » Wed Sep 19, 2012 1:45 am

New Version 1.0.1 can be found under http://21x.eu/downloads/SwapCategory.html

Revision History:
  • Version 1.0.1: Rebuild under MS Visual C++ 2010,
    eliminating exception when encapsulated category entries occur - which
    is not according to specification
  • Version 1.0: Initial Revision, MS Visual C++ 2005
Kind regards - Chris.
"One must still have chaos within oneself, to give birth to a dancing star." (F. Nietzsche)

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests