tkdrob / aiopyarr Goto Github PK
View Code? Open in Web Editor NEWPython API client for Lidarr/Radarr/Readarr/Sonarr.
License: MIT License
Python API client for Lidarr/Radarr/Readarr/Sonarr.
License: MIT License
notice while working on HA sonarr conversion that trying to use dt_util.as_local the airDateUtc timezone would never really adjust properly to expected value unless I replaced the airDateUtc tzinfo with UTC first
N/A
I'm attempting to bulk tag some movies with aiopyarr. I'm getting a JSON parse exception
The tag loop just builds a dict so I can reference tags by name, instead of value.
client: RadarrClient
async with RadarrClient(host_configuration=host_configuration) as client:
tags: dict(str, int) = {}
tag: Tag
for tag in await client.async_get_tags():
tags[tag.label] = tag.id
movies: list[RadarrMovie] = await client.async_get_movies()
sorted_movies: list[RadarrMovie] = sorted(movies, key=lambda x: x.sortTitle)
movie: RadarrMovie
for movie in sorted_movies:
if movie.hasFile and movie.movieFile.dateAdded >= datetime.datetime.strptime('10-01-2022', '%m-%d-%Y') and tags.get("updated") not in movie.tags:
movie.tags.append(tags.get("updated"))
await client.async_edit_movies(data=movie)
Version
4.3.0.6637
Package Version
4.3.0.6637-ls376 by [linuxserver.io](https://www.linuxserver.io/)
.NET
Yes (6.0.8)
Docker
Yes
DB Migration
214
Database
Sqlite 3.36.0
AppData directory
/config
Startup directory
/app/radarr/bin
Mode
Console
Uptime
(<class 'aiopyarr.exceptions.ArrException'>, ArrException('Object of type date is not JSON serializable'), <traceback object at 0x7fabb045dac0>)```
the exception is being hit on Line 206 in request_client.py
I'm still looking into this but figured I'd note it.
This happens when running:
sonarr_client.async_get_wanted(page_size=50, include_series=True)
{'sortKey': 'episode.airDateUtc', 'page': 1, 'pageSize': 50, 'sortDirection': 'default', 'includeSeries': 'True'}
2022-02-06 16:06:39.6|Fatal|SonarrErrorPipeline|Request Failed. GET /api/v3/wanted/missing
[v3.0.6.1451] System.ArgumentException: Instance property 'episode' is not defined for type 'NzbDrone.Core.Tv.Episode'
Parameter name: propertyName
devcontainer.json
seems to be pointing to Dockerfile.dev
which is one level up from the root of the repository. Attempting to open the dev container in VSCode fails as a result of the file being missing.
There are no relevent logs for this issue.
I noticed in #36 and #38 that there is one setup not considered: reverse proxies that map a subdomain or subpath to a service at a defined port usually with https. so:
https://sonarr.local.xyz
http://local.xyz/radarr
these shouldn't have port autocompleted or like the ssl should like use port 443 and non-ssl port 80
perhaps autocomplete should only happen for IP addresses as that would be mostly safe since IPs are rarely used with SSL and wouldn't be typical of reverse proxy usage.
however when you configure sonarr or radarr for SSL through settings (no reverse proxy) they use port 9898 so might be good to try that port when ip and https.
N/A
This issue was first reported in Home Assistant:
home-assistant/core#81508
The code snippet inside Home Assistant is:
class QueueDataUpdateCoordinator(SonarrDataUpdateCoordinator[SonarrQueue]):
"""Queue update coordinator."""
async def _fetch_data(self) -> SonarrQueue:
"""Fetch the data."""
return await self.api_client.async_get_queue(
include_series=True, include_episode=True
)
This seems to stem from PR #56 which adds a check on this property. My theory is that not all models contain this property which causes the library to raise the exception below.
2022-11-03 11:54:59.789 ERROR (MainThread) [homeassistant.components.sonarr] Unexpected error fetching sonarr data: 'SonarrQueueDetail' object has no attribute 'timeleft'
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiopyarr/request_client.py", line 183, in _async_request
response = BaseModel(
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 95, in __init__
value = generate_data(value, datatype)
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 78, in generate_data
return datatype(data)
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 116, in __init__
self.__post_init__()
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 193, in __post_init__
self.records = [SonarrQueueDetail(record) for record in self.records]
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 193, in <listcomp>
self.records = [SonarrQueueDetail(record) for record in self.records]
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 116, in __init__
self.__post_init__()
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 176, in __post_init__
super().__post_init__()
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/request_common.py", line 165, in __post_init__
and self.timeleft == "00:00:00"
AttributeError: 'SonarrQueueDetail' object has no attribute 'timeleft'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/components/sonarr/coordinator.py", line 67, in _async_update_data
return await self._fetch_data()
File "/usr/src/homeassistant/homeassistant/components/sonarr/coordinator.py", line 118, in _fetch_data
return await self.api_client.async_get_queue(
File "/usr/local/lib/python3.10/site-packages/aiopyarr/sonarr_client.py", line 137, in async_get_queue
return await self._async_request("queue", params=params, datatype=SonarrQueue)
File "/usr/local/lib/python3.10/site-packages/aiopyarr/request_client.py", line 207, in _async_request
raise ArrException(self, ex) from ex
aiopyarr.exceptions.ArrException: 'SonarrQueueDetail' object has no attribute 'timeleft'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.