Browse Source

Copy file and maybe copy stats. fix #349

pull/2096/merge
Ruud 12 years ago
parent
commit
bc77812488
  1. 5
      couchpotato/core/providers/metadata/base.py
  2. 7
      couchpotato/runner.py

5
couchpotato/core/providers/metadata/base.py

@ -48,6 +48,11 @@ class MetaDataBase(Plugin):
log.debug('Creating %s file: %s', (file_type, name))
if os.path.isfile(content):
shutil.copy2(content, name)
shutil.copyfile(content, name)
# Try and copy stats seperately
try: shutil.copystat(content, name)
except: pass
else:
self.createFile(name, content)
group['renamed_files'].append(name)

7
couchpotato/runner.py

@ -89,7 +89,12 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
src_files = [options.config_file, db_path, db_path + '-shm', db_path + '-wal']
for src_file in src_files:
if os.path.isfile(src_file):
shutil.copy2(src_file, toUnicode(os.path.join(new_backup, os.path.basename(src_file))))
dst_file = toUnicode(os.path.join(new_backup, os.path.basename(src_file)))
shutil.copyfile(src_file, dst_file)
# Try and copy stats seperately
try: shutil.copystat(src_file, dst_file)
except: pass
# Remove older backups, keep backups 3 days or at least 3
backups = []

Loading…
Cancel
Save