arfoll / unrarall

bash script to unrar everything and cleanup in a given directory
GNU General Public License v3.0
261 stars 68 forks source link

Does not obey --skip-if-exists. #48

Open pr0voked opened 5 years ago

pr0voked commented 5 years ago

I'm planning on run a cron-job every 48 hours to mass-extract a bunch of new RAR files that will appear on my server. However, I won't be using --clean, and thus, the RAR files will continue to stay there - so I need a way to skip already extracted ones.

However, I've found the --skip-if-exists doesn't seem to want to work, and it will re-extract files, simply overwriting the already existing ones.

pr0voked@vps:/home/redacted/extracted/Dumbo.1941.1080p.BluRay.x264-LCHD# ls
lchd-dumbo1080p.mkv
pr0voked@vps:/home/redacted/extracted/Dumbo.1941.1080p.BluRay.x264-LCHD# cd /home/redacted/rared
pr0voked@vps:/home/redacted/rared# sudo bash /home/redacted/unrarall -v -o /home/redacted/extracted/Dumbo.1941.1080p.BluRay.x264-LCHD --allow-failures --full-path --skip-if-exists Dumbo.1941.1080p.BluRay.x264-LCHD
Using "/home/redacted/extracted/Dumbo.1941.1080p.BluRay.x264-LCHD/" as output directory
Detected GNU find
Using find: find
Detecting clean up hooks...
Found unrarall_clean_covers_folders
Found unrarall_clean_empty_folders
Found unrarall_clean_nfo
Found unrarall_clean_osx_junk
Found unrarall_clean_proof_folders
Found unrarall_clean_rar
Found unrarall_clean_sample_folders
Found unrarall_clean_sample_videos
Found unrarall_clean_windows_junk
Using virtual clean-up hook none
Looking for unrar...found
Using "unrar" to extract rar files
Working over directory "Dumbo.1941.1080p.BluRay.x264-LCHD/"
Install cksfv in order to get CRC checked before using unrar
Extracting (x) "Dumbo.1941.1080p.BluRay.x264-LCHD/lchd-dumbo1080p.rar"...
UNRAR 5.60 freeware      Copyright (c) 1993-2018 Alexander Roshal

Extracting from /home/redacted/rared/Dumbo.1941.1080p.BluRay.x264-LCHD/lchd-dumbo1080p.rar

Extracting  lchd-dumbo1080p.mkv                                        1%

Extracting from /home/redacted/rared/Dumbo.1941.1080p.BluRay.x264-LCHD/lchd-dumbo1080p.r00

...         lchd-dumbo1080p.mkv 

Any ideas on what I can do? I've checked, and double-checked, that the file is extracting to the same place (ran it about 3 times). Always the same file.

qriff commented 5 years ago

This seems relate to util selection, if I only install (sudo apt install) p7zip-full then the existing file is never detected, but when installing also (sudo apt install) p7zip-full unrar rar the detection starts working.

Seems related to function isAlreadyExtracted() and its utility selection.

As a sidenote, since skip-if-exists only does filename existence testing it is very inefficient to do chksfv before it (resulting in useless chksfv passes if nothing gets extracted).

roboyoshi commented 5 years ago

FIY: I've attempted to do a more thorough comparison by extracting the filesizes from the archive and checking it against the extracted files:

https://gist.github.com/roboyoshi/590a25f0771c9ba847a50a1cc2f5fcb4

It's not well tested so far, but should be a simple PoC for better file checking.

I also see that my files are not deleted, when I use the --skip-if-exists option -- might be expected, but I'd think I havew to force it?