|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import click
|
|
|
|
|
|
|
|
|
|
from ffx.model.show import Show
|
|
|
|
|
from ffx.show_descriptor import ShowDescriptor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ShowController():
|
|
|
|
@ -56,20 +57,20 @@ class ShowController():
|
|
|
|
|
s.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def updateShow(self, showDescriptor):
|
|
|
|
|
def updateShow(self, showDescriptor: ShowDescriptor):
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
s = self.Session()
|
|
|
|
|
q = s.query(Show).filter(Show.id == showDescriptor['id'])
|
|
|
|
|
q = s.query(Show).filter(Show.id == showDescriptor.getId())
|
|
|
|
|
|
|
|
|
|
if not q.count():
|
|
|
|
|
show = Show(id = int(showDescriptor['id']),
|
|
|
|
|
name = str(showDescriptor['name']),
|
|
|
|
|
year = int(showDescriptor['year']),
|
|
|
|
|
index_season_digits = showDescriptor['index_season_digits'],
|
|
|
|
|
index_episode_digits = showDescriptor['index_episode_digits'],
|
|
|
|
|
indicator_season_digits = showDescriptor['indicator_season_digits'],
|
|
|
|
|
indicator_episode_digits = showDescriptor['indicator_episode_digits'])
|
|
|
|
|
show = Show(id = int(showDescriptor.getId()),
|
|
|
|
|
name = str(showDescriptor.getName()),
|
|
|
|
|
year = int(showDescriptor.getYear()),
|
|
|
|
|
index_season_digits = showDescriptor.getIndexSeasonDigits(),
|
|
|
|
|
index_episode_digits = showDescriptor.getIndexEpisodeDigits(),
|
|
|
|
|
indicator_season_digits = showDescriptor.getIndicatorSeasonDigits(),
|
|
|
|
|
indicator_episode_digits = showDescriptor.getIndicatorEpisodeDigits())
|
|
|
|
|
|
|
|
|
|
s.add(show)
|
|
|
|
|
s.commit()
|
|
|
|
@ -79,24 +80,24 @@ class ShowController():
|
|
|
|
|
currentShow = q.first()
|
|
|
|
|
|
|
|
|
|
changed = False
|
|
|
|
|
if currentShow.name != str(showDescriptor['name']):
|
|
|
|
|
currentShow.name = str(showDescriptor['name'])
|
|
|
|
|
if currentShow.name != str(showDescriptor.getName()):
|
|
|
|
|
currentShow.name = str(showDescriptor.getName())
|
|
|
|
|
changed = True
|
|
|
|
|
if currentShow.year != int(showDescriptor['year']):
|
|
|
|
|
currentShow.year = int(showDescriptor['year'])
|
|
|
|
|
if currentShow.year != int(showDescriptor.getYear()):
|
|
|
|
|
currentShow.year = int(showDescriptor.getYear())
|
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
|
|
if currentShow.index_season_digits != int(showDescriptor['index_season_digits']):
|
|
|
|
|
currentShow.index_season_digits = int(showDescriptor['index_season_digits'])
|
|
|
|
|
if currentShow.index_season_digits != int(showDescriptor.getIndexSeasonDigits()):
|
|
|
|
|
currentShow.index_season_digits = int(showDescriptor.getIndexSeasonDigits())
|
|
|
|
|
changed = True
|
|
|
|
|
if currentShow.index_episode_digits != int(showDescriptor['index_episode_digits']):
|
|
|
|
|
currentShow.index_episode_digits = int(showDescriptor['index_episode_digits'])
|
|
|
|
|
if currentShow.index_episode_digits != int(showDescriptor.getIndexEpisodeDigits()):
|
|
|
|
|
currentShow.index_episode_digits = int(showDescriptor.getIndexEpisodeDigits())
|
|
|
|
|
changed = True
|
|
|
|
|
if currentShow.indicator_season_digits != int(showDescriptor['indicator_season_digits']):
|
|
|
|
|
currentShow.indicator_season_digits = int(showDescriptor['indicator_season_digits'])
|
|
|
|
|
if currentShow.indicator_season_digits != int(showDescriptor.getIndicatorSeasonDigits()):
|
|
|
|
|
currentShow.indicator_season_digits = int(showDescriptor.getIndicatorSeasonDigits())
|
|
|
|
|
changed = True
|
|
|
|
|
if currentShow.indicator_episode_digits != int(showDescriptor['indicator_episode_digits']):
|
|
|
|
|
currentShow.indicator_episode_digits = int(showDescriptor['indicator_episode_digits'])
|
|
|
|
|
if currentShow.indicator_episode_digits != int(showDescriptor.getIndicatorEpisodeDigits()):
|
|
|
|
|
currentShow.indicator_episode_digits = int(showDescriptor.getIndicatorEpisodeDigits())
|
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
|
|
if changed:
|
|
|
|
|