mp3 Download via tsnetgetSync

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
MichaelS
Posts: 24
Joined: Sat Jan 18, 2020 5:24 pm

mp3 Download via tsnetgetSync

Post by MichaelS » Thu Jun 25, 2020 4:34 pm

Hello,
i am trying to download an audio file in mp3 quality with tsnetgetSync Command.
The Code is simple :

Code: Select all

on mouseUp  
   local tRequestHeaders, tResponseHeaders, tResult, tBytes, tData
   local tSettings, tCharNo, tUrl, tProxyUrl
   
   put field "sftp_url" into tUrl
   put field "sftp_username" into tSettings["username"]
   put field "sftp_password" into tSettings["password"]
   put empty into field "response"
   
   -- Disable connection re-use if required
   if the hilite of button "Reuse Connection" is false then
      put true into tSettings["no_reuse"]
   end if
   
   put tsNetGetSync(tUrl, tRequestHeaders, tResponseHeaders, tResult, tBytes, tSettings) into tData
   
   if tResult is not 0 then
      answer "Error" && tResult && "returned from server"
   end if
   
   put tData into URL ("file:/home/michael/test.mp3")
end mouseUp
The Download is working. The Original mp3 and the downloaded Version has the same size. But when i start the downloaded mp3 i hear the Music and strange digital Noises , the Quality of the tranmitted mp3 is poor.

Is there a better Way to download mp3 from my Server ? I want to do this with sftp. It should work with my Indy Licence.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: mp3 Download via tsnetgetSync

Post by bangkok » Thu Jun 25, 2020 5:20 pm

Perhaps you should try :

Code: Select all

   put tData into URL ("binfile:/home/michael/test.mp3")
(binfile = binary file)

I do not see how the tsNetGetSync command could "reduce" the quality of a downloaded file (mp3 or any other type of file).

MichaelS
Posts: 24
Joined: Sat Jan 18, 2020 5:24 pm

Re: mp3 Download via tsnetgetSync

Post by MichaelS » Thu Jun 25, 2020 6:20 pm

Hi bangkok,
yes that was the Problem. With binfile it works.

Thank you for fast reply.
Michael

Post Reply

Return to “Internet”