openmedialibrary/oml/item/add.py

21 lines
358 B
Python
Raw Normal View History

2014-05-04 17:26:43 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
2014-05-16 08:06:11 +00:00
from __future__ import division
2014-05-04 17:26:43 +00:00
import base64
import models
import ox
import scan
def add(path):
info = scan.get_metadata(path)
id = info.pop('id')
item = models.Item.get_or_create(id)
item.path = path
item.info = info
models.db.session.add(item)
models.db.session.commit()