Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Slow response issues
This thread has 10 replies. Displaying all posts.
Post 1 made on Sunday June 20, 2021 at 18:13
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
So for KODI I am pulling in and displaying cover art, unfortunately KODI has changed a few things, for movie, now 95% of cover art is pulled from "assets.fanart.tv", TV shows and some movies are pulled from "image.tmdb.org". Same code, images come in about 10% larger from fanart.ty, besides that I do not know of any different. Unfortunately I do not get to choose, but when the data comes from fanart.tv it takes 10 to 15 seconds to display, when it pulls from tmdb, its about 2 seconds. Any thoughts..

Here are two sample of two different movies I have,

1https://assets.fanart.tv/fanart/movies/24428/movieposter/marvels-the-avengers-5218f1301e057.jpg

1https://image.tmdb.org/t/p/original/o5jloyTyJMJUSwK4zJYrphTIu1J.jpg



Below are the two functions I am using to pull in the cover art. I am parsing out the data from a different function.

function kodi3(){
var socket = new TCPSocket();
var receivedData = "";
socket.onConnect = function() {
socket.write("GET /t/p/w154/"+coverTV+".jpg HTTP/1.0\r\n");
socket.write("HOST:image.tmdb.org\r\n");
socket.write("CONNECTION: close\r\n");
socket.write("\r\n");
};
socket.onData = function() {
receivedData += socket.read();
};
socket.onIOError = function (e) {
GUI.widget("data").label = "IOError " + e;
};
socket.onClose = function () {
var imageStartIndex, bitmapData, myImage;
imageStartIndex = receivedData.indexOf("\r\n\r\n");
bitmapData = receivedData.substring(imageStartIndex+4);
myImage = new Image(bitmapData);
GUI.widget("MOVIE_COVER").setImage(myImage);
GUI.widget("MOVIE_COVER").height = 210;
GUI.widget("MOVIE_COVER").width = 139;
GUI.widget("MOVIE_COVER").stretchImage = true;
};
socket.connect("image.tmdb.org",80, 500);
};
////////////////////////////////////////////////////////////////////////////////////////////
function kodi4(){
var socket = new TCPSocket();
var receivedData = "";
socket.onConnect = function() {
socket.write("GET /fanart/movies/"+coverMovie1+"/movieposter/"+coverMovie2+".jpg HTTP/1.0\r\n");
socket.write("HOST:assets.fanart.tv\r\n");
socket.write("CONNECTION: close\r\n");
socket.write("\r\n");
};
socket.onData = function() {
receivedData += socket.read();
};
socket.onIOError = function (e) {
GUI.widget("data").label = "IOError " + e;
};
socket.onClose = function () {
var imageStartIndex, bitmapData, myImage;
imageStartIndex = receivedData.indexOf("\r\n\r\n");
bitmapData = receivedData.substring(imageStartIndex+4);
myImage = new Image(bitmapData);
GUI.widget("MOVIE_COVER").setImage(myImage);
GUI.widget("MOVIE_COVER").height = 210;
GUI.widget("MOVIE_COVER").width = 139;
GUI.widget("MOVIE_COVER").stretchImage = true;
};
socket.connect("assets.fanart.tv",80, 500);
};

Last edited by mpg7321 on June 20, 2021 19:31.
Post 2 made on Monday June 21, 2021 at 11:33
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
After the file downloads and you load into an image or before you load into an image, System.print the string size, image height and width to the console. I bet the image is huge. Maybe there are some query parameters that you can supply to the url such that you get a smaller image on the download.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 3 made on Monday June 21, 2021 at 17:50
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Looking at the URLs you provided above have https on them. The Pronto does not do https, only http. The URLs I use below are http only and will work on the Pronto.

I just downloaded the first link's avengers image from fanart and the size on disk is 947KB and the image is 1000 x 1426. I also noticed that the download was a progressive JPG file which likely downloads 2-3x the size of the final image. The 2nd link you provided is a non-progressive JPG with a size on disk of 596KB and the image is 2000 x 3000.

After this analysis, I figured I'd browse the site from the first URL.

I used Chrome and started inspecting the html they were using. Sure enough, they have a URL that supports resizing (thumb.php). You just gotta know how to use it. The URL below downloads the same picture you posted but resizes it to 200x200 prior to download. This saves a tremendous amount of size. The height/width is 200 and the file size went from 976KB down to 28KB.

ht_tp://assets.fanart.tv/thumb.php?src=/fanart/movies/24428/movieposter/marvels-the-avengers-5218f1301e057.jpg&a=t&h=200&w=200

ht_tp://assets.fanart.tv/thumb.php?src=/fanart/movies/24428/movieposter/marvels-the-avengers-5218f1301e057.jpg&a=t&h=1426&w=1000

This URL renders a top-down JPG file in the same dimensions as the original but the file size is 596KB.

The Pronto does not have very much memory so therefore, I'd recommend using thumb.php from fanart.tv to download in the size you would like.

ht_tp://assets.fanart.tv/thumb.php?src=/fanart/movies/24428/movieposter/marvels-the-avengers-5218f1301e057.jpg&a=t&h=210&w=139

This yields a file size of 21KB so HTTP data won't be much more than that.

As a test, you can flip the width and height and retrieve link from a web browser and you will see that the php file crops the original image as needed.

Last edited by Lyndel McGee on June 21, 2021 18:49.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 4 made on Tuesday June 22, 2021 at 17:59
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
So, did my suggestion of using thumb.php URL work?
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 5 made on Tuesday June 22, 2021 at 19:53
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
Sorry, been very busy just read your response, and thank you so much, will try soon and report back. I wonder if I should pull even a smaller and the resize in the java script. I know that can mess the quality of the image but may be worth a try.
Post 6 made on Tuesday June 22, 2021 at 20:05
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
With my eyes, the thumb.php resize looked like the quality was just fine letting it resize to the exact width/height you need. You will get better performance out of the pronto if it does not have to resize the image or download a very large file.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 7 made on Tuesday June 22, 2021 at 20:27
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
worked like a charm, pulls in fast, how many images would you feel the unit could handle at a time, reason I am asking I want to display the cast with images. granted I would probably pull in small images, KODI max is 50 cast listing.

Last edited by mpg7321 on June 22, 2021 20:47.
Post 8 made on Wednesday June 23, 2021 at 12:04
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
On June 22, 2021 at 20:27, mpg7321 said...
worked like a charm, pulls in fast, how many images would you feel the unit could handle at a time, reason I am asking I want to display the cast with images. granted I would probably pull in small images, KODI max is 50 cast listing.

The answer to the number of concurrent open sockets is in the Dev Guide under TCPSocket A.13.3.1. If you aren't closing your sockets, then you will quickly hit the limit.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 9 made on Wednesday June 23, 2021 at 21:59
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
On June 23, 2021 at 12:04, Lyndel McGee said...
The answer to the number of concurrent open sockets is in the Dev Guide under TCPSocket A.13.3.1. If you aren't closing your sockets, then you will quickly hit the limit.

I was thinking of pulling in 10 actor/actresses images. I would have to try and see which is best. Open socket once pull all 10 images in the close or open and close 10 times. Again I would pull in smaller image size then the movie jacket, it will be interesting to see how this works. Side question, I know at one point you told me you had a tsu9800, are they worth it, do they have a better CPU for larger scripts? I took a break from the tsu9600 for a while and just fell in love with it again. Would be nice to have a larger screen.
Post 10 made on Thursday June 24, 2021 at 12:08
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
You will not be able to pull multiple images across a single socket unless you know how to do http pipelining which involves processing the Content Length response header, reading all the data for one image, then submitting another HTTP GET request with socket write.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 11 made on Thursday June 24, 2021 at 13:10
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Just FYI, you are skipping past all the HTTP Response header stuff with this line of code.

imageStartIndex = receivedData.indexOf("\r\n\r\n");
Lyndel McGee
Philips Pronto Addict/Beta Tester


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse