mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-08 04:18:09 -05:00
Modified touchfile() to detect ENOSYS and EACCES.
To better distinguish between file permissions and not implemented.
This commit is contained in:
parent
c62d8f2c79
commit
fbdd48aed8
@ -35,6 +35,7 @@ import uuid
|
|||||||
import base64
|
import base64
|
||||||
import zipfile
|
import zipfile
|
||||||
import datetime
|
import datetime
|
||||||
|
import errno
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
import subliminal
|
import subliminal
|
||||||
@ -1108,8 +1109,13 @@ def touchFile(fname, atime=None):
|
|||||||
with file(fname, 'a'):
|
with file(fname, 'a'):
|
||||||
os.utime(fname, (atime, atime))
|
os.utime(fname, (atime, atime))
|
||||||
return True
|
return True
|
||||||
except:
|
except Exception as e:
|
||||||
|
if e.errno == errno.ENOSYS:
|
||||||
logger.log(u"File air date stamping not available on your OS", logger.DEBUG)
|
logger.log(u"File air date stamping not available on your OS", logger.DEBUG)
|
||||||
|
elif e.errno == errno.EACCES:
|
||||||
|
logger.log(u"File air date stamping failed(Permission denied). Check permissions for file: {0}".format(fname), logger.ERROR)
|
||||||
|
else:
|
||||||
|
logger.log(u"File air date stamping failed. The error is: {0} and the message is: {1}.".format(e.errno, e.strerror), logger.ERROR)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user