Browse Source

[TV] Fixed show adding bug when show/episode identifiers conflict

pull/3761/head
Dean Gardiner 11 years ago
parent
commit
a11aa2c14e
  1. 4
      couchpotato/core/media/show/_base/episode.py
  2. 4
      couchpotato/core/media/show/_base/main.py
  3. 4
      couchpotato/core/media/show/_base/season.py

4
couchpotato/core/media/show/_base/episode.py

@ -12,6 +12,8 @@ autoload = 'Episode'
class Episode(MediaBase): class Episode(MediaBase):
_type = 'show.episode'
def __init__(self): def __init__(self):
addEvent('show.episode.add', self.add) addEvent('show.episode.add', self.add)
addEvent('show.episode.update', self.update) addEvent('show.episode.update', self.update)
@ -37,7 +39,7 @@ class Episode(MediaBase):
} }
# Check if season already exists # Check if season already exists
existing_episode = fireEvent('media.with_identifiers', identifiers, with_doc = True, single = True) existing_episode = fireEvent('media.with_identifiers', identifiers, with_doc = True, types = [self._type], single = True)
db = get_db() db = get_db()

4
couchpotato/core/media/show/_base/main.py

@ -105,7 +105,7 @@ class ShowBase(MediaBase):
# Update media with info # Update media with info
self.updateInfo(media, info) self.updateInfo(media, info)
existing_show = fireEvent('media.with_identifiers', params.get('identifiers'), with_doc = True) existing_show = fireEvent('media.with_identifiers', params.get('identifiers'), with_doc = True, types = [self._type], single = True)
db = get_db() db = get_db()
@ -233,8 +233,6 @@ class ShowBase(MediaBase):
return {} return {}
def updateInfo(self, media, info): def updateInfo(self, media, info):
db = get_db()
# Remove season info for later use (save separately) # Remove season info for later use (save separately)
info.pop('in_wanted', None) info.pop('in_wanted', None)
info.pop('in_library', None) info.pop('in_library', None)

4
couchpotato/core/media/show/_base/season.py

@ -12,6 +12,8 @@ autoload = 'Season'
class Season(MediaBase): class Season(MediaBase):
_type = 'show.season'
def __init__(self): def __init__(self):
addEvent('show.season.add', self.add) addEvent('show.season.add', self.add)
addEvent('show.season.update', self.update) addEvent('show.season.update', self.update)
@ -34,7 +36,7 @@ class Season(MediaBase):
} }
# Check if season already exists # Check if season already exists
existing_season = fireEvent('media.with_identifiers', identifiers, with_doc = True, single = True) existing_season = fireEvent('media.with_identifiers', identifiers, with_doc = True, types = [self._type], single = True)
db = get_db() db = get_db()

Loading…
Cancel
Save