Building the list of files to convert every time this is run is painfully slow. A better solution might be to build a database of all convertible files, along with some metadata to detect if any of the files changed. If no changes detected, use the database instead of building a new list.
An example format:
Filename
Path
Last Seen
Last Modified (System)
Video Container
VCodec
Titanic (1997)
/home/user/Movies/
2023-05-14
2020-01-23
Matroska
HEVC
Moonrise Kingdom (2012)
/home/user/Movies/
2015-01-08
2019-09-12
Matroska
AVC
Nope (2022)
/home/user/Movies
NULL
2023-02-16
MPEG-4
AVC
The table above would be built with some combination of the existing sqlite database and a 'find . -type f -regex \.(mkv|mp4)$' command. The column Last Seen would have been the last time this program collected information for that particular row's file, while Last Modified would be taken from the file's information in the filesystem. For those rows where the value in Last Seen is earlier than Last Modified, or if Last Seen == NULL, the information would be updated, skipping lots of redundant work.
Building the list of files to convert every time this is run is painfully slow. A better solution might be to build a database of all convertible files, along with some metadata to detect if any of the files changed. If no changes detected, use the database instead of building a new list.
An example format:
The table above would be built with some combination of the existing sqlite database and a
'find . -type f -regex \.(mkv|mp4)$'
command. The columnLast Seen
would have been the last time this program collected information for that particular row's file, whileLast Modified
would be taken from the file's information in the filesystem. For those rows where the value inLast Seen
is earlier thanLast Modified
, or ifLast Seen == NULL
, the information would be updated, skipping lots of redundant work.