예제 #1
0
파일: models.py 프로젝트: gage/proto
    def create_object_by_id(self, sc_id):
        """
        If we have this object in socialite -> query from db and return
        else -> fetch from SoundCloud
        """
        from utils import SoundCloudProcessor
        try:
            obj = self.get(sid=sc_id)
            return obj
        except SoundCloud.DoesNotExist:
            pass

        sc_obj = SoundCloudProcessor.fetch(sc_id)
        if sc_obj:
            sc_obj.save()
            return sc_obj

        print sc_id
        # Errors
        return None
예제 #2
0
파일: models.py 프로젝트: gage/proto
 def search(self, q):
     from utils import SoundCloudProcessor
     sounds = SoundCloudProcessor.search(q)
     return sounds