dont make date a field alias for dmtime, does not make sense because of diff. formats in general

This commit is contained in:
Jean-Francois Dockes 2021-01-16 19:19:29 +01:00
parent f15d6564c6
commit baf2ee8d6b
2 changed files with 13 additions and 6 deletions

View File

@ -120,6 +120,7 @@ tagdict = {
'TRACKTOTAL' : 'TOTALTRACKS',
'TRC' : 'ISRC',
'TRCK' : 'TRACKNUMBER',
'TRDA' : 'RECORDINGDATE',
'TRK' : 'TRACKNUMBER',
'TS2' : 'ALBUMARTISTSORT',
'TSA' : 'ALBUMSORT',
@ -140,7 +141,7 @@ tagdict = {
'TXXX:ORCHESTRA' : 'ORCHESTRA',
'TXX:ORCHESTRA' : 'ORCHESTRA',
'TYE' : 'DATE',
'TYER' : 'DATE',
'TYER' : 'DATE', # wikipedia id3: YEAR
'ULT' : 'LYRICS',
'USLT' : 'LYRICS',
'YEAR' : 'DATE',
@ -244,10 +245,11 @@ class AudioTagExtractor(RclBaseHandler):
# which means possible trouble for pre-1970 recordings (negative time).
# Oldest possible date with 32 bits time stamp is 1901, which is ok though.
#
# This is not used as we don't try to set dmtime (which would not
# be used by the current indexer anyway). We instead set a 'date'
# metadata entry.
# Previous recoll versions had an alias from date to dmtime, which
# was wrong, because dmtime is the unix integer time. We have
# removed the alias, and set dmtime from the parsed date value.
def parsedate(self, dt):
dt = dt.decode('utf-8', errors='ignore')
if len(dt) > 10:
dt = dt[0:10]
l = dt.split('-')
@ -398,7 +400,12 @@ class AudioTagExtractor(RclBaseHandler):
self.em.setfield("charset", 'utf-8')
if self.tagfix:
self.tagfix(minf)
if 'date' in minf:
uxtime = self.parsedate(minf['date'])
if uxtime:
minf['dmtime'] = uxtime
for tag,val in minf.items():
#self.em.rclog("%s -> %s" % (tag, val))
self.em.setfield(tag, val)

View File

@ -124,7 +124,7 @@ author = creator dc:creator xesam:author xesam:creator from
title = caption title dc:title subject
# catg = dc:type contentCategory
dbytes = size xesam:size
dmtime = date dc:date dc:datemodified datemodified contentmodified \
dmtime = dc:date dc:datemodified datemodified contentmodified \
xesam:contentmodified
ext = fileextension xesam:fileextension
# Don't add subject to keywords aliases, it's better to keep it for email