2017-01-14, 10:12
After pulling apart the JSON and Chorus using the Chrome developer tools, I now see, that the combination of the jsonrpc call and the GET on the image is what Chorus does... and this somehow makes Kodi cache the image... but seemingly only from Chrome.
Using cURL and wget to do the same thing fails... then I realized Chrome was double encoding the special characters.
Double encoded the URL and fed it into wget... and bam, it worked. I coded up something permanent in Perl and now all my embedded artwork is cached.
Its basically what marcelveldt was describing. Sorry, its in Perl... Hope this helps someone.
BKNJ
Using cURL and wget to do the same thing fails... then I realized Chrome was double encoding the special characters.
Double encoded the URL and fed it into wget... and bam, it worked. I coded up something permanent in Perl and now all my embedded artwork is cached.
Its basically what marcelveldt was describing. Sorry, its in Perl... Hope this helps someone.
Code:
#!/usr/bin/perl
use warnings;
use strict;
use LWP::UserAgent;
use JSON;
use URI::Encode;
my $host = '127.0.0.1';
my $uri = 'http://' . $host . '/jsonrpc';
my $json = '{"jsonrpc":"2.0","method":"AudioLibrary.GetAlbums",'.
'"id":"wtf","params":[["title","displayartist",'.
'"thumbnail"],{"start":0,"end":50000},{"sort":{"method":'.
'"dateadded","order":"descending"}}]}';
my $req = HTTP::Request->new( 'POST', $uri );
$req->header( 'Content-Type' => 'application/json' );
$req->content( $json );
my $lwp = LWP::UserAgent->new;
my $response=$lwp->request( $req );
my $obj = from_json($response->content);
my $loop;
my $encoded;
my $encoder=URI::Encode->new({double_encode=>1,encode_reserved=>1});
for $loop ( @{$obj->{result}->{albums}} ) {
print $loop->{displayartist} . ' - ' . $loop->{title} . ' ';
$encoded=$encoder->encode($loop->{thumbnail}) . "\n";
$uri='http://' . $host . '/image/' . $encoded;
$req = HTTP::Request->new( 'GET', $uri );
$response=$lwp->request($req);
print $response->code . ' ';
print $response->message . "\n";
}
BKNJ