I also had alot of problems with unrar and copying files to a Nas on OSX...
After doing alot of research it comes down to 2 issues:
1. There is some bug in unrar or the new smb implementation in OSX since mavericks/yosemite wich affects unrar over a network (possibly also to a different filesystem)
2. There is a bug in Python in OSX when you use the "shutil.copyfile" function in code wich copies data in OSX from a HFS+ partition/drive to another filesystem or Nas, file copying goes extremely slow because of this bug, what normally takes minutes in Finder, now takes 2 to 4 hours depending on the size of a file
To bypass the unrarring problem, unrar being extremely slow, you need to unrar a file on your OSX partition and not on a Nas, and then after unrarring it needs to be copied to a Nas, unrar on a Nas takes ages.
But then a second problem occurs, the copying is done from python with the "shutil.copyfile" function, because of the bug in this function (wich as far as I know only affects OSX), the copying again takes hours instead of minutes, so if you solve/bypass the first problem, a second problem occurs lol. so because the second problem only occurs after unrarring, you wouldn't notice an improvement, the second problem can be solved like this:
You can solve this in python code, by replacing:
for example in sickbeard, when you run the sabtosickbeard script after downloading a series
When you download it directly to your Nas, the unrarring on the Nas goes slow, when you bypass this and let it unrar on your OSX drive, unrar works much faster, but then the second problem arrises, that "shutil.copyfile" in python in OSX has a bug, so then after the faster unrar the copying to the Nas goes really slow, so basicly nothing improves lol... so you wouldn't notice that anything changed.
You can solve this in sickbeard in helpers.py, wich is executed by the sabtosickbeard script, replace in the code:
https://github.com/midgetspy/Sick-Beard ... helpers.py
@ line 394:
Code: Select all
ek.ek(shutil.copyfile, srcFile, destFile)
with:
Code: Select all
if sys.platform.startswith("darwin"):
os.system('cp "%s" "%s"' % (srcFile, destFile))
else:
ek.ek(shutil.copyfile, srcFile, destFile)
and in the beginning of helpers.py @ line 34 include:
this is for executing a terminal command
I also see in the sabnzbd code "shutil.copyfile" being used a couple of times:
https://github.com/sabnzbd/sabnzbd/sear ... 3&q=shutil
If you use the above code, the system terminal command "cp" is used to copy a file instead of the buggy "shutil.copyfile", when you normally copy a file by dragging it in Finder to your Nas copying goes a lot faster, same with using "cp" instead of "shutil.copyfile' in python.
I have not yet studied the sabnzb code enough to see what the files config.py misc.py and newsunpack.py exactly do, but I suggest changing "shutil.copyfile" in the code to the same as the changes made in the sickbeards helpers.py
wich basicly changes the use of shutil.copyfile only when the os is OSX to use the terminal command "cp" instead, this code change only affects OSX, it will run the same with this code change as before on windows and linux wich don't seem to be affected by this bug.
So for example in misc.py
It would become:
Code: Select all
if sys.platform.startswith("darwin"):
os.system('cp "%s" "%s"' % (path, new_path))
else:
shutil.copyfile(path, new_path)
Or something simular, but this needs to be tested! but I don't know if any of these 3 files are also used in sabnzbd to copy files to a Nas if sabnzbd is configured as such?
For to not unrar on a Nas you need to configure in sickbeard that the config => postprocessing => TV Download Dir is not on the Nas.
And also in sabnzbd settings => categories => the tv category source also must not be on the Nas, and the post script must be sabtosickbeard, so that after unrarring the file is copied to the Nas.
This way unrarring takes place on your OSX partition/drive, instead of on a Nas, bypassing the bug in unrar or the smb changes in mavericks/yosemite, so unrarring doesn't take ages.
After downloading the sabtosickbeard script will then copy the file to the Nas after unrarring, with the changed helpers.py in sickbeard this solves the slow unarring and filecopying to a Nas