df
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import click
|
import click
|
||||||
|
|
||||||
from ffx.model.show import Show
|
from ffx.model.show import Show
|
||||||
|
from ffx.show_descriptor import ShowDescriptor
|
||||||
|
|
||||||
|
|
||||||
class ShowController():
|
class ShowController():
|
||||||
@@ -56,20 +57,20 @@ class ShowController():
|
|||||||
s.close()
|
s.close()
|
||||||
|
|
||||||
|
|
||||||
def updateShow(self, showDescriptor):
|
def updateShow(self, showDescriptor: ShowDescriptor):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
s = self.Session()
|
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():
|
if not q.count():
|
||||||
show = Show(id = int(showDescriptor['id']),
|
show = Show(id = int(showDescriptor.getId()),
|
||||||
name = str(showDescriptor['name']),
|
name = str(showDescriptor.getName()),
|
||||||
year = int(showDescriptor['year']),
|
year = int(showDescriptor.getYear()),
|
||||||
index_season_digits = showDescriptor['index_season_digits'],
|
index_season_digits = showDescriptor.getIndexSeasonDigits(),
|
||||||
index_episode_digits = showDescriptor['index_episode_digits'],
|
index_episode_digits = showDescriptor.getIndexEpisodeDigits(),
|
||||||
indicator_season_digits = showDescriptor['indicator_season_digits'],
|
indicator_season_digits = showDescriptor.getIndicatorSeasonDigits(),
|
||||||
indicator_episode_digits = showDescriptor['indicator_episode_digits'])
|
indicator_episode_digits = showDescriptor.getIndicatorEpisodeDigits())
|
||||||
|
|
||||||
s.add(show)
|
s.add(show)
|
||||||
s.commit()
|
s.commit()
|
||||||
@@ -79,24 +80,24 @@ class ShowController():
|
|||||||
currentShow = q.first()
|
currentShow = q.first()
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
if currentShow.name != str(showDescriptor['name']):
|
if currentShow.name != str(showDescriptor.getName()):
|
||||||
currentShow.name = str(showDescriptor['name'])
|
currentShow.name = str(showDescriptor.getName())
|
||||||
changed = True
|
changed = True
|
||||||
if currentShow.year != int(showDescriptor['year']):
|
if currentShow.year != int(showDescriptor.getYear()):
|
||||||
currentShow.year = int(showDescriptor['year'])
|
currentShow.year = int(showDescriptor.getYear())
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
if currentShow.index_season_digits != int(showDescriptor['index_season_digits']):
|
if currentShow.index_season_digits != int(showDescriptor.getIndexSeasonDigits()):
|
||||||
currentShow.index_season_digits = int(showDescriptor['index_season_digits'])
|
currentShow.index_season_digits = int(showDescriptor.getIndexSeasonDigits())
|
||||||
changed = True
|
changed = True
|
||||||
if currentShow.index_episode_digits != int(showDescriptor['index_episode_digits']):
|
if currentShow.index_episode_digits != int(showDescriptor.getIndexEpisodeDigits()):
|
||||||
currentShow.index_episode_digits = int(showDescriptor['index_episode_digits'])
|
currentShow.index_episode_digits = int(showDescriptor.getIndexEpisodeDigits())
|
||||||
changed = True
|
changed = True
|
||||||
if currentShow.indicator_season_digits != int(showDescriptor['indicator_season_digits']):
|
if currentShow.indicator_season_digits != int(showDescriptor.getIndicatorSeasonDigits()):
|
||||||
currentShow.indicator_season_digits = int(showDescriptor['indicator_season_digits'])
|
currentShow.indicator_season_digits = int(showDescriptor.getIndicatorSeasonDigits())
|
||||||
changed = True
|
changed = True
|
||||||
if currentShow.indicator_episode_digits != int(showDescriptor['indicator_episode_digits']):
|
if currentShow.indicator_episode_digits != int(showDescriptor.getIndicatorEpisodeDigits()):
|
||||||
currentShow.indicator_episode_digits = int(showDescriptor['indicator_episode_digits'])
|
currentShow.indicator_episode_digits = int(showDescriptor.getIndicatorEpisodeDigits())
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
if changed:
|
if changed:
|
||||||
|
|||||||
Reference in New Issue
Block a user