addDates für Fairphone-Dateien
This commit is contained in:
parent
077f490687
commit
b14a1bb644
1 changed files with 16 additions and 15 deletions
|
@ -61,16 +61,27 @@ DATE_REGEX = re.compile(r'20\d{2}_\d{2}_\d{2}')
|
|||
DATE_IN_FILENAME_REGEXES = [
|
||||
r"signal-(?P<year>20\d{2})-(?P<month>[01]\d)-(?P<day>[0123]\d)-(?P<hour>"
|
||||
+ r"\d{2})(?P<min>\d{2})(?P<sec>\d{2})(?P<extra>.*)",
|
||||
r"signal-(?P<year>20\d{2})-(?P<month>[01]\d)-(?P<day>[0123]\d)-(?P<hour>"
|
||||
+ r"\d{2})-(?P<min>\d{2})-(?P<sec>\d{2})-\d{3}(?P<extra>.*)",
|
||||
# telegram:
|
||||
r"photo_(?P<year>20\d{2})-(?P<month>[01]\d)-(?P<day>[0123]\d)_(?P<hour>"
|
||||
+ r"\d{2})-(?P<min>\d{2})-(?P<sec>\d{2})(?P<extra>.*)",
|
||||
# Camera from my Fairphone 3 with DivestOS:
|
||||
r"(?P<year>20\d{2})_(?P<month>[01]\d)_(?P<day>[0123]\d)_"
|
||||
+ r"(?P<hour>\d{2})(?P<min>\d{2})(?P<sec>\d{2})_"
|
||||
+ r"\d{4}-(\d{2}-){5}\d{3}(?P<extra>.*)"
|
||||
+ r"\d{4}-(\d{2}-){5}\d{3}(?P<extra>.*)",
|
||||
r"VID_(?P<year>20\d{2})(?P<month>[01]\d)(?P<day>[0123]\d)_"
|
||||
+ r"(?P<hour>\d{2})(?P<min>\d{2})(?P<sec>\d{2})(?P<extra>.*)",
|
||||
# Recordings from my Fairphone 3 with DivestOS:
|
||||
r"Sound record \((?P<year>20\d{2})-(?P<month>[01]\d)-(?P<day>[0123]\d) "
|
||||
+ r"(?P<hour>\d{2})_(?P<min>\d{2})_(?P<sec>\d{2})\)(?P<extra>.*)"
|
||||
]
|
||||
DATE_IN_FILENAME_REGEXES = [re.compile(regex) for regex in
|
||||
DATE_IN_FILENAME_REGEXES]
|
||||
CHANGED_FILE_TYPES = ('.jpeg', '.jpg', '.JPEG', '.JPG',
|
||||
'.png', '.PNG', '.mov', '.MOV',
|
||||
'.mp4', '.mkv', '.mts', '.MTS', '.m4a')
|
||||
|
||||
LOGGER = logging.getLogger('addDates')
|
||||
# not used:
|
||||
EXIF_TAGS = {'.jpg': ("EXIF DateTimeOriginal", ["Image DateTime"]),
|
||||
|
@ -349,21 +360,11 @@ def if_ignore_dir(dirname):
|
|||
def if_ignore_file(filename):
|
||||
"""Return if this file should be ignored."""
|
||||
return (
|
||||
filename.startswith('.') or not (
|
||||
filename.endswith('.jpeg') or
|
||||
filename.endswith('.jpg') or
|
||||
filename.endswith('.JPEG') or
|
||||
filename.endswith('.JPG') or
|
||||
filename.endswith('.png') or
|
||||
filename.endswith('.PNG') or
|
||||
filename.endswith('.mov') or
|
||||
filename.endswith('.MOV') or
|
||||
filename.endswith('.mp4') or
|
||||
filename.endswith('.mkv') or
|
||||
filename.endswith('.mts') or
|
||||
filename.endswith('.MTS')
|
||||
)
|
||||
filename.startswith('.') or not any(
|
||||
filename.endswith(suffix) for suffix in
|
||||
CHANGED_FILE_TYPES)
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_args()
|
||||
logging.basicConfig(
|
||||
|
|
Loading…
Reference in a new issue