Beispiel #1
0
 def get_images(self, obj):
     return {
             'waveform_m': prepend_base(obj.locations("display.wave.M.url"), request_is_secure=self.context['request'].using_https),
             'waveform_l': prepend_base(obj.locations("display.wave.L.url"), request_is_secure=self.context['request'].using_https),
             'spectral_m': prepend_base(obj.locations("display.spectral.M.url"), request_is_secure=self.context['request'].using_https),
             'spectral_l': prepend_base(obj.locations("display.spectral.L.url"), request_is_secure=self.context['request'].using_https),
     }
Beispiel #2
0
 def get_previews(self, obj):
     return {
             'preview-hq-mp3': prepend_base(obj.locations("preview.HQ.mp3.url"), request_is_secure=self.context['request'].using_https),
             'preview-hq-ogg': prepend_base(obj.locations("preview.HQ.ogg.url"), request_is_secure=self.context['request'].using_https),
             'preview-lq-mp3': prepend_base(obj.locations("preview.LQ.mp3.url"), request_is_secure=self.context['request'].using_https),
             'preview-lq-ogg': prepend_base(obj.locations("preview.LQ.ogg.url"), request_is_secure=self.context['request'].using_https),
     }
Beispiel #3
0
 def get_avatar(self, obj):
     if obj.profile.has_avatar:
         return {
                 'Small': prepend_base(obj.profile.locations()['avatar']['S']['url'], request_is_secure=self.context['request'].using_https),
                 'Medium': prepend_base(obj.profile.locations()['avatar']['M']['url'], request_is_secure=self.context['request'].using_https),
                 'Large': prepend_base(obj.profile.locations()['avatar']['L']['url'], request_is_secure=self.context['request'].using_https),
         }
     else:
         return None
Beispiel #4
0
 def get_pack(self, obj):
     try:
         if obj.pack:
             return prepend_base(reverse('apiv2-pack-instance', args=[obj.pack.id]), request_is_secure=self.context['request'].using_https)
         else:
             return None
     except:
         return None
Beispiel #5
0
 def get_user(self, obj):
     return prepend_base(reverse('apiv2-user-instance', args=[obj.user.username]), request_is_secure=self.context['request'].using_https)
Beispiel #6
0
 def get_sounds(self, obj):
     return prepend_base(reverse('apiv2-user-bookmark-category-sounds', args=[obj.user.username, obj.id]), request_is_secure=self.context['request'].using_https)
Beispiel #7
0
 def get_url(self, obj):
     if obj.id != 0:
         return prepend_base(reverse('bookmarks-for-user-for-category', args=[obj.user.username, obj.id]), request_is_secure=self.context['request'].using_https)
     else:
         return prepend_base(reverse('bookmarks-for-user', args=[obj.user.username]), request_is_secure=self.context['request'].using_https)
Beispiel #8
0
 def get_sounds(self, obj):
     return prepend_base(reverse('apiv2-pack-sound-list', args=[obj.id]), request_is_secure=self.context['request'].using_https)
Beispiel #9
0
 def get_uri(self, obj):
     return prepend_base(reverse('apiv2-pack-instance', args=[obj.id]), request_is_secure=self.context['request'].using_https)
Beispiel #10
0
 def get_url(self, obj):
     return prepend_base(reverse('pack', args=[obj.user.username, obj.id]), request_is_secure=self.context['request'].using_https)
Beispiel #11
0
 def get_comments(self, obj):
     return prepend_base(reverse('apiv2-sound-comments', args=[obj.id]), request_is_secure=self.context['request'].using_https)
Beispiel #12
0
 def get_bookmark(self, obj):
     return prepend_base(reverse('apiv2-user-create-bookmark', args=[obj.id]), request_is_secure=self.context['request'].using_https)
Beispiel #13
0
 def get_analysis_frames(self, obj):
     return prepend_base(obj.locations('analysis.frames.url'), request_is_secure=self.context['request'].using_https)
Beispiel #14
0
 def get_avatar(self, obj):
     return {
             'small': prepend_base(obj.profile.locations()['avatar']['S']['url'], request_is_secure=self.context['request'].using_https),
             'medium': prepend_base(obj.profile.locations()['avatar']['M']['url'], request_is_secure=self.context['request'].using_https),
             'large': prepend_base(obj.profile.locations()['avatar']['L']['url'], request_is_secure=self.context['request'].using_https),
     }