[RELEASE] Texture Cache Maintenance utility
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.

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
Reply
 
Thread Rating:
  • 17 Vote(s) - 4.76 Average


Messages In This Thread
Crash on Gotham on OS X - by desepticon - 2014-05-29, 17:57
RE: [RELEASE] Texture Cache Maintenance utility - by BuckyKattNJ - 2017-01-14, 10:12
Cleaning - by AleisterHH - 2018-05-28, 22:03
RE: Cleaning - by Milhouse - 2018-05-28, 22:16
qax genre not updated - by Just-Me_A-User - 2018-06-12, 22:06
RE: qax genre not updated - by Milhouse - 2018-06-12, 23:40


Logout Mark Read Team Forum Stats Members Help
[RELEASE] Texture Cache Maintenance utility4.7617