Esempio n. 1
0
 def cached_center(self):
     if not self.center_id:
         return None
     if not self._cache_center_last_update or self._cache_center_last_update < timezone.now(
     ) - datetime.timedelta(days=self._cache_center_days):
         self.force_cache_center()
     return AttrDict({
         'pk':
         self.center_id,
         'id':
         self.center_id,
         'card_id':
         self._cache_center_card_id,
         'awakened':
         self._cache_center_awakened,
         'card':
         AttrDict({
             'id':
             self._cache_center_card_id,
             'pk':
             self._cache_center_card_id,
             'i_type':
             self._cache_center_card_i_type,
             'type':
             TYPE_DICT[self._cache_center_card_i_type]
             if self._cache_center_card_i_type is not None else None,
             'english_type':
             ENGLISH_TYPE_DICT[self._cache_center_card_i_type]
             if self._cache_center_card_i_type is not None else None,
             'icon':
             self._cache_center_card_icon,
             'icon_url':
             get_image_url(self._cache_center_card_icon),
             'art':
             self._cache_center_card_art,
             'art_url':
             get_image_url(self._cache_center_card_art),
             'transparent':
             self._cache_center_card_transparent,
             'transparent_url':
             get_image_url(self._cache_center_card_transparent),
             'string':
             self._cache_center_card_string,
             'item_url':
             u'/card/{}/{}/'.format(
                 self._cache_center_card_id,
                 tourldash(self._cache_center_card_string)),
             'ajax_item_url':
             u'/ajax/card/{}/'.format(self._cache_center_card_id),
         }),
     })
Esempio n. 2
0
 def cached_idol(self):
     if not self._cache_idol_last_update or self._cache_idol_last_update < timezone.now(
     ) - datetime.timedelta(days=self._cache_idol_days):
         self.force_cache_idol()
     return AttrDict({
         'pk':
         self.idol_id,
         'id':
         self.idol_id,
         'name':
         self._cache_idol_name,
         'japanese_name':
         self._cache_idol_japanese_name,
         'i_type':
         self._cache_idol_i_type,
         'type':
         TYPE_DICT[self._cache_idol_i_type]
         if self._cache_idol_i_type is not None else None,
         'english_type':
         ENGLISH_TYPE_DICT[self._cache_idol_i_type]
         if self._cache_idol_i_type is not None else None,
         'image':
         self._cache_idol_image,
         'image_url':
         get_image_url(self._cache_idol_image),
         'http_image_url':
         get_http_image_url(self._cache_idol_image),
         'item_url':
         u'/idol/{}/{}/'.format(self.idol_id,
                                tourldash(self._cache_idol_name)),
         'ajax_item_url':
         u'/ajax/idol/{}/'.format(self.idol_id),
     })
Esempio n. 3
0
 def cached_event(self):
     if not self.event_id:
         return None
     if not self._cache_event_last_update or self._cache_event_last_update < timezone.now(
     ) - datetime.timedelta(days=self._cache_event_days):
         self.force_cache_event()
     return AttrDict({
         'id':
         self.event_id,
         'pk':
         self.event_id,
         'name':
         self._cache_event_name,
         'translated_name':
         self._cache_event_translated_name,
         'image':
         self._cache_event_image,
         'image_url':
         get_image_url(self._cache_event_image),
         'item':
         u'/event/{}/{}/'.format(
             self.event_id,
             tourldash(
                 self._cache_event_translated_name if self.
                 _cache_event_translated_name else self._cache_event_name)),
         'ajax_item_url':
         u'/ajax/event/{}/'.format(self.event_id),
     })
Esempio n. 4
0
 def favorite_character_image(self, number):
     if getattr(self, 'favorite_character{}'.format(number)) and FAVORITE_CHARACTERS:
         try:
             imagePath = (image for (name, __, image) in FAVORITE_CHARACTERS if unicode(name) == getattr(self, 'favorite_character{}'.format(number))).next()
         except StopIteration:
             return None
         if '//' in imagePath:
             return imagePath
         return get_image_url(imagePath)
     return None
Esempio n. 5
0
 def puchi_awakened_url(self):
     return get_image_url(self.puchi_awakened)
Esempio n. 6
0
 def puchi_url(self):
     return get_image_url(self.puchi)
Esempio n. 7
0
 def icon_awakened_url(self):
     return get_image_url(self.icon_awakened)
Esempio n. 8
0
 def icon_url(self):
     return get_image_url(self.icon)
Esempio n. 9
0
 def transparent_awakened_url(self):
     return get_image_url(self.transparent_awakened)
Esempio n. 10
0
 def transparent_url(self):
     return get_image_url(self.transparent)
Esempio n. 11
0
 def art_hd_awakened_url(self):
     return get_image_url(self.art_hd_awakened)
Esempio n. 12
0
 def art_hd_url(self):
     return get_image_url(self.art_hd)
Esempio n. 13
0
 def signature_url(self):
     return get_image_url(self.signature)