def _set_date_str(info, date_str, original=False):
 if date_str:
  date_parts = date_str.split('-')
  for key in ('year', 'month', 'day'):
   if date_parts:
    date_part = date_parts.pop(0)
    try:
     date_num = int(date_part)
    except ValueError:
     continue
    if original:
     key = ('original_' + key)
    setattr(info, key, date_num)

def _set_date_str ( info , date_str , original = False ) : if date_str : date_parts = date_str . split ( '-' ) for key in ( 'year' , 'month' , 'day' ) : if date_parts : date_part = date_parts . pop ( 0 ) try : date_num = int ( date_part ) except ValueError : continue if original : key = ( 'original_' + key ) setattr ( info , key , date_num )
given a yyyy-mm-dd string and an albuminfo object .