diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-05-11 13:39:11 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-05-11 13:39:11 (GMT) |
commit | 7c11a5fad703aa671a80a6d3ecd0c51b9210cde0 (patch) | |
tree | 2497400a905fbc7a4b3883ce82bc8b7bddb19368 | |
parent | 6b6b8e4ae94161691d29b13c148067dcccdf7089 (diff) |
moved to JSON::MaybeXS
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | depends | 9 | ||||
-rw-r--r-- | rhautoimport.pm | 12 |
3 files changed, 9 insertions, 14 deletions
diff --git a/debian/control b/debian/control index 2a62cdb..4e46118 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.5 Package: rhautoimport Architecture: all -Depends: ${misc:Depends}, adduser, libdate-calc-perl, libfile-slurp-perl, libjson-any-perl, librhrd-perl, liburi-perl, libwww-perl, libxml-feed-perl, perl, bsd-mailx +Depends: ${misc:Depends}, adduser, libdate-calc-perl, libfile-slurp-perl, libjson-maybexs-perl, librhrd-perl, liburi-perl, libwww-perl, libxml-feed-perl, perl, bsd-mailx Description: Radio Helsinki automatic importer This a set of scripts to automagically import shows from various external sources. diff --git a/depends b/depends deleted file mode 100644 index c0e7297..0000000 --- a/depends +++ /dev/null @@ -1,9 +0,0 @@ -libdate-calc-perl -libfile-slurp-perl -libjson-any-perl -librhrd-perl -liburi-perl -libwww-perl -libxml-feed-perl -perl -bsd-mailx diff --git a/rhautoimport.pm b/rhautoimport.pm index bb0c015..6a7678f 100644 --- a/rhautoimport.pm +++ b/rhautoimport.pm @@ -33,7 +33,7 @@ use IO::Handle; use LWP::Simple; use XML::Feed; use RHRD::rddb; -use JSON; +use JSON::MaybeXS; use constant { @@ -106,7 +106,8 @@ sub parse_result my $result; eval { - $result = from_json($result_json); + my $j = JSON::MaybeXS->new(utf8 => 0); + $result = $j->decode($result_json); 1; } or do { $log .= "\n!! error parsing import result !!\n"; @@ -147,7 +148,7 @@ sub import_uri my %request; $request{'LOGIN_NAME'} = RD_USER; $request{'SHOW_ID'} = int($show_id); - $request{'CLEAR_SHOW_CARTS'} = JSON::true; + $request{'CLEAR_SHOW_CARTS'} = JSON->true; $request{'SOURCE_URI'} = $uri; $request{'SOURCE_FILE_POLICY'} = $file_policy if $file_policy; @@ -157,9 +158,12 @@ sub import_uri return (1, "can't create request file in watchdir\n") unless($fh); chmod(0660, $fh); + binmode($fh, ":utf8"); my $requestfile = $fh->filename; my $log = "request file written to '$requestfile' ... "; - print $fh to_json(\%request); + + my $j = JSON::MaybeXS->new(utf8 => 0); + print $fh $j->encode(\%request); print $fh "\n"; close $fh; |