From 7d8cc2cfed71e04bbf86618f622133c1de2780c6 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Fri, 13 Feb 2015 00:20:16 +0000 Subject: [PATCH] Use a subprocess and cp for copying files on posix systems to preserve file metadata. --- CHANGES.md | 1 + sickbeard/helpers.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index b3fe5ccd..40829690 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -38,6 +38,7 @@ * Change indicate when not sorting with article by dimming ("The", "A", "An") on Show List, Episode, History, Mass Update, Add with Browse and from Existing views * Add Emby notifier to config/Notifications +* Use a subprocess and cp for copying files on posix systems to preserve file metadata * Fix alternative unicode show names from breaking search * Change show update, set shows with newly added airdate or existing episodes with future or never dates, to "Wanted" * Fix rare NameParser case where numeric episode name was parsed as episode number diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 5bd9e717..ffd6b9e1 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -33,6 +33,7 @@ import time import traceback import urlparse import uuid +import subprocess import adba import requests @@ -286,7 +287,11 @@ def listMediaFiles(path): def copyFile(srcFile, destFile): - ek.ek(shutil.copyfile, srcFile, destFile) + if os.name.startswith('posix'): + subprocess.call(['cp', srcFile, destFile]) + else: + ek.ek(shutil.copyfile, srcFile, destFile) + try: ek.ek(shutil.copymode, srcFile, destFile) except OSError: