specified classes

This commit is contained in:
Nicholas St. Germain 2018-12-30 00:43:10 -06:00
parent 3038c9f586
commit 1c0ea465e8
3 changed files with 13 additions and 13 deletions

View file

@ -2,7 +2,7 @@ from logging import getLogger
from requests import Session, Request
from datetime import datetime, timezone
from varken.structures import Movie, Queue
from varken.structures import RadarrMovie, Queue
from varken.helpers import hashit, connection_handler
@ -31,9 +31,9 @@ class RadarrAPI(object):
return
try:
movies = [Movie(**movie) for movie in get]
movies = [RadarrMovie(**movie) for movie in get]
except TypeError as e:
self.logger.error('TypeError has occurred : %s while creating Movie structure', e)
self.logger.error('TypeError has occurred : %s while creating RadarrMovie structure', e)
return
for movie in movies:
@ -82,9 +82,9 @@ class RadarrAPI(object):
for movie in get:
try:
movie['movie'] = Movie(**movie['movie'])
movie['movie'] = RadarrMovie(**movie['movie'])
except TypeError as e:
self.logger.error('TypeError has occurred : %s while creating Movie structure', e)
self.logger.error('TypeError has occurred : %s while creating RadarrMovie structure', e)
return
try:

View file

@ -2,7 +2,7 @@ from logging import getLogger
from requests import Session, Request
from datetime import datetime, timezone, date, timedelta
from varken.structures import Queue, TVShow
from varken.structures import Queue, SonarrTVShow
from varken.helpers import hashit, connection_handler
@ -34,11 +34,11 @@ class SonarrAPI(object):
if not get:
return
# Iteratively create a list of TVShow Objects from response json
# Iteratively create a list of SonarrTVShow Objects from response json
try:
tv_shows = [TVShow(**show) for show in get]
tv_shows = [SonarrTVShow(**show) for show in get]
except TypeError as e:
self.logger.error('TypeError has occurred : %s while creating TVShow structure', e)
self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure', e)
return
# Add show to missing list if file does not exist
@ -87,9 +87,9 @@ class SonarrAPI(object):
return
try:
tv_shows = [TVShow(**show) for show in get]
tv_shows = [SonarrTVShow(**show) for show in get]
except TypeError as e:
self.logger.error('TypeError has occurred : %s while creating TVShow structure', e)
self.logger.error('TypeError has occurred : %s while creating SonarrTVShow structure', e)
return
for show in tv_shows:

View file

@ -171,7 +171,7 @@ class OmbiMovieRequest(NamedTuple):
# Sonarr
class TVShow(NamedTuple):
class SonarrTVShow(NamedTuple):
absoluteEpisodeNumber: int = None
airDate: str = None
airDateUtc: str = None
@ -194,7 +194,7 @@ class TVShow(NamedTuple):
# Radarr
class Movie(NamedTuple):
class RadarrMovie(NamedTuple):
added: str = None
addOptions: str = None
alternativeTitles: list = None