achtnullzwei / A1TV_EPG

EPG to XMLTV via A1 TV Mobile API
1 stars 0 forks source link

Use also country and year #16

Open ghost opened 4 years ago

ghost commented 4 years ago

The data in the A1 API typically include the country (countries) and a year. These values are currently not used, but it might be fine to have it also in the XML data.

["49571392",1586735700,1586738400,"Faszinierende Erde","Gletscher",["Sendung","Spielfilm"],"DEU","2019",null,0]

["49505206",1586737800,1586740500,"Der Name der Rose","Folge 5",["Sendung","Kom\u00f6die"],"DEU\/ITA","2019",null,0]]

There are proper elements in the XMLTV DTD which could be used: country and date. Note: There might me more than one country and they should be transformed (ALPHA-3 to ALPHA-2, ISO 3166-1). (For an easy solution it might be possible to use just the ALPHA-3 code(s), without splitting and transforming, but then also a lang attribute has to be used).

ghost commented 4 years ago

Don't write the elements, if the data is null in the API.

achtnullzwei commented 4 years ago

I checked the output in an XML beautifier. I actually use the date tag of XMLTV already and it should be working. I checked the XML output and if the JSON contains a year it is added properly. The corresponding line in the code can be found here --> https://github.com/achtnullzwei/A1TV_EPG/blob/be7e8293df1083d560fc01c834275e964423284e/api/functions.py#L69

I keep this one open. I like the idea including the country, however I think that requires a bit more work. :-)

ghost commented 4 years ago

Oh, I see, date is already used.

I've noticed, in the A1 API there are also dates likes "2020-" (with trailing dash). I'm not sure if this is an error in the API (truncated date), or they want to indicate an ongoing date.

There is no specific format in the XMLTV DTD and so this is not a formal error, but I'm not sure if clients accept such dates.

However, I saw, Tvheadend will not use date (and also not country) in the EPGDB by now (see also epg.h: struct epg_broadcast). So it's not a problem by now but there is also no need for the fields.


BTW: As the date is not filled always (there are empty date tags in the XML), empty tags could also be omitted.


Since the description (desc) will not be used in the XML data, it might be possible to use this element for other data, like date and country, but I'm not sure if this really a good idea...