Unmanic / unmanic

Unmanic - Library Optimiser
GNU General Public License v3.0
1.65k stars 82 forks source link

Converted files in temp folder fails to move to mounted rclone gdrive folder #421

Open flaviohenriquew opened 1 year ago

flaviohenriquew commented 1 year ago

Description

I installed unmanic on docker on ubuntu to be able to convert my files that are in the cloud. I use rclone and mount a folder. I'm trying to convert the .mkv files to .mp4, before that I extract the subtitles using "Convert any ASS subtitle streams in videos to SRT" and "Extract text subtitle streams to SRT files" (it works, he threw the subtitles in the original folder) and so I do the h265_nvenc conversion. The conversion is completed successfully, after that I convert the file to aac and I saw that it actually converted to .mp4, it stayed in the temp folder... Once the conversion is completed, the file is smaller than the original but the file disappears from the temp and is not moved to the original folder. What can it be?

In the discord forum, the member austinsr was able to help me and found the problem:

2023-08-02T19:02:27:ERROR:Unmanic.PostProcessor - [FORMATTED] - Exception while copying file /tmp/unmanic/unmanic_file_conversion-lmxdn-1690997984/file-fwihe-1691002789.mkv to /media/google/folder/Season 11/file.mkv: - [Errno 9] Bad file descriptor: '/tmp/unmanic/unmanic_file_conversion-lmxdn-1690997984/file-fwihe-1691002789.mkv' -> '/media/google/folder/Season 11/file.mkv.unmanic.part'
Traceback (most recent call last):
  File "/usr/lib/python3.8/shutil.py", line 791, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/unmanic/unmanic_file_conversion-lmxdn-1690997984/file-fwihe-1691002789.mkv' -> '/media/google/folder/Season 11/file.mkv.unmanic.part'

He told me the following: Ok, after looking at google, Unmanic thinks that directory is on the same filesystem, so its using commands that work locally, not on a different partition. I think a workaround could be to have another drive attached that unmanic sees as the library. It would use a different copy and rename method. https://stackoverflow.com/questions/42392600/oserror-errno-18-invalid-cross-device-lin explains the error in a bit more depth. If you have an extra disk in the ubuntu host, you could mount that in docker and have rclone point to there to mount your library. https://collabnix.com/how-to-mount-external-volumes-in-docker/

My opinion: I performed the following test: I copied some files to an external hd and set the folder as the library and it worked normally. Apparently when using rclone gdrive unmanic is not able to copy the converted files from the temporary folder to the final folder. The tip I give is to do a check somehow and if there is an error, try to copy or move it in another way, because small files like .srt are moved normally.

Steps to Reproduce

  1. set rclone folder mounted as library
  2. Ass/srt extraction of file works, it moves after extraction. But it doesn't happen with the file conversion, it stays in the temporary folder and is not moved to the source folder.

**Expected behavior: The file should after the conversion return to the original folder and the .mkv file be deleted

**Actual behaviour: File after conversion is gone from temp folder

**Reproduces how often: Whenever use rclone mounted folder

Versions

Unmanic Version: 0.2.4~7339f8b Python Version: 3.8.10.final.0 Platform (Operating System): Linux 38026b055a5d 5.19.0-50-generic #50-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 10 18:24:29 UTC 2023 x86_64 x86_64

Installation Method Used

Docker command throuth install website unmanic

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

jaavalli commented 9 months ago

I have same issue, though I am only using rclone encryption layer (crypt mount) on top of mounted NFS fileshare.