Beispiel #1
0
def add_cast(obj, cast_text , user):
    '''
    Add cast to a show/movie from a a json object.
    '''
    cast = json.loads(cast_text)
    #check if it's not a dict
    if not isinstance(cast[0], int): obj.cast.clear()
    for actor in cast:
        try:
            act, created = Actor.objects.get_or_create(name_en=actor['name'], imdb_id=actor['id'])

            if created:
                act.creator = user
            act.save()
            fillActorDataTask.delay(actor['id'], save_to_db=True)
            obj.cast.add(act)

        except:
            pass
Beispiel #2
0
 def test_fillActorDataTask(self):
     task = fillActorDataTask.delay(person_id="0491402", save_to_db=True)
     self.assertEqual( task.result, None)