#!/usr/bin/env python

from extract_converter import ExtractConverter
import click


def convert(x):
    meta = {
        #meta['all'] = [w['item'] for w in x['result']['content']]
        'amalia': x['result']['Amalia_Json']
    }
    available_data = ['video_persons']
    return meta, available_data


@click.command()
@click.option('--reset', is_flag=True, help="reset data_available")
@click.option('--clean', is_flag=True, help="reset data_available and remove existing meta.source")
def run(reset, clean):
    conv = ExtractConverter('video_persons', convert)
    conv.run()


if __name__ == '__main__':
    run()

@@ -100,102 +100,79 @@
 :%0A  
-  meta = %7B%0A        #meta%5B'all'%5D = %5Bw%5B'item'%5D for w in x%5B'result'%5D%5B'content'%5D%5D%0A        
+available_data = %5B'video_persons'%5D%0A  meta = %7B%7D%0A  try:%0A    meta%5B
 'amalia'
 : x%5B
@@ -167,17 +167,19 @@
 'amalia'
-:
+%5D =
  x%5B'resu
@@ -202,14 +202,8 @@
 n'%5D%0A
-    %7D%0A
     
@@ -208,36 +208,40 @@
   available_data
- = %5B
+.append(
 'video_persons'%5D
@@ -238,21 +238,82 @@
 _persons
-'%5D%0A  
+-amalia')%0A  except Exception as e:%0A    print %22no Amalia data:%22, e%0A
   return

make Amalia optional