Add reset option. Use mtime from the end of the run
This commit is contained in:
parent
be2ae8b7a8
commit
c46eea4d44
26
main.py
26
main.py
@ -202,29 +202,35 @@ if __name__ == "__main__":
|
|||||||
default=multiprocessing.cpu_count(),
|
default=multiprocessing.cpu_count(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# in case you wanted to rerun the conversion for everything
|
||||||
|
parser.add_argument(
|
||||||
|
"-r",
|
||||||
|
"--reset",
|
||||||
|
required=False,
|
||||||
|
action="store_true",
|
||||||
|
help="Rerun conversion for all files",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
srcfolder = args.input_dir
|
srcfolder = args.input_dir
|
||||||
|
|
||||||
cpu = args.cpu_count
|
cpu = args.cpu_count
|
||||||
|
|
||||||
# NOTE DEALING WITH TIME
|
reset = args.reset
|
||||||
# so it only runs for the modified files since the last run
|
|
||||||
# time of this run
|
# file where last run timestamp is stored
|
||||||
starttime = time.time()
|
|
||||||
# file where last run is stored
|
|
||||||
timefile = os.path.join(srcfolder, "run.time")
|
timefile = os.path.join(srcfolder, "run.time")
|
||||||
|
|
||||||
# get time of previous run
|
# get time of previous run
|
||||||
if os.path.isfile(timefile):
|
if reset:
|
||||||
|
timeprev = 0
|
||||||
|
elif os.path.isfile(timefile):
|
||||||
with open(timefile, "r") as file:
|
with open(timefile, "r") as file:
|
||||||
timeprev = file.read()
|
timeprev = file.read()
|
||||||
else:
|
else:
|
||||||
timeprev = 0
|
timeprev = 0
|
||||||
|
|
||||||
# FIXME
|
|
||||||
timeprev = 0
|
|
||||||
|
|
||||||
# print(timeprev)
|
# print(timeprev)
|
||||||
|
|
||||||
musicfiles = []
|
musicfiles = []
|
||||||
@ -245,4 +251,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# write this run's time into file
|
# write this run's time into file
|
||||||
with open(timefile, "w") as file:
|
with open(timefile, "w") as file:
|
||||||
file.write(str(starttime))
|
file.write(str(time.time()))
|
||||||
|
Reference in New Issue
Block a user