Mysterious file management

Does the APK work for you?

Yes, it works. Although I still have a little trouble understanding the code. THANKS.
The proposal also works well with images. Thanks, it's good for the test application.

However, teachers will use a slightly different program.

Description of typical use:
1- A teacher creates an .mp3 file containing a word that corresponds to an image.
2- The teacher places this .mp3 file on his Google Drive (in a folder shared with anyone who has the link)
3- It retrieves the sharing link of this .mp3 file.
4- It uses a small application (that I programmed in python) which generates a QR code containing the Google Drive ID of the file.
5- He pastes this QR code into his document (created with Libre Office for example), next to an image which corresponds to the word contained in the .mp3.
6- He prints this document for his students.
7- The student uses the application on his parents' phone at home: he scans the QR code created by the teacher: he listens to the word corresponding to the image.

The teacher should be able to create, for example, a notebook with 30 images associated with 30 QR codes giving links to the corresponding sounds...
But if his 25 students, returning home at the same time, start their homework around the same time, well it's over: we explode the 40 downloads in 10 minutes (approximately...)

What could smooth things out a bit is a single download of the folder containing the audios in a single .zip

Example :
1- The Android application detects the name of the file (on GD) which is requested for reading.
2- It detects in its local memory if it already has the requested file.
3- If not, it detects the parent folder which contains the mp3 file on GD.
4- It downloads this entire folder in a single ZIP (a single download).
5- It unzips the archive into a local folder.
6- The Android app finds the requested file in this unzipped folder.
7- The Android app reads it.

But I think I understand that neither of those two proposals uses a similar procedure.

That is quite different from what we have been looking at....

Does the qrcode have to be created? then printed ?

This could all happen on the students phone.....

No, it's no different from the test application I presented to you...
The whole party:

  • creation of QR codes from the file ID,
  • scanning QR codes by phone,
  • listening to the .mp3 by correspondent on the student's phone...
    It all already works very well. I have already developed it...

But last Wednesday, when I gave the kids an activity that had lots of threads instead of just a poetry text, the number of downloads to my Drive increased and the bug was revealed...
I looked for a solution on my own, first. I managed to isolate the bug and understand that it came from the mp3 files, not the QR codes or the reading module (Player or Taifun Player...)

So I developed this little test application so that you can reproduce the bug at home.

But it's the same. This is just so you understand the importance of being able to download a file in one go.

:question:

clearly not.....

Do not make fun of me :sweat_smile:

  • Creation of QR codes from the file ID --> Working: already in use ("MAEL Gen" is a standalone application in Python. Some colleagues and I use it every day)
    Avec balise gd

  • Scanning QR codes by phone --> Working: already in use ("MAEL Scan" is the Android application that my students have been using since the beginning of September.)

  • Listening to the .mp3 on the phone... --> Works if there are relatively few downloads... (This is the problem of MAEL Scan, concentrated in this test application)

But this problem is crippling...
That's why I came for help. At first, I thought it was a file management problem (hence the name of the post: "Mysterious file management") But thanks to you, I understood that the problem was actually in the download.

I already have hundreds of hours of programming on this project... Now I'm looking for a workaround since it seems like the issue is not in my App Inventor code...

Have you considered using TextToSpeech ? This would remove most of the actions in the above?

intDownloadWithTTS.aia (5.7 KB)

Yes, this is the first function that I implemented. But to say single syllable (TTS is bad at it), a poetry expressively or a story readings, I had to add the possibility of reading .mp3 files online.

I improvised "tags" which are incorporated into the QR code (by "MAEL Gen") to indicate to "MAEL Scan" if it is a text to be spoken by TTS (and in what language), or if it is an .mp3 file to read from a GD.

At the moment, the only other option I can think of, aside from not using google drive, is to use a google apps script to download the audio files as base64 then convert them back to binary in the app (or play them as datauris in a webviewer)

If you have your own/schools online server, you / others could upload your files with ftp or through a web interface and get the urls that way

Going back to @Anke's suggestion for downloading all files in a zip, here is an AI2 solution to generating a zip on google drive and downloading and unzipping the files (uses @Taifun's zip extension)

Here are some tips which probably can help

Taifun

Thank you so much!
I'm going to study that.