Ejemplo n.º 1
0
def migrate_db(old_db_file):
    old_style_events = HinduCalendarEventOld.read_from_file(old_db_file)
    for old_style_event in old_style_events:
        event = HinduCalendarEvent.from_old_style_event(
            old_style_event=old_style_event)
        logging.debug(str(event))
        event_file_name = event.get_storage_file_name(base_dir=os.path.join(
            CODE_ROOT, 'panchangam/temporal/festival/data'))
        logging.debug(event_file_name)
        event.dump_to_file(filename=event_file_name)
Ejemplo n.º 2
0
def migrate_db(old_db_file, only_descriptions=False):
    old_style_events = HinduCalendarEventOld.read_from_file(old_db_file)
    # TODO: Reset all README files in the folder here?
    for old_style_event in old_style_events:
        event = HinduCalendarEvent.from_old_style_event(
            old_style_event=old_style_event)
        logging.debug(str(event))
        event_file_name = event.get_storage_file_name(
            base_dir=os.path.join(CODE_ROOT,
                                  'panchangam/temporal/festival/data'),
            only_descriptions=only_descriptions)
        logging.debug(event_file_name)
        event.dump_to_file(filename=event_file_name)
        write_event_README(event, event_file_name)
Ejemplo n.º 3
0
def migrate_db(old_db_file, only_descriptions=False):
    old_style_events = HinduCalendarEventOld.read_from_file(old_db_file)
    output_dir = os.path.join(CODE_ROOT, 'panchangam/temporal/festival/data')
    # import shutil
    # shutil.rmtree(output_dir)
    for old_style_event in old_style_events:
        event = HinduCalendarEvent.from_old_style_event(
            old_style_event=old_style_event)
        logging.debug(str(event))
        event_file_name = event.get_storage_file_name(
            base_dir=output_dir, only_descriptions=only_descriptions)
        logging.debug(event_file_name)
        event.dump_to_file(filename=event_file_name)
        write_event_README(event, event_file_name)
Ejemplo n.º 4
0
def migrate_relative_db():
    old_style_events = HinduCalendarEventOld.read_from_file(
        os.path.join(
            CODE_ROOT,
            'panchangam/temporal/festival/legacy/relative_festival_rules.json')
    )
    for old_style_event in old_style_events:
        event = HinduCalendarEvent.from_old_style_event(
            old_style_event=old_style_event)
        logging.debug(str(event))
        event_file_name = event.get_storage_file_name(base_dir=os.path.join(
            CODE_ROOT, 'panchangam/temporal/festival/data'))
        logging.debug(event_file_name)
        event.dump_to_file(filename=event_file_name)
        write_event_README(event, event_file_name)