cibrandocampo / synology-transcoding

Transcoding optimizations for Synology Photo
MIT License
8 stars 0 forks source link

checkVideosInFolder bug #16

Open seemebreakthis opened 2 weeks ago

seemebreakthis commented 2 weeks ago

Right now for each video that requires transcoding, the function will first run delete_files_by_name before running transcode_video. But the parameters passed to delete_files_by_name will make it blindly delete all files within the folder with the word '_completed' in the file name.

Consider this scenario:

Both SYNOPHOTO_FILM_M.mp4 and SYNOPHOTO_FILM_H.mp4 in the same folder needs transcoding.

So the SYNOPHOTO_FILM_M.mp4 gets transcoded first. By the end of the process, a SYNOPHOTO_FILM_M.mp4_completed_h264 file gets generated.

Now it is SYNOPHOTO_FILM_H.mp4's turn to be transcoded. But as soon as delete_files_by_name is run in preparation for the transcoding process, the freshly generated SYNOPHOTO_FILM_M.mp4_completed_h264 gets deleted (!!) due to this bug.

So at the end, we only see SYNOPHOTO_FILM_H.mp4_completed_h264 but not SYNOPHOTO_FILM_H.mp4_completed_h264, even though both SYNOPHOTO_FILM_M.mp4 and SYNOPHOTO_FILM_H.mp4 have been transcoded.