X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FWebService%2FStrike%2FTorrent.pm;h=33d4b515f9f747759204d6ed9f9da3dfe565639a;hb=refs%2Ftags%2F0.002;hp=8c8a894badfe1622594f04b95d50a506279ada08;hpb=27da1d36f6be05af35e74a57848cabf138cf3fc3;p=webservice-strike.git diff --git a/lib/WebService/Strike/Torrent.pm b/lib/WebService/Strike/Torrent.pm index 8c8a894..33d4b51 100644 --- a/lib/WebService/Strike/Torrent.pm +++ b/lib/WebService/Strike/Torrent.pm @@ -5,7 +5,7 @@ use strict; use warnings; use parent qw/Class::Accessor::Fast/; -our $VERSION = '0.001'; +our $VERSION = '0.002'; use Date::Parse qw/str2time/; use JSON::MaybeXS qw/decode_json/; @@ -29,9 +29,11 @@ sub new{ my ($self, @args) = @_; $self = $self->SUPER::new(@args); $self->{torrent_hash} = uc $self->hash; - $self->{upload_date} = str2time $self->date; - $self->{file_names} = $self->file_info->[0]->{file_names}; - $self->{file_lengths} = $self->file_info->[0]->{file_lengths}; + $self->{upload_date} = str2time $self->date, 'UTC'; + if ($self->file_info) { + $self->{file_names} = $self->file_info->[0]->{file_names}; + $self->{file_lengths} = $self->file_info->[0]->{file_lengths}; + } $self } @@ -79,7 +81,7 @@ WebService::Strike::Torrent - Class representing information about a torrent say $t->leeches; say $t->count; # 1 say $t->size; # 587 MB - say $t->date; # 1420495200 + say $t->date; # 1420502400 say $t->uploader; # The_Doctor- say @{$t->names}; # archlinux-2015.01.01-dual.iso say @{$t->lengths}; # 615514112