ArmindoFlores / ao3_api

An unofficial archiveofourown.org (AO3) API for python
MIT License
166 stars 64 forks source link

Convert status to string #78

Open ghost opened 1 year ago

ghost commented 1 year ago

I think something like this should be the default, with a customizable time for a fic to be a WIP:

def convert_status_to_string(meta: Dict) -> None:
    if not 'status' in meta:
        return
    if meta['status']:
        meta['status'] = 'Complete'
    elif 'date_updated' in meta and meta['date_updated']:
        date = datetime.strptime(meta['date_updated'], '%Y-%m-%d')
        if (datetime.now() - date).days < 365:
            meta['status'] = 'Work in Progress'
        else:
            meta['status'] = 'Incomplete'
    else:
        meta['status'] = 'Incomplete'