feed: date from txdate=
This commit is contained in:
parent
af4ff802ff
commit
5a28106714
1 changed files with 5 additions and 3 deletions
6
feed
6
feed
|
@ -188,7 +188,9 @@ def get_audio_from_description(text):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.warning('could not parse txdate %s', metadata['txdate'])
|
logging.warning('could not parse txdate %s', metadata['txdate'])
|
||||||
del metadata['txdate']
|
del metadata['txdate']
|
||||||
a = Audio(unquote(url), metadata.get('durata', None))
|
a = Audio(unquote(url),
|
||||||
|
duration=metadata.get('durata', None),
|
||||||
|
date=metadata.get('txdate', None))
|
||||||
|
|
||||||
if 'txdate' in metadata and 'replica' in metadata:
|
if 'txdate' in metadata and 'replica' in metadata:
|
||||||
if metadata['replica'].endswith('g'):
|
if metadata['replica'].endswith('g'):
|
||||||
|
@ -214,7 +216,6 @@ def get_audio_from_dir(dirpath):
|
||||||
|
|
||||||
|
|
||||||
def get_item_date(el):
|
def get_item_date(el):
|
||||||
# TODO: pick from txdate=
|
|
||||||
el_date = el.find('pubdate')
|
el_date = el.find('pubdate')
|
||||||
if el_date is not None:
|
if el_date is not None:
|
||||||
return datetime.datetime.strptime(
|
return datetime.datetime.strptime(
|
||||||
|
@ -234,6 +235,7 @@ def get_urls(tree):
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logging.info('error getting duration for `%s`' % title)
|
logging.info('error getting duration for `%s`' % title)
|
||||||
continue
|
continue
|
||||||
|
if audio.date is None:
|
||||||
audio.date = get_item_date(it)
|
audio.date = get_item_date(it)
|
||||||
yield audio
|
yield audio
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue