Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xmltv lineups #128

Closed
wants to merge 27 commits into from
Closed

Xmltv lineups #128

wants to merge 27 commits into from

Conversation

andyb2000
Copy link
Contributor

xmltv modifications to permit lineup xml's to be pushed to the socket from http://supplement.xmltv.org/tv_grab_uk_rt/lineups/ files that will honour the "Update channel name/number/icon" switch within the EPG Grabber component and update the channels accordingly with info from the lineup xml.

Code will attempt to use the service-id embedded within the lineup xml to match entries, however in the case of sky lineup files this service-id isn't embedded so it falls back to matching on service-name comparing to the entries already in channel list within TVH.

for sky channels based on a name correlation between Sky epg
lineup entries and the current channel list in tvh epg
(which doesnt have service-id) then channel name lookups will
take place and if matched channel number/name/icon will be
updated

Flag in WebUI will also define if changes take place.

Other small tidy up of code
@andyb2000
Copy link
Contributor Author

To push a lineup file, do something like:
wget -q -O - http://supplement.xmltv.org/tv_grab_uk_rt/lineups/freesathd.xml | nc -U ~/.hts/tvheadend/epggrab/xmltv.sock

@adamsutton
Copy link
Contributor

Sorry I've not had a chance to look this through yet. But I will try and get around to it this week or next.

@@ -531,6 +537,282 @@ static time_t _xmltv_str2time(const char *str)
return save;
}

/* Channel Lineup parsing and search code - https://github.com/andyb2000 Aug 2012 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function needs moving, I'll have a look at defining a generic service find function that you (and my other code) can use.

@adamsutton
Copy link
Contributor

@andyb2000 A general comment, fix your formatting, ensure its 2 spaces for indent and don't skimp on indentation it makes it difficult to read the code.

Lots of debug is good while getting stuff to work, but generally try and keep it to informative stuff once you're happy its running. If you need more detailed stuff stick it under #ifdef EPG_TRACE.

@adamsutton
Copy link
Contributor

and break your lines, 80 chars isn't a strict limit, but try and keep to it where possible. Again makes it easier to read the code as most of us will set editors to that width (still generally useful for side by side comparison).

and size as per comments from AdamSutton

Additional debug now under #ifdef EPG_TRACE statements
 Also changed line length on some comments
@andyb2000
Copy link
Contributor Author

Done a few mods to tidy things up and added in the ifdef EPG_TRACE to make normal debugging a bit lighter

/* Channel Lineup parsing and search code
https://github.com/andyb2000 Aug 2012 */

static service_t *_xmltv_find_service ( int sid )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at my pr/128 branch, I've added a new function that should be used instead of this. dvb_transport_find3(). Most of the params can be set to 0/NULL and it will search ALL things etc...

See opentv and eit modules for example usage.

if((lineups = htsmsg_get_map(lineups, "xmltv-lineup")) == NULL) return 0;
if((lineups = htsmsg_get_map(lineups, "tags")) == NULL) return 0;

HTSMSG_FOREACH(e, lineups) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit is very messy. You should be able to get what you want from lineups/tags using the:
htsmsg_xml_get_cdata_str
htsmsg_xml_get_cdata_u32

I think.

Also break the sections within the lineups into a few functions. To make it a bit more readable. Look at existing XMLTV parser.

@adamsutton
Copy link
Contributor

@andyb2000 This still needs quite a lot of work.

  1. Can you rebase against master (I'm adding the search routines I previously sent you and you merged).
  2. You need to break the parsing into manageable functions parse_lineup(), parse_lineup_entry(), etc...
  3. Get rid of the returnvar functions
  4. Still some definite formatting issues, might just be tabs v spaces, but it looked a bit of a mess in my editor.
  5. Remove a lot of the redundant coding:
    HTSMSG_FOREACH(f, lineups) {
      if (strcmp(f->hmf_name, "preset") == 0) {
        chan_number = xmltv_lineup_returnvar(mod, f);

can be simplified to

    htsmsg_xml_get_cdata_u32(lineups, "preset", &chan_number)

Or something like that (but don't forget to check the return value, or at least init chan_number to something sensible in case nothing is detected).

Adam

Conflicts:
	src/dvb/dvb.h
	src/dvb/dvb_multiplex.c
	src/dvb/dvb_transport.c
	src/epggrab/module/eit.c
	src/epggrab/module/opentv.c
@ghost ghost assigned adamsutton Oct 19, 2012
@andyb2000
Copy link
Contributor Author

Adam, trying to rebase and I've lost "dvb_transport_find3" was this pushed to master?

Working on these now (Back from holiday so catching up on coding) so should have these caught up with shortly for testing.

@adamsutton
Copy link
Contributor

@andyb2000 hmm, I can't see find3, only find and find2.

I can't see it on my branch either, where is it used in your code?

And beware I think you've committed stuff with conflicts in it.

@andyb2000
Copy link
Contributor Author

On 07/11/12 12:33, Adam Sutton wrote:

@andyb2000 hmm, I can't see find3, only find and find2.

I can't see it on my branch either, where is it used in your code?

And beware I think you've committed stuff with conflicts in it.

Yeah, just spotted the conflicts, just want to clear the find3 up and
will re-commit with the fixes I've got so far (not ready to test, etc, yet!)

Code for find3 is on 647 of xmltv.c and is used:
channel_service_id = dvb_transport_find3(NULL, NULL, NULL, 0, 0, cid, 1, 0);

It was provided by a function in dvb/dvb_transport.c according to my
history as:
/*

  • Find transport based on the DVB identification
    */
    service_t *
    dvb_transport_find3
    (th_dvb_adapter_t *tda, th_dvb_mux_instance_t *tdmi,
    const char *netname, uint16_t nid, uint16_t tsid, uint16_t sid,
    int enabled, int epgprimary)

Andy
e: andy @ thebmwz3.co.uk
w: http://www.thebmwz3.co.uk
g: https://github.com/andyb2000/

@adamsutton
Copy link
Contributor

ah, yes it looks like I added a definition to the dvb.h file, but I don't seem to have the function defined :(, hmm I wonder where I put it!

I'll try and find it and add it to master.

@andyb2000
Copy link
Contributor Author

Added dvb_transport_find3 to dvb_service.c
Should be ready for a look over again when u get a sec @adamsutton

@adamsutton
Copy link
Contributor

@andyb2000 sure I'll try and take a look this week.

@adamsutton
Copy link
Contributor

@andyb2000 if you find time to get back into this, let me know, I still would like to include it, but closing for now.

@adamsutton adamsutton closed this Jun 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants