Results 1 to 5 of 5

Thread: Simulate old CommandLineOptions

  1. #1
    Join Date
    Sep 2018
    Location
    Australia
    Posts
    8

    Simulate old CommandLineOptions

    Hi,

    Just wondering if there is a way of using the old command line options (-updateepgonly) with V5? When ever I try with the windows client, it runs the client and doesn't update the EPG.
    Can we have an hourly schedule to grab the EPG data?

    I'm using xmltv and Foxtel data changes all the time.

  2. #2
    Join Date
    Dec 2006
    Location
    St. Johns, Florida USA
    Posts
    2,450
    You could probably do it thru the WebAPI interface, the call is:

    http://localhost:8866/services/servi...te&format=json

    However you need to setup a session first, get a token and provide the right data in the request headers.
    NPVR Server: Win10 / AMD Phenom II X4 965 / 8gRAM / ATI Radeon 7700 Series / Hauppauge 2250
    Misc: HDHR Prime, rPI LibreElec & Amazon FireStick Kodi clients

  3. #3
    Join Date
    May 2006
    Location
    Canada
    Posts
    29,170
    Here is some rough python code extracted from knewc to do this with the security that sub expects us to use on localhost but it should work anywhere on your local LAN.

    Code:
    from urllib.request import urlopen,Request
    import json
    import sys
    
    
    ip = "127.0.0.1"
    port = 8866
    pin = "0000"
    sid = ""
    
    def doRequest5(method, isJSON = True):
        retval = False
        getResult = None
        url = "http://" + ip + ":" + str(port) + '/service?method=' + method
        if (not 'session.initiate' in method):
            url += '&sid=' + sid
        print(url)
        try:
            request = Request(url, headers={"Accept" : "application/json"})
            json_file = urlopen(request)
            getResult = json.load(json_file)
            json_file.close()
            retval = True
        except Exception as e:
            print(str(e))
    
        return retval, getResult
    
    def hashMe (thedata):
        import hashlib
        h = hashlib.md5()
        h.update(thedata.encode('utf-8'))
        return h.hexdigest()
    
    
    def  sidLogin5():
        method = 'session.initiate&ver=1.0&device=emby'
        ret, keys = doRequest5(method)
        global sid
        if ret == True:
            sid =  keys['sid']
            salt = keys['salt']
            method = 'session.login&md5=' + hashMe(':' + hashMe(pin) + ':' + salt)
            ret, login  = doRequest5(method)
            if ret and login['stat'] == 'ok':
                sid =  login['sid']
            else:
                print ("Fail")
        else:
            print ("Fail")
    
    def main(method):
        sidLogin5()
        doRequest5(method)
    
    if __name__== "__main__":
        main(sys.argv[1])
    Save as filename.py edit in your pin at the beginning and run it with

    python filename.py system.epg.update

    Martin

  4. #4
    Join Date
    Nov 2003
    Location
    NextPVR HQ, Wellington, New Zealand
    Posts
    91,204
    I've added an NScriptHelper utility for the next build, which will support "-updateepg" and other stuff

  5. #5
    Join Date
    Sep 2018
    Location
    Australia
    Posts
    8
    Quote Originally Posted by sub View Post
    I've added an NScriptHelper utility for the next build, which will support "-updateepg" and other stuff
    Champion... Will wait for then.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •