apple_epf icon indicating copy to clipboard operation
apple_epf copied to clipboard

Weirdness with 20150720

Open funkyboy opened this issue 10 years ago • 3 comments

I have this code

d = Date.parse("20150720")
downloader = AppleEpf::Downloader.new('full', 'itunes', d)
downloader.download

Worked wonderfully so far with many different dates. When I try it with "20150720" as above I get a

AppleEpf::FileNotExist: File does not exist 20150722/itunes20150722.tbz

It's very weird that I specify the 20th and it's looking for the 22nd :(

  • I didn't change Ruby version, it's still 2.1.6.
  • I didn't change/updated gems
  • I didn't change date or time on my linux box.

Any idea?

funkyboy avatar Jul 24 '15 11:07 funkyboy

Digging a bit more I discovered this

Chronic.parse("this week wednesday", :now => downloader.filedate.to_time).to_date

returns

#<Date: 2015-07-22 ((2457226j,0s,0n),+0s,2299161j)>

The miscalculation seems to happen here

funkyboy avatar Jul 24 '15 11:07 funkyboy

A temporary workaround is using downloader.force_url but I am definitely curious as to why it skips two days from the 20th to the 22nd.

funkyboy avatar Jul 24 '15 11:07 funkyboy

Not sure about this exact problem but if I remember correctly Apples API kind of "rounds" the dates up/down when a date is asked where there is no data. It first sight I thought that this might come into play here somehow, but looking at your investigations this doesn't seem to be the issue. Let's keep that in mind anyways. ^^

Jeehut avatar Jul 25 '15 17:07 Jeehut