slow load URL

View: New views
8 Messages — Rating Filter:   Alert me  

slow load URL

by Nicolas Cueto-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have a stack that requires dowloading 40 to 200 image/sound files
(about 40Kb each).  The download time is pretty long so I'm wondering
if part of the problem is my script, which I've included below.

Thank you.

-- Nicolas Cueto


on startDownloads
  set the socketTimeoutInterval to 15000
  put theUrl into tTheUrl
  /*  Clear any cached urls.    */
  repeat for each line thisURL in the cachedURLs
     unload URL thisURL
  end repeat
  repeat for each line tImgOrSndID in tImgOrSndIDs
      put tTheUrl & tImgOrSndID into tURLPath
      load URL tURLPath
      ShowInfo tDU
      wait until "showInfo" is not among the items of the
pendingMessages with messages
  end repeat
end startDownloads


-- ShowInfo is a pending message which
-- monitors download status every 10 milliseconds.
-- By Eric Chatonet.

on ShowInfo pUrl
  local tStatus,tResult
  -----
  put URLStatus(pUrl) into tStatus
  switch
  case word 1 of tStatus = "error"
    answer "Sorry: invalid URL or no connection."
    put pUrl & cr after gFailedDownloads
    break
  case tStatus = empty
    answer "Sorry: invalid URL or no connection."
    put pUrl & cr after gFailedDownloads
    break
  case word 1 of tStatus = "timeout"
    answer "Sorry: time out."
    put pUrl & cr after gFailedDownloads
    break
  case item 1 of tStatus = "loading"
      break
  case word 1 of tStatus = "cached"
    exit ShowInfo
    break
  end switch
  send "ShowInfo" && pUrl to me in 10 milliseconds
end ShowInfo
_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: slow load URL

by Eric Chatonet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bonjour Nicolas,

Instead of setting by yourself a pending message you could take  
advantage of libURLSetStatusCallback: this will simplify your code.
Anyway, it should not change anything about speed... that is mainly  
related to your own speed connection and server's abilities ;-)

Le 12 mai 08 à 05:00, Nicolas Cueto a écrit :

> Hello,
>
> I have a stack that requires dowloading 40 to 200 image/sound files
> (about 40Kb each).  The download time is pretty long so I'm wondering
> if part of the problem is my script, which I've included below.
>
> Thank you.
>
> -- Nicolas Cueto
>
>
> on startDownloads
>   set the socketTimeoutInterval to 15000
>   put theUrl into tTheUrl
>   /*  Clear any cached urls.    */
>   repeat for each line thisURL in the cachedURLs
>      unload URL thisURL
>   end repeat
>   repeat for each line tImgOrSndID in tImgOrSndIDs
>       put tTheUrl & tImgOrSndID into tURLPath
>       load URL tURLPath
>       ShowInfo tDU
>       wait until "showInfo" is not among the items of the
> pendingMessages with messages
>   end repeat
> end startDownloads
>
>
> -- ShowInfo is a pending message which
> -- monitors download status every 10 milliseconds.
> -- By Eric Chatonet.
>
> on ShowInfo pUrl
>   local tStatus,tResult
>   -----
>   put URLStatus(pUrl) into tStatus
>   switch
>   case word 1 of tStatus = "error"
>     answer "Sorry: invalid URL or no connection."
>     put pUrl & cr after gFailedDownloads
>     break
>   case tStatus = empty
>     answer "Sorry: invalid URL or no connection."
>     put pUrl & cr after gFailedDownloads
>     break
>   case word 1 of tStatus = "timeout"
>     answer "Sorry: time out."
>     put pUrl & cr after gFailedDownloads
>     break
>   case item 1 of tStatus = "loading"
>       break
>   case word 1 of tStatus = "cached"
>     exit ShowInfo
>     break
>   end switch
>   send "ShowInfo" && pUrl to me in 10 milliseconds
> end ShowInfo


Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet@.../
----------------------------------------------------------------


_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: slow load URL

by Ian Wood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 12 May 2008, at 10:58, Eric Chatonet wrote:

> Anyway, it should not change anything about speed... that is mainly  
> related to your own speed connection and server's abilities ;-)

Yep. It's also worth bearing in mind that multiple small files will  
often take longer to download than a single large file of the same  
total size...

Ian
_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: slow load URL

by Nicolas Cueto-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you, Eric and Ian.

If it's ok, I've another related question.

Recently, my web-host's file-server has been acting
erraticly, including temporary down times. Unfortunately,
the problem struck right in the middle of one of my school
classes. This resulted in some stacks being able to download
file-urls while others couldn't just because they happened to
log on at a different point n time.

My question then is how, when a status message is "error",
to keep calling an url until it finally gets thru?  

Sorry for being vague.

-- Nicolas Cueto
_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: slow load URL

by Eric Chatonet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bonjour Nicolas,

Le 14 mai 08 à 13:44, Nicolas Cueto a écrit :

> Thank you, Eric and Ian.
>
> If it's ok, I've another related question.
>
> Recently, my web-host's file-server has been acting
> erraticly, including temporary down times. Unfortunately,
> the problem struck right in the middle of one of my school
> classes. This resulted in some stacks being able to download
> file-urls while others couldn't just because they happened to
> log on at a different point n time.
>
> My question then is how, when a status message is "error",
> to keep calling an url until it finally gets thru?
>
> Sorry for being vague.
>
> -- Nicolas Cueto

If you get "error" or "timeout", it means in both cases that loading  
the url failed.
In such a case, you can retry the whole process a second time.
Pseudo code:
if urlStatus = "error" or urlStatus = "timeout" then answer error  
"Downloading url failed:" with "Cancel" or "Retry"
if it is "Retry" then...
Or in an automated way you'll not display any dialog but you'll retry  
directly.
Don't forget to set a counter in a script local var for instance to  
not retry hundreds of times but only two or three times ;-)

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet@.../
----------------------------------------------------------------


_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: slow load URL

by Nicolas Cueto-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Eric.  Your suggestion of an automated retry with a
counter failsafe confirmed what I was contemplating.

--
Nicolas Cueto
_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: slow load URL

by Josh Mellicker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This may not be the answer you expect, but using rsync to download  
might be your best option. It seems blazingly fast with tons of small  
files, partially because it automatically compresses before  
downloading and uncompresses afterwards.

Today, in a test, we downloaded a whole website with over 10,000  
files, 150 MB of data, in a couple minutes. (Actual data transferred  
was 57 MB)

It is a shell program, and I have not got it working with Rev yet, but  
one of the many shell gurus on this list may reveal the answer soon ;-)


On May 11, 2008, at 8:00 PM, Nicolas Cueto wrote:

> Hello,
>
> I have a stack that requires dowloading 40 to 200 image/sound files
> (about 40Kb each).  The download time is pretty long so I'm wondering
> if part of the problem is my script, which I've included below.
>
> Thank you.
>
> -- Nicolas Cueto
>
>
> on startDownloads
>  set the socketTimeoutInterval to 15000
>  put theUrl into tTheUrl
>  /*  Clear any cached urls.    */
>  repeat for each line thisURL in the cachedURLs
>     unload URL thisURL
>  end repeat
>  repeat for each line tImgOrSndID in tImgOrSndIDs
>      put tTheUrl & tImgOrSndID into tURLPath
>      load URL tURLPath
>      ShowInfo tDU
>      wait until "showInfo" is not among the items of the
> pendingMessages with messages
>  end repeat
> end startDownloads
>
>
> -- ShowInfo is a pending message which
> -- monitors download status every 10 milliseconds.
> -- By Eric Chatonet.
>
> on ShowInfo pUrl
>  local tStatus,tResult
>  -----
>  put URLStatus(pUrl) into tStatus
>  switch
>  case word 1 of tStatus = "error"
>    answer "Sorry: invalid URL or no connection."
>    put pUrl & cr after gFailedDownloads
>    break
>  case tStatus = empty
>    answer "Sorry: invalid URL or no connection."
>    put pUrl & cr after gFailedDownloads
>    break
>  case word 1 of tStatus = "timeout"
>    answer "Sorry: time out."
>    put pUrl & cr after gFailedDownloads
>    break
>  case item 1 of tStatus = "loading"
>      break
>  case word 1 of tStatus = "cached"
>    exit ShowInfo
>    break
>  end switch
>  send "ShowInfo" && pUrl to me in 10 milliseconds
> end ShowInfo
> _______________________________________________
> use-revolution mailing list
> use-revolution@...
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: slow load URL

by Nicolas Cueto-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> This may not be the answer you expect, but using rsync to download might be
> your best option.

I'll keep this in mind in future. For now, though, some
of the files (images) this particular stack is calling on
get displayed during the "download"; also, once the
stack is exited, the files should "disappear" from the
student's computer.


Another related question now, about the
libURLSetStatusCallback command.

What  url-status parameter(s) can I expect when,
as I said, the load-url call is made but my webhost's
erratic file-server happens to be momentarilly down?
Error?   Timeout?    Empty?


Thank you.

--
Nicolas Cueto
_______________________________________________
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution