Пример #1
0
def _get_object_search(id, type):
    obj = None
    search = None

    if type == 'media':
        obj = Media.get(id)
        if obj:
            search = Media.get_search(obj)

    elif type == 'release':
        obj = Release.get(id)
        if obj:
            search = Release.get_search(obj)

    elif type == 'search':
        obj = Search.get(id)
        if obj:
            search = {
                'name': obj['name'],
                'category': obj['category'],
                'search_id': id,
                }
            if obj.get('album'):
                search['album'] = obj['album']

    if obj and search:
        search['extra'] = obj.get('extra', {})
        return search
Пример #2
0
def process_search(search_id):
    search = MSearch.get(search_id)
    if search:
        search = Search(search)
        search.process()
        search.save()