magmastonealex / ffproc

A batch transcoding system. Supports multiple remote workers.
Apache License 2.0
46 stars 4 forks source link

remove the old file before adding the new one, in case infile and outfile are the same path #9

Closed olipayne closed 6 years ago

olipayne commented 7 years ago

this can happen when one processes an mp4 file that needs work

magmastonealex commented 7 years ago

The only issue with doing this is that if the move of tmp.mp4 fails, you may wind up losing the media all together, especially if the user doesn't notice. Permissions problems, NFS issues for remote workers, etc could cause this.

I understand it's a problem, but I don't see a good solution right now. Perhaps it should instead check if infile==outfile, and then change the name of outfile somehow (maybe make it .fixed.mp4?). Or even just check in worker.py that if infile==outfile, don't delete infile on completion.

olipayne commented 7 years ago

good point, I didn't take that into consideration with this PR, we could move tmp.mp4 to the same directory as the good file, check that we're able to overwrite the old file, and then move to infile?

magmastonealex commented 7 years ago

That would definitely be the ideal solution, yes

magmastonealex commented 6 years ago

Closing as part of repo cleanup. I'm not opposed to this in the future.