sync audio file

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Post Reply
etuser
Posts: 90
Joined: September 3rd, 2019, 5:57 am

sync audio file

Post by etuser »

Hello,

Is it possible to sync audio file along with the data file using sync logic ? if yes, can i get an example

Many thanks
aaronw
Posts: 570
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: sync audio file

Post by aaronw »

An audio file is like any other file and you'll use syncfile to synchronize it. The one caveat is they may be large.

To associate the audio file with the case, construct the file name from the id items.
string audio_file = maketext("%v-background-audio.m4a", HOUSEHOLD_ID);
background.save(audio_file);
From your menu application, loop through each file returned by dirlist and synchronize the file if it exists. As a final step you may want to delete the file after upload.
string dir_path = pathconcat(application, "../audio/");
list string audio_files;
dirlist(audio_files, dir_path);

do numeric i = 1 while i <= audio_files.length()

    // loop through each audio file in dir
   
if fileexist(audio_files(i)) then

        if syncfile
(PUT, audio_files(i), "/proj-name/audio/") then
            // delete after upload
           
filedelete(audio_files(i));
       
endif;

   
endif;

enddo;
etuser
Posts: 90
Joined: September 3rd, 2019, 5:57 am

Re: sync audio file

Post by etuser »

Many Thanks Aaron.
Post Reply