示例#1
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'].is_secure())
     else:
         return prepend_base(reverse('bookmarks-for-user', args=[obj.user.username]),
                             request_is_secure=self.context['request'].is_secure())
示例#2
0
 def get_images(self, obj):
     return {
             'waveform_m': prepend_base(obj.locations("display.wave.M.url"), request_is_secure=self.context['request'].is_secure()),
             'waveform_l': prepend_base(obj.locations("display.wave.L.url"), request_is_secure=self.context['request'].is_secure()),
             'spectral_m': prepend_base(obj.locations("display.spectral.M.url"), request_is_secure=self.context['request'].is_secure()),
             'spectral_l': prepend_base(obj.locations("display.spectral.L.url"), request_is_secure=self.context['request'].is_secure()),
     }
示例#3
0
 def get_previews(self, obj):
     # Uncomment the following code when we enable preview retrieval thourgh api instead of static file
     #return {
     #        'preview-hq-mp3': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.HQ.mp3.filename")]), request_is_secure=self.context['request'].is_secure()),
     #        'preview-hq-ogg': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.HQ.ogg.filename")]), request_is_secure=self.context['request'].is_secure()),
     #        'preview-lq-mp3': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.LQ.mp3.filename")]), request_is_secure=self.context['request'].is_secure()),
     #        'preview-lq-ogg': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.LQ.ogg.filename")]), request_is_secure=self.context['request'].is_secure()),
     #}
     return {
         'preview-hq-mp3':
         prepend_base(
             obj.locations("preview.HQ.mp3.url"),
             request_is_secure=self.context['request'].is_secure()),
         'preview-hq-ogg':
         prepend_base(
             obj.locations("preview.HQ.ogg.url"),
             request_is_secure=self.context['request'].is_secure()),
         'preview-lq-mp3':
         prepend_base(
             obj.locations("preview.LQ.mp3.url"),
             request_is_secure=self.context['request'].is_secure()),
         'preview-lq-ogg':
         prepend_base(
             obj.locations("preview.LQ.ogg.url"),
             request_is_secure=self.context['request'].is_secure()),
     }
示例#4
0
 def get_avatar(self, obj):
     return {
         'small': prepend_base(obj.profile.locations()['avatar']['S']['url'],
                               request_is_secure=self.context['request'].is_secure()),
         'medium': prepend_base(obj.profile.locations()['avatar']['M']['url'],
                                request_is_secure=self.context['request'].is_secure()),
         'large': prepend_base(obj.profile.locations()['avatar']['L']['url'],
                               request_is_secure=self.context['request'].is_secure()),
     }
示例#5
0
 def get_previews(self, obj):
     return {
         'preview-hq-mp3': prepend_base(obj.locations("preview.HQ.mp3.url"),
                                        request_is_secure=self.context['request'].is_secure()),
         'preview-hq-ogg': prepend_base(obj.locations("preview.HQ.ogg.url"),
                                        request_is_secure=self.context['request'].is_secure()),
         'preview-lq-mp3': prepend_base(obj.locations("preview.LQ.mp3.url"),
                                        request_is_secure=self.context['request'].is_secure()),
         'preview-lq-ogg': prepend_base(obj.locations("preview.LQ.ogg.url"),
                                        request_is_secure=self.context['request'].is_secure()),
     }
示例#6
0
 def get_images(self, obj):
     return {
         'waveform_m':
         prepend_base(
             obj.locations("display.wave.M.url"),
             request_is_secure=self.context['request'].is_secure()),
         'waveform_l':
         prepend_base(
             obj.locations("display.wave.L.url"),
             request_is_secure=self.context['request'].is_secure()),
         'spectral_m':
         prepend_base(
             obj.locations("display.spectral.M.url"),
             request_is_secure=self.context['request'].is_secure()),
         'spectral_l':
         prepend_base(
             obj.locations("display.spectral.L.url"),
             request_is_secure=self.context['request'].is_secure()),
         'waveform_bw_m':
         prepend_base(
             obj.locations("display.wave_bw.M.url"),
             request_is_secure=self.context['request'].is_secure()),
         'waveform_bw_l':
         prepend_base(
             obj.locations("display.wave_bw.L.url"),
             request_is_secure=self.context['request'].is_secure()),
         'spectral_bw_m':
         prepend_base(
             obj.locations("display.spectral_bw.M.url"),
             request_is_secure=self.context['request'].is_secure()),
         'spectral_bw_l':
         prepend_base(
             obj.locations("display.spectral_bw.L.url"),
             request_is_secure=self.context['request'].is_secure()),
     }
示例#7
0
 def get_previews(self, obj):
     # Uncomment the following code when we enable preview retrieval thourgh api instead of static file
     #return {
     #        'preview-hq-mp3': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.HQ.mp3.filename")]), request_is_secure=self.context['request'].is_secure()),
     #        'preview-hq-ogg': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.HQ.ogg.filename")]), request_is_secure=self.context['request'].is_secure()),
     #        'preview-lq-mp3': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.LQ.mp3.filename")]), request_is_secure=self.context['request'].is_secure()),
     #        'preview-lq-ogg': prepend_base(reverse('apiv2-sound-preview', args=[obj.id, obj.locations("preview.LQ.ogg.filename")]), request_is_secure=self.context['request'].is_secure()),
     #}
     return {
             'preview-hq-mp3': prepend_base(obj.locations("preview.HQ.mp3.url"), request_is_secure=self.context['request'].is_secure()),
             'preview-hq-ogg': prepend_base(obj.locations("preview.HQ.ogg.url"), request_is_secure=self.context['request'].is_secure()),
             'preview-lq-mp3': prepend_base(obj.locations("preview.LQ.mp3.url"), request_is_secure=self.context['request'].is_secure()),
             'preview-lq-ogg': prepend_base(obj.locations("preview.LQ.ogg.url"), request_is_secure=self.context['request'].is_secure()),
     }
示例#8
0
 def get_pack(self, obj):
     try:
         if obj.pack_id:
             return prepend_base(reverse('apiv2-pack-instance', args=[obj.pack_id]), request_is_secure=self.context['request'].is_secure())
         else:
             return None
     except:
         return None
示例#9
0
 def get_pack(self, obj):
     try:
         if obj.pack_id:
             return prepend_base(reverse('apiv2-pack-instance', args=[obj.pack_id]),
                                 request_is_secure=self.context['request'].is_secure())
         else:
             return None
     except:
         return None
示例#10
0
 def get_bookmark_categories(self, obj):
     return prepend_base(reverse('apiv2-user-bookmark-categories', args=[obj.username]),
                         request_is_secure=self.context['request'].is_secure())
示例#11
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)
示例#12
0
 def get_similar_sounds(self, obj):
     return prepend_base(reverse('apiv2-similarity-sound', args=[obj.id]), request_is_secure=self.context['request'].using_https)
示例#13
0
 def get_packs(self, obj):
     return prepend_base(reverse('apiv2-user-packs', args=[obj.username]),
                         request_is_secure=self.context['request'].is_secure())
示例#14
0
 def get_uri(self, obj):
     return prepend_base(
         reverse('apiv2-pack-instance', args=[obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#15
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'].is_secure())
示例#16
0
 def get_comment(self, obj):
     return prepend_base(
         reverse('apiv2-user-create-comment', args=[obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#17
0
 def get_uri(self, obj):
     return prepend_base(reverse('apiv2-pack-instance', args=[obj.id]), request_is_secure=self.context['request'].is_secure())
示例#18
0
 def get_ratings(self, obj):
     return prepend_base(reverse('apiv2-sound-ratings', args=[obj.id]), request_is_secure=self.context['request'].using_https)
示例#19
0
 def get_similar_sounds(self, obj):
     return prepend_base(
         reverse('apiv2-similarity-sound', args=[obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#20
0
 def get_url(self, obj):
     return prepend_base(reverse('account', args=[obj.username]), request_is_secure=self.context['request'].using_https)
示例#21
0
 def get_sounds(self, obj):
     return prepend_base(reverse('apiv2-user-sound-list', args=[obj.username]), request_is_secure=self.context['request'].using_https)
示例#22
0
 def get_url(self, obj):
     username = self.get_username(obj)
     return prepend_base(
         reverse('sound', args=[username, obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#23
0
 def get_url(self, obj):
     return prepend_base(reverse('pack', args=[obj.user.username, obj.id]),
                         request_is_secure=self.context['request'].is_secure())
示例#24
0
 def get_bookmark_categories(self, obj):
     return prepend_base(
         reverse('apiv2-user-bookmark-categories', args=[obj.username]),
         request_is_secure=self.context['request'].is_secure())
示例#25
0
 def get_sounds(self, obj):
     return prepend_base(reverse('apiv2-pack-sound-list', args=[obj.id]),
                         request_is_secure=self.context['request'].is_secure())
示例#26
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)
示例#27
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'].is_secure())
示例#28
0
 def get_analysis_frames(self, obj):
     if obj.analysis_state != 'OK':
         return None
     return prepend_base(obj.locations('analysis.frames.url'),
                         request_is_secure=self.context['request'].is_secure())
示例#29
0
 def get_analysis_frames(self, obj):
     return prepend_base(
         obj.locations('analysis.frames.url'),
         request_is_secure=self.context['request'].is_secure())
示例#30
0
 def get_analysis_stats(self, obj):
     if obj.analysis_state != 'OK':
         return None
     return prepend_base(reverse('apiv2-sound-analysis', args=[obj.id]),
                         request_is_secure=self.context['request'].is_secure())
示例#31
0
 def get_download(self, obj):
     return prepend_base(
         reverse('apiv2-sound-download', args=[obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#32
0
 def get_similar_sounds(self, obj):
     if obj.similarity_state != 'OK':
         return None
     return prepend_base(reverse('apiv2-similarity-sound', args=[obj.id]),
                         request_is_secure=self.context['request'].is_secure())
示例#33
0
 def get_comments(self, obj):
     return prepend_base(
         reverse('apiv2-sound-comments', args=[obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#34
0
 def get_download(self, obj):
     return prepend_base(reverse('apiv2-sound-download', args=[obj.id]),
                         request_is_secure=self.context['request'].is_secure())
示例#35
0
 def get_url(self, obj):
     return prepend_base(
         reverse('pack', args=[obj.user.username, obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#36
0
 def get_comment(self, obj):
     return prepend_base(reverse('apiv2-user-create-comment', args=[obj.id]),
                         request_is_secure=self.context['request'].is_secure())
示例#37
0
 def get_sounds(self, obj):
     return prepend_base(
         reverse('apiv2-pack-sound-list', args=[obj.id]),
         request_is_secure=self.context['request'].is_secure())
示例#38
0
 def get_comments(self, obj):
     return prepend_base(reverse('apiv2-sound-comments', args=[obj.id]),
                         request_is_secure=self.context['request'].is_secure())
示例#39
0
 def get_user(self, obj):
     return prepend_base(
         reverse('apiv2-user-instance', args=[obj.user.username]),
         request_is_secure=self.context['request'].is_secure())
示例#40
0
 def get_analysis_frames(self, obj):
     return prepend_base(obj.locations('analysis.frames.url'), request_is_secure=self.context['request'].using_https)