Git Product home page Git Product logo

Comments (8)

blacktwin avatar blacktwin commented on August 15, 2024

Check your PLEXPY_APIKEY and PLEXPY_URL? How are you testing?

from jbops.

ajkis avatar ajkis commented on August 15, 2024

Now i get:

PlexPy Notifiers :: Script error:     Traceback (most recent call last):         File "/home/plex/scripts/py_watch_limit.py", line 67, in             if get_get_history(username) > WATCH_LIMIT[username]:     KeyError: 'Ajki'

--

from jbops.

blacktwin avatar blacktwin commented on August 15, 2024

Is 'Ajki' in your WATCH_LIMIT dict?

WATCH_LIMIT = {'Ajki': 2,
               'user2': 3,
               'user3': 4}

from jbops.

ajkis avatar ajkis commented on August 15, 2024

No its
WATCH_LIMIT = {'iShiki': 1 }

from jbops.

blacktwin avatar blacktwin commented on August 15, 2024

But you tested it using 'Ajki'. If the name is not in the dict then the script will error out, which it should because the user 'Ajki' is not defined. Does that make sense? If need be I can pretty it up so say User is not defined in WATCH_LIMIT, skipping

from jbops.

ajkis avatar ajkis commented on August 15, 2024

Should I use id instead of usernames, since user Ajki is my main account.

from jbops.

blacktwin avatar blacktwin commented on August 15, 2024

This section of the script:

def get_get_history(username):
    # Get the PlexPy history.
    payload = {'apikey': PLEXPY_APIKEY,
               'cmd': 'get_history',
               'user': username,  # <------ here
               'start_date': TODAY}

is calling for the user based on the API doc for PlexPy. If you want to change it to user_id then go ahead but then change that section of the script to:

def get_get_history(username):
    # Get the PlexPy history.
    payload = {'apikey': PLEXPY_APIKEY,
               'cmd': 'get_history',
               'user_id': int(username), 
               'start_date': TODAY}

the username value needs to be an int (based on the API doc). Change it however you want.

But again if the id or username is not defined in the dict the script fail, which it should. If the username or id is not defined think of it as ignoring that user. So if you want your main account Ajki to be ignored, don't add it to the dict. Does that make sense?

from jbops.

ajkis avatar ajkis commented on August 15, 2024

Yup, working

from jbops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.