Discussion:
[Xmltv-devel] tv_grab_sd_json: ISO8601
h***@gmail.com
2016-06-05 07:31:34 UTC
Permalink
Is there any particular reason for using ISO8601 in this grabber? DateTime::Format::ISO8601 has a lot more (compile-time) dependencies than DateTime::Format::DateParse and is therefore harder to install on older machines. :-(

If you don't need the extra power of ISO8601 then wouldn't DateParse do the job?

Cheers,
Geoff
Kevin Groeneveld
2016-06-05 19:10:18 UTC
Permalink
Post by h***@gmail.com
Is there any particular reason for using ISO8601 in this grabber?
Because this is pretty much the first Perl program I have ever written and
I didn't know anything about parsing dates in perl? The SD JSON data uses
ISO8601 date formats so I probably googled "perl ISO8601" and
DataTime::Format::ISO8601 was the first hit that seemed like the right
thing to do.
Post by h***@gmail.com
DateTime::Format::ISO8601 has a lot more (compile-time) dependencies than
DateTime::Format::DateParse and is therefore harder to install on older
machines. :-(
If you don't need the extra power of ISO8601 then wouldn't DateParse do the job?
I don't even know what extra power the DateTime::Format::ISO8601 module has
compared to DateTime::Format::DateParse. Looking at the docs very quickly
didn't really clue me in either.

I tried replacing the three occurrences of
"DateTime::Format::ISO8601->parse_datetime" with
"DateTime::Format::DateParse->parse_datetime". This caused the
previously-shown date to be off in some cases. I assume this could
probably be fixed without too much effort.

What do others think? Would it be better to use
DateTime::Format::DateParse if possible?


Kevin
Robert Eden
2016-06-06 04:37:03 UTC
Permalink
Post by h***@gmail.com
Is there any particular reason for using ISO8601 in this grabber?
Because this is pretty much the first Perl program I have ever written
and I didn't know anything about parsing dates in perl? The SD JSON
data uses ISO8601 date formats so I probably googled "perl ISO8601"
and DataTime::Format::ISO8601 was the first hit that seemed like the
right thing to do.
DateTime::Format::ISO8601 has a lot more (compile-time)
dependencies than DateTime::Format::DateParse and is therefore
harder to install on older machines. :-(
If you don't need the extra power of ISO8601 then wouldn't
DateParse do the job?
I don't even know what extra power the DateTime::Format::ISO8601
module has compared to DateTime::Format::DateParse. Looking at the
docs very quickly didn't really clue me in either.
I tried replacing the three occurrences of
"DateTime::Format::ISO8601->parse_datetime" with
"DateTime::Format::DateParse->parse_datetime". This caused the
previously-shown date to be off in some cases. I assume this could
probably be fixed without too much effort.
What do others think? Would it be better to use
DateTime::Format::DateParse if possible?
Other grabbers already use DateTime, so not introducing another
dependency is a good idea. If your test caused previously-shown to
shift, it's probably a timezone issue.. storing the Gacenote provided
date as a midnight date-time which then shifts to a different date with
a timezone. Hopefully, you can just treat it as a date.. if not, pick
noon so timezone shifts should be less of a problem (but of course only
output the date, not your made-up time)

Robert
h***@gmail.com
2016-06-06 09:08:56 UTC
Permalink
Post by Kevin Groeneveld
Post by h***@gmail.com
If you don't need the extra power of ISO8601 then wouldn't DateParse do the job?
I don't even know what extra power the DateTime::Format::ISO8601 module has
compared to DateTime::Format::DateParse. Looking at the docs very quickly
didn't really clue me in either.
I was thinking in terms of the number of different date formats which ::ISO8601 can handle compared to ::DateParse. If you have only a limited number of different date formats, and they are handled by DateParse, then it may be a simpler option.

Cheers,
Geoff
Kevin Groeneveld
2016-06-09 00:42:31 UTC
Permalink
Post by h***@gmail.com
I was thinking in terms of the number of different date formats which
::ISO8601 can handle compared to ::DateParse. If you have only a limited
number of different date formats, and they are handled by DateParse, then
it may be a simpler option.
I have now updated tv_grab_sd_json to use DateTime::Format::DateParse
instead of DateTime::Format::ISO8601.

Kevin

Loading...