Ejemplo n.º 1
0
def remove_movement(movement):
    with dblock.DBLock():
        Movement.objects.filter(id=movement).delete()
Ejemplo n.º 2
0
def remove_recording(name):
    with dblock.DBLock():
        r = _get_no_recording()
        Movement.objects.filter(recording__name=name).update(recording=r)
        Recording.objects.filter(name=name).delete()
Ejemplo n.º 3
0
def remove_photo(name):
    with dblock.DBLock():
        p = _get_no_photo()

        Movement.objects.filter(photo__name=name).update(photo=p)
        Photo.objects.filter(name=name).delete()
Ejemplo n.º 4
0
def get_movements():
    with dblock.DBLock():
        return list(Movement.objects.order_by('-time').all())
Ejemplo n.º 5
0
def get_movement(id_):
    with dblock.DBLock():
        return Movement.objects.filter(id=id_).first()
Ejemplo n.º 6
0
def get_photos():
    with dblock.DBLock():
        return list(
            Photo.objects.exclude(name="nophoto").order_by('-time').all())
Ejemplo n.º 7
0
def get_recordings():
    with dblock.DBLock():
        return list(
            Recording.objects.exclude(
                name="norecording").order_by('-time').all())
Ejemplo n.º 8
0
def add_movement(time, recording, photo):
    with dblock.DBLock():
        p = Photo.objects.filter(name=photo).first()
        r = Recording.objects.filter(name=recording).first()
        Movement(time=time, recording=r, photo=p).save()
Ejemplo n.º 9
0
def add_recording(name, time, lenght, photo):
    with dblock.DBLock():
        p = Photo.objects.filter(name=photo).first()
        Recording(name=name, time=time, lenght=lenght, photo=p).save()
Ejemplo n.º 10
0
def add_photo(name, thumbnail, time):
    with dblock.DBLock():
        Photo(name=name, thumbnail=thumbnail, time=time).save()