Private GIT

Skip to content
Snippets Groups Projects
Commit 65c41bb5 authored by Alexandre Beloin's avatar Alexandre Beloin
Browse files

Merge pull request #1295 from abeloin/patch-touchfile

Modified touchfile() to detect ENOSYS and EACCES.
parents 73dc968e fbdd48ae
Branches
Tags
No related merge requests found
......@@ -35,6 +35,7 @@ import uuid
import base64
import zipfile
import datetime
import errno
import sickbeard
import subliminal
......@@ -1110,8 +1111,13 @@ def touchFile(fname, atime=None):
with file(fname, 'a'):
os.utime(fname, (atime, atime))
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)
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
return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment