Git Product home page Git Product logo

pyarr's People

Contributors

archmonger avatar convexshiba avatar dependabot[bot] avatar lromandine avatar m0thm4n avatar marksie1988 avatar muqshots avatar shadowjonathan avatar snaacky avatar supersandro2000 avatar wthueb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyarr's Issues

Cannot read property 'forEach' of undefined type:

Just installed like showed in you guide :

You need HACS installed and configured
Go to plugins tab
Search for Atomic Calendar Revive
If you use the Lovelace Editor then first go to your user provile and enable Advanced Mode
Now add the follwoing to Configuration -> Lovelace Dashboards -> Resources
/hacsfiles/atomic-calendar-revive/atomic-calendar-revive.js

Expected behavior

Now i wanted to add it to my dashboard but this doesnt work

Current behavior

Cannot read property 'forEach' of undefined
type: 'custom:atomic-calendar-revive'
name: Calendar Card
enableModeChange: true

Screenshot

https://i.imgur.com/h5DTY8v.png

Movie path is wrong after calling RadarrAPIv3.add_movie

Movie path should be {root_dir}/{movie_title} instead of {root_dir}{movie_title} (notice the slash). I don't think that my Radarr is improperly setup, but maybe most people have the trailing slash included in their root dir. An easy fix would be to use os.path.join. This can easily be patched by just explicitly stating the root dir when calling the function though.

Also, using Radarr's "Movie Folder Format" setting (advanced option under Settings -> Media Management) would be ideal, but I'm not sure that Radarr's API could facilitate that.

Issue with `<pyarr.radarr_api.RadarrAPI object>.getMovie()`

Hi

I get this error on the RadarrAPI when calling .getMovie()

Traceback (most recent call last):
  File "fetch_movies.py", line 9, in <module>
    print(radarr.getMovie())
  File "/home/slimcdk/.local/lib/python3.8/site-packages/pyarr/radarr_api.py", line 148, in getMovie
    movieId = args[0]
IndexError: tuple index out of range

There is no issue with calling .getSeries() on the SonarrAPI

Compliance with PEP 8

Giving a first glance at this library, i can already give some suggestions to make library layout and code compatible with PEP 8 and similar widely spread python style guides;

  • snake_case function naming
  • all-lowercase library naming (PyArr -> pyarr)
  • function argument typing
  • (specific case) using named defaulted (def func(id = null)) arguments instead of *args like here, which is non-pythonic and confuses auto-documentation and typing tools

Can't install

Hi!

I tried to add this as a dependency but I can't manage to get it installed

C:\Windows\System32>pip install PyArr
ERROR: Could not find a version that satisfies the requirement PyArr (from versions: none)
ERROR: No matching distribution found for PyArr

Also from source it doesn't want to :

C:\Windows\System32>pip install -e https://github.com/marksie1988/PyArr.git#egg=PyArr
ERROR: https://github.com/marksie1988/PyArr.git#egg=PyArr is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with svn+, git+, hg+, or bzr+).

I am using python 3.7, any recommandations? Thanks!

RADARR: V3 API Compatibility

I've been informed that the Radarr team will be labeling the the v0.2 endpoints as depreciated within the upcoming months.

We have a few directions PyArr can go in. I've ranked them in order of what I believe is the best options available to us.

  1. Wait for the official public release of v3, then remove all v0.2 RadarrAPI functions for and replace them with new v3 functions.
    (preferred, visually the cleanest method to code)

  2. Have an initialization variable within RadarrAPI called use_v3_api that defaults to True. If that is set to true, then define all V3 functions within the class. If the user sets it to false, then the v0.2 functions are defined instead.
    (this will double the size of RadarrAPI, but allows for backwards compatibility with minimal code refactoring)

  3. Create a RadarrV3API class, and keep the current RadarrAPI class as is. Maintain both as necessary.
    (may lead to confusion in the future where 0.2 becomes obsolete)

  4. Have v0.2 and v3 functions all publicly available within the same class at the same time.
    (will lead to incompatibility issues if the user is using v0.2)

I will develop the implementation we agree on whenever the Radarr team finishes their API docs. That's likely gonna be six months to a year from now, so we have a lot of time to discuss.

Params are double encoded resulting in invalid requests urls.

Expected behavior

RequestAPI.request_get method to correctly encode api params.

Current behavior

RequestAPI.request_get currently makes a session GET using the following code:

        if len(kwargs) >= 1:
            encoded_params = requests.utils.quote(str(kwargs))
            request_url = "{}?{}".format(request_url, encoded_params)

        res = self.session.get(request_url, headers=headers, auth=self.auth)

Which causes arguments to be double encoded.

an example is SonarrAPI.get_episode_files_by_series_id(series_id)
currently the seriesId argument is encoded once by us and a second time by requests.
Resulting in a bad url.

Screenshot

Possible reasons and solutions

    def request_get(self, path, **kwargs):
        """Wrapper on the session.get
        Kwargs:
            **kwargs: Any url attributes to add to the request.

        Returns:
            requests.models.Response: Response object form requests.
        """
        headers = {"X-Api-Key": self.api_key}
        request_url = "{url}{path}".format(url=self.host_url, path=path)
        res = self.session.get(request_url, headers=headers, auth=self.auth, params=kwargs)
        return res.json()

Pass any params as a dict to the params arg of requests and let request encode the params.

Steps to reproduce

from pyarr import SonarrAPI
sonarr_api = SonarrAPI(my_url, my_token)
episode_data = sonarr_api.get_episode_file_by_episode_id(id_of_an_episode)

Checklist

  • I searched the current issues and the issue is not known.

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.