Skip to content

Commit

Permalink
specified classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtycajunrice committed Dec 30, 2018
1 parent a31e80a commit 88b3982
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions varken/radarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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


Expand Down Expand Up @@ -31,9 +31,9 @@ def get_missing(self):
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:
Expand Down Expand Up @@ -82,9 +82,9 @@ def get_queue(self):

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:
Expand Down
12 changes: 6 additions & 6 deletions varken/sonarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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


Expand Down Expand Up @@ -34,11 +34,11 @@ def get_missing(self):
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
Expand Down Expand Up @@ -87,9 +87,9 @@ def get_future(self):
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:
Expand Down
4 changes: 2 additions & 2 deletions varken/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class OmbiMovieRequest(NamedTuple):


# Sonarr
class TVShow(NamedTuple):
class SonarrTVShow(NamedTuple):
absoluteEpisodeNumber: int = None
airDate: str = None
airDateUtc: str = None
Expand All @@ -194,7 +194,7 @@ class TVShow(NamedTuple):


# Radarr
class Movie(NamedTuple):
class RadarrMovie(NamedTuple):
added: str = None
addOptions: str = None
alternativeTitles: list = None
Expand Down

0 comments on commit 88b3982

Please sign in to comment.