NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 9 10 11 12 13 … 93 Next »
help wtih xslt transforms

 
  • 0 Vote(s) - 0 Average
help wtih xslt transforms
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#1
2012-03-30, 03:48 AM (This post was last modified: 2015-05-14, 06:43 PM by pBS.)
Update: attached to this post is latest version, with all features..
**** Edit limit# of actors/guests/etc at top of .xslt file [4 and 8 seem to be good choices to start with]

I made a xslt transform that is an XMLTV epg enhancer..it adds actor/guest to description, and some other things..
[if editing large xml, it blows doors off any other method Smile unreal performance..
for example, a single .vbs date transform using msxml took 3 minutes,
while 12 transforms in a .xslt on same file took 8 seconds! those same transforms in pure vbs took 30 mins!!]

To Run:
msxsl.exe input.xml xmltv.xslt -o output.xml 2>>enhancer.log

[input and output can be the same file, overwriting input with output]
try it on your epg .xml and check out the output in notepad...i'm very happy with results..Smile
only takes about 10 secs to edit 2 weeks worth of 150 channels data!!!

i've now deciphered most of xslt processing so can pretty much do anything i need with it...
so make any suggestions, while i can still remember it all...LOL
Works well on xp [probably win2k also w/msxml 4.0] thru win7 sp1, 64bit and 32bit equally well..no special permissions needed..

Example of output:
Code:
<programme start="20120328020000 -0500" stop="20120328030000 -0500" channel="I8.28459889.microsoft.com" clumpidx="0/1">
          <title lang="en">Doctor Who</title>
          <sub-title>Cold Blood[color=#FF0000][b](509)[/b][/color]</sub-title>
          <desc>[color=#FF0000][b](05-29-2010)[/b][/color]Scientists discover something isn't right beneath the Earth's crust.

[COLOR="#FF0000"][b]    Â¤ Actors: Matt Smith, Karen Gillan, Arthur Darvill
    Â¤ Guest: Neve McIntosh, Meera Syal
    Â¤ Director: Ashley Way[/b][/COLOR]
</desc>
            <category lang="en">Drama</category>
            <category lang="en">Episodic</category>
            <category lang="en">Series</category>
        <subtitles type="teletext"></subtitles>
        <previously-shown start="20100529000000"></previously-shown>
        <episode-num system="onscreen">[color=#FF0000]509[/color]</episode-num>
        <episode-num system="xmltv_ns">..1/2</episode-num>
        <episode-num system="dd_progid">EP00750178.0082.1/2</episode-num>
    </programme>

UltraXMLEnhancer was just too unstable, but i'm spoiled with the extras, ever since I-XmlTV enahancer from the old days...lol

Attached below is latest version: 0.9
I will be rewriting it completely as to make it more structured and modular.. [hopefully it'll help with xml indents]

EDIT for .8: Added Paid Programming alteration, replaces them with 'Ad' and erases description..
EDIT for .9 replaced the output at top to fix xmltv.dtd to fix titles with '&'
like
Code:
<xsl:output method="xml" indent="yes" encoding="UTF-8" doctype-system="xmltv.dtd"/>
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Graham
Offline

Posting Freak

UK
Posts: 4,058
Threads: 102
Joined: Dec 2005
#2
2012-03-30, 03:43 PM
Thank you for this. The xslt does a super job with actors and all that.

Congratulations on getting your head round xslt. I googled and read, and googled and read some more, and then gave up. There is a reason that I have never worked as a programmer!
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,589
Threads: 385
Joined: Dec 2004
#3
2012-03-30, 04:58 PM
@pBS - I found a blog about formatting dates/times with xslt here.

There's a template called FormatDate which looks like it will do what you want for your date strings. The xslt file is downloadable from a link further down that page.
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#4
2012-03-30, 10:32 PM
sweet...thanx Smile
turns out that was just tryin to do too much with vbs, i've been using the xslt and vbs together cuz it's just easier to tweak little stuff, and it only takes 3 mins total! Big Grin
but i would like to get it to be all xslt...just not sure if there's any string manipulation available..didn't find a single example..

i didn't think it could parse a improperly formatted input date string..thanx..

now just o see if i can limit the number of actors...lol
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#5
2012-03-31, 12:17 AM (This post was last modified: 2012-03-31, 12:32 AM by pBS.)
thank you thank you..i finally found out how to do string manipulations..even if/thens etc../weee!
i've got the date fixed, even altering if the date's only a year, so 2007-2-12 or 2007 work without adding extra '--' [2007 = '2007' instead of '2007--' when month/days aren't there]

sweet...now don't need vbs anymore...lol
processing time is now 10 secs for 28 meg file!!!
will upload adjustments as soon as i adjust the extra prog_id episode numbers....[currently only grabbing 'onscreen' ep num]

[Ultra took 3 minutes to process same thing...Tongue]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,589
Threads: 385
Joined: Dec 2004
#6
2012-03-31, 01:01 AM
Quote:processing time is now 10 secs for 28 meg file!!!
That's impressive.

I only looked briefly at xslt a few years back. I remember the processing was incredibly fast for a few of the example exercises I tried out but in the end it was a steep learning curve and I only had simple requirements for processing some basic XML at the time so didn't stick with it.
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#7
2012-03-31, 02:08 AM (This post was last modified: 2012-04-02, 05:42 PM by pBS.)
try this one on for size....dates and episode numbers included..
Big Grin

Anything else i should add?

i basically just mimicked the 'Zehd's picks' from UltraXMLTVEnhancer
and it scrapes the episode numbers from either 'onscreen' or 'dd_progid', preferring the 'onscreen' if both are found...
all extra info is copied as is...[categories,video,etc]
i'll add the subtitle/caption stuff and anything else i can find later...

UPDATE:[fixed: ignore episode numbers less than 1, added currency bullet ¤ instead of *]
fixed indenting

i'll probably release a separate template to limit actors,etc. so you can apply it also or not..
but i've gotten to like all the extra info, even if it doesn't all fit on tvguide screen, it's all visible on the popups..Smile
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#8
2012-04-01, 09:08 AM (This post was last modified: 2012-04-02, 05:41 PM by pBS.)
finally got it to limit actors/guests/etc ...Smile
[the dang commas were a pain!]

so now limited to 5 actors/guests per show...
also altered date to be mm-dd-yyyy instead of yyyy-mm-dd..
and added a tab before actors/etc for clarity..

Please let me know if you have any requests...Smile

Edit1: added formatting for better reading, corrected limit of 4 to 5 actors..enhanced batch file..
included xmltv.dtd file..
Edit2: added previouslyshown and new tags, and subtitles...[as-is]
So it doesn't strip any info except the tags it adds to descriptions. Big Grin

Edit3: Finally figured out how to order the credits tags!!
now have actors,then guests, then the rest at the end..
Big Grin

Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#9
2012-04-02, 12:11 PM (This post was last modified: 2012-04-02, 05:19 PM by pBS.)
in addition to the reordering of credits, i added a variable you can set for the limits of actors/guests...Big Grin
just edit number at top of xmltv.xslt...[set to 5 by default]

added episode-num back to xml data to enable gbpvr/npvr to skip previously-recorded episodes...

pretty much complete this one.. let me know if any problems/suggestions...

Enjoy!

[current file attached to first post]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#10
2012-08-02, 06:56 PM (This post was last modified: 2012-08-02, 07:58 PM by pBS.)
New! Paid Programming obliteration! Big Grin
Any show with 'paid programming' as a category, gets title replaced with 'Ad', and erases description so all those adverts are easy to spot with the eye..
[and take up much less space in epg]
it's the only change for .8 version..
[updated in first post]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Merge xmltv data with xslt Graham 4 3,581 2014-01-02, 12:45 PM
Last Post: Graham

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode