def __volume_to_seriesref(volume): ''' Converts a cvdb "volume" dom element into a SeriesRef. ''' publisher = '' if len(volume.publisher.__dict__) <= 1 else \ volume.publisher.name return SeriesRef( int(volume.id), sstr(volume.name), sstr(volume.start_year).rstrip("- "), # see bug 334 sstr(publisher), sstr(volume.count_of_issues), __parse_image_url(volume))
def __extract_series_ref(self): ''' This method attempts to rebuild the SeriesRef that the user chose the last time that they scraped this comic. If it can do so, it will return that SeriesRef, otherwise it will return None. ''' # in this method, its easier to work with tags as a single string bd = self.__bookdata retval = None series_key = int(bd.series_key_s) if \ utils.is_number(bd.series_key_s) else None if series_key != None: # found a key tag! convert to a sparse SeriesRef retval = SeriesRef(series_key, None, -1, '', -1, None) return retval