Exemplo n.º 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())
Exemplo n.º 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()),
     }
Exemplo n.º 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()),
     }
Exemplo n.º 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()),
     }
Exemplo n.º 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()),
     }
Exemplo n.º 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()),
     }
Exemplo n.º 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()),
     }
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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())
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 20
0
 def get_url(self, obj):
     return prepend_base(reverse('account', args=[obj.username]), request_is_secure=self.context['request'].using_https)
Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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)
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 29
0
 def get_analysis_frames(self, obj):
     return prepend_base(
         obj.locations('analysis.frames.url'),
         request_is_secure=self.context['request'].is_secure())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 40
0
 def get_analysis_frames(self, obj):
     return prepend_base(obj.locations('analysis.frames.url'), request_is_secure=self.context['request'].using_https)