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 requests import Session, Request
from datetime import datetime, timezone from datetime import datetime, timezone
from varken.structures import Movie, Queue from varken.structures import RadarrMovie, Queue
from varken.helpers import hashit, connection_handler from varken.helpers import hashit, connection_handler
@ -31,9 +31,9 @@ class RadarrAPI(object):
return return
try: try:
movies = [Movie(**movie) for movie in get] movies = [RadarrMovie(**movie) for movie in get]
except TypeError as e: 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 return
for movie in movies: for movie in movies:
@ -82,9 +82,9 @@ class RadarrAPI(object):
for movie in get: for movie in get:
try: try:
movie['movie'] = Movie(**movie['movie']) movie['movie'] = RadarrMovie(**movie['movie'])
except TypeError as e: 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 return
try: try:

View file

@ -2,7 +2,7 @@ from logging import getLogger
from requests import Session, Request from requests import Session, Request
from datetime import datetime, timezone, date, timedelta 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 from varken.helpers import hashit, connection_handler
@ -34,11 +34,11 @@ class SonarrAPI(object):
if not get: if not get:
return return
# Iteratively create a list of TVShow Objects from response json # Iteratively create a list of SonarrTVShow Objects from response json
try: try:
tv_shows = [TVShow(**show) for show in get] tv_shows = [SonarrTVShow(**show) for show in get]
except TypeError as e: 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 return
# Add show to missing list if file does not exist # Add show to missing list if file does not exist
@ -87,9 +87,9 @@ class SonarrAPI(object):
return return
try: try:
tv_shows = [TVShow(**show) for show in get] tv_shows = [SonarrTVShow(**show) for show in get]
except TypeError as e: 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 return
for show in tv_shows: for show in tv_shows:

View file

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