Himalayan-Academy / Siva-Siva-App

Code Repository for the Siva Siva Mobile App
11 stars 3 forks source link

Listen: Change Jnanam to Update on Their Phone #294

Closed Brahmanathaswami closed 3 years ago

Brahmanathaswami commented 3 years ago

Here is what happens. The server responded with the entire record of every latest audio, These recordings are NOT going to dbase in the phone

It in behavior_Listen handler "playList_FetchData" then it goes to lib_SivaSivaMedia.

Hmmm maybe we want to install from the dbase from server once a month...on their phone. Right now it gets installed with an upgrade of SivaSiva app.

image
function getItemURL pRecordNum
   local tURL
   # send of to lib_SivaSivaMedia, which knows all about our media CMS
   # but Audio books are completely different CMS: they have no item records for their audio files

   if ( sCurrentPlayListA["playlistClass"] = "latest")  OR ( sCurrentPlayListA["playlistClass"] ="cached") then
      # everything happens via Jnanam table structure record array
      put  sCurrentPlayListA["audioFiles"][pRecordNum] into sSelectedItemA
      metadata_SetRecord sSelectedItemA
      put getMediaURL (sSelectedItemA["item_id"]) into tURL

      if char -1 of tURL = "/" then
         put  sCurrentPlayListA["audioFiles"][pRecordNum]["filename"]  after tURL
         put tURL  into sSelectedURL
      end if       
   else
      # its an audio book
      put getMediaURL("audioBook") into tURL
      put  sCurrentPlayListA["audioBookMetadata"]["file_id"] & "/" after tURL
      put  sCurrentPlayListA["audioFiles"]["toc"][pRecordNum]["file"] after tURL
   end if
   return tURL
end getItemURL

# then to lib_SivaSivaMedia
on metadata_SetRecord pRecordArray
   # this only sets and array of from the item table
   # for formats and lyrics etc you have do use a different function.
   put pRecordArray into sMediaMetaA
end metadata_SetRecord

playList_FetchData 
[snip]
 switch tPlaylistClass
      case "latest" 
             put "Contacting server... " into fld "audioList" of card "listen-browse"

         # Set up the WHERE clause
         put sPlayListQueryA["media_type"] into tQueryData["data"]["media_type"]
         put sPlayListQueryA["author"] into tQueryData["data"]["author"] 
         put sPlayListQueryA["recordType"] into tQueryData["recordType"]
         put sPlayListQueryA["recordCount"] into tQueryData["recordcount"]

         put arrayToJson(tQueryData) into tJSON # from server

         put the ticks into sStartTimer
         set the httpheaders to "content-type: application/json"

         ## TO DO:  NEEDED: TIME OUT REQUIREMENT!
         POST tJSON to URL "https://dev.himalayanacademy.com/api3/getItemRecordsAndFormats/json"
Brahmanathaswami commented 3 years ago

behavior_Listen livecodescript_ - Code Editor (debugging) 2021-05-03 17-58-16

soapdog commented 3 years ago

I've been working on this for a while and I'm progressing. I just noticed a problem with the schema. Somehow the column sruti_tonic is constrained to NOT NULL which is wrong. That field should totally be able to be null. It is set like that because the Jnanam database on the server also has that field set to not null. So this is the kind of mistake we can't recover at the moment, I'll simply have to set them to empty string if they're not present.

soapdog commented 3 years ago

This is being worked on branch fix-my-downloads.

It is working fine on the desktop but it is failing on Android, don't know why yet. I'm working on it.

soapdog commented 3 years ago

After commit https://github.com/Himalayan-Academy/Siva-Siva-App/commit/7615fb89a4943fd80becf662247abf0a9b1ffd60 I got it working on Android.

Brahmanathaswami commented 3 years ago

re: sruti_tonic: this is a mistake. Shall change the structure of it to "null" ??

Brahmanathaswami commented 3 years ago

well I changed

sruti_tonic to NULL ("Not NULL" was a mistake.)

Brahmanathaswami commented 3 years ago

It does work instead we can get the following message. I have never, in two years, have ever then the message. hit on "Three Points of Concentration, Samyama"

But then I went back and To Collections. "Three Points of Concentration, Samyama" in there is was, playing!

I am think it was a result of moment glitch in the internet. I'll am going to merge this with "nightly"

For what its worth, it was:

image