HMS

Home Media Server for Roku Players
git clone https://www.brianlane.com/git/HMS
Log | Files | Refs | README | LICENSE

keystore.brs (1128B)


      1 '********************************************************************
      2 '**  Home Media Server Application - keystore functions
      3 '**  Copyright (c) 2022 Brian C. Lane All Rights Reserved.
      4 '********************************************************************
      5 
      6 
      7 ' ***********************************
      8 ' * Get a value for a key
      9 ' ***********************************
     10 Function getKeyValue(url As String, key As String) As String
     11     result = getHTMLWithTimeout(url+"/keystore/"+key, 60)
     12     if result.error and result.response <> 404 then
     13         print "Error ";result.response;" getting key ";key;": ";result.reason
     14         return ""
     15     elseif result.error and result.response = 404 then
     16         return ""
     17     end if
     18     return result.str
     19 End Function
     20 
     21 ' ***********************************
     22 ' * Set a value for a key
     23 ' ***********************************
     24 Function setKeyValue(url As String, key As String, value As String)
     25     result = postHTMLWithTimeout(url+"/keystore/"+key, "value="+value, 60)
     26     if result.error then
     27         print "Error ";result.response;" setting key ";key;"=";value;": ";result.reason
     28     end if
     29 End Function