Commit fe33bd5d authored by echel0n's avatar echel0n
Browse files

Removed scandir and reverted back to os.walk due to compiler issues for Synology devices

parent d9bae0b3
# Changelog
- * 7666db3 - 2017-11-06: Fixed issues when using full-path to PIP and GIT commands
- * c62e094 - 2017-11-06: Removed scandir and reverted back to os.walk due to compiler issues for Synology devices
- * d9bae0b - 2017-11-06: Fixed issues when using full-path to PIP and GIT commands
- * eac86ef - 2017-11-06: Fixed issues when using full-path to PIP and GIT commands
- * 613cc9c - 2017-11-06: Fixed issues when using full-path to PIP and GIT commands
- * 1f0f7f3 - 2017-11-06: Fixed issues when using full-path to PIP and GIT commands
......
......@@ -41,5 +41,4 @@ html5lib == 1.0b10
arrow==0.10.0
unidecode==0.4.21
twilio==6.7.0
chardet==3.0.4
scandir==1.6
\ No newline at end of file
chardet==3.0.4
\ No newline at end of file
......@@ -26,7 +26,6 @@ import time
import traceback
from sqlite3 import OperationalError
import scandir
from CodernityDB.database_super_thread_safe import SuperThreadSafeDatabase
from CodernityDB.index import IndexNotFoundException, IndexConflict, IndexException
from CodernityDB.storage import IU_Storage
......@@ -67,7 +66,7 @@ class srDatabase(object):
existing_backups = []
if not os.path.isdir(backup_path): os.makedirs(backup_path)
for root, dirs, files in scandir.walk(backup_path):
for root, dirs, files in os.walk(backup_path):
# Only consider files being a direct child of the backup_path
if root == backup_path:
for backup_file in sorted(files):
......@@ -92,7 +91,7 @@ class srDatabase(object):
# Create new backup
new_backup = os.path.join(backup_path, '%s.tar.gz' % int(time.time()))
with tarfile.open(new_backup, 'w:gz') as zipf:
for root, dirs, files in scandir.walk(self.db_path):
for root, dirs, files in os.walk(self.db_path):
for zfilename in files:
zipf.add(os.path.join(root, zfilename),
arcname='database/%s/%s' % (
......
......@@ -42,7 +42,6 @@ from contextlib import contextmanager
import rarfile
import requests
import scandir
import six
from bs4 import BeautifulSoup
......@@ -1009,18 +1008,18 @@ def backupSR(backupDir, keep_latest=False):
source += [fp]
# database folder
for (path, __, files) in scandir.walk(os.path.join(sickrage.DATA_DIR, 'database'), topdown=True):
for (path, __, files) in os.walk(os.path.join(sickrage.DATA_DIR, 'database'), topdown=True):
for filename in files:
source += [os.path.join(path, filename)]
# db_backup folder
for (path, __, files) in scandir.walk(os.path.join(sickrage.DATA_DIR, 'db_backup'), topdown=True):
for (path, __, files) in os.walk(os.path.join(sickrage.DATA_DIR, 'db_backup'), topdown=True):
for filename in files:
source += [os.path.join(path, filename)]
# cache folder
if sickrage.CACHE_DIR:
for (path, dirs, files) in scandir.walk(sickrage.CACHE_DIR, topdown=True):
for (path, dirs, files) in os.walk(sickrage.CACHE_DIR, topdown=True):
for dirname in dirs:
if path == sickrage.CACHE_DIR and dirname not in ['images']:
dirs.remove(dirname)
......@@ -1115,7 +1114,7 @@ def get_size(start_path='.'):
total_size = 0
try:
for dirpath, __, filenames in scandir.walk(start_path):
for dirpath, __, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
try:
......
......@@ -206,8 +206,7 @@ def patch_modules():
'shutil.move',
'shutil.copyfileobj',
'shutil.copy',
'shutil.copyfile',
'scandir.walk']
'shutil.copyfile']
def decorate_modules(modules, decorator):
for module in modules:
......
......@@ -23,7 +23,6 @@ import shutil
import stat
import UnRAR2
import scandir
from UnRAR2.rar_exceptions import ArchiveHeaderBroken, FileOpenError, \
IncorrectRARPassword, InvalidRARArchive, InvalidRARArchiveUsage
......@@ -233,7 +232,7 @@ def processDir(dirName, nzbName=None, process_method=None, force=False, is_prior
result.result = True
for processPath, __, fileList in scandir.walk(os.path.join(path, curDir), topdown=False):
for processPath, __, fileList in os.walk(os.path.join(path, curDir), topdown=False):
if not validateDir(path, processPath, nzbNameOriginal, failed, result):
continue
......@@ -353,7 +352,7 @@ def validateDir(path, dirName, nzbNameOriginal, failed, result):
# Get the videofile list for the next checks
allFiles = []
allDirs = []
for __, processdir, fileList in scandir.walk(os.path.join(path, dirName), topdown=False):
for __, processdir, fileList in os.walk(os.path.join(path, dirName), topdown=False):
allDirs += processdir
allFiles += fileList
......@@ -584,7 +583,7 @@ def get_path_dir_files(dirName, nzbName, proc_type):
if dirName == sickrage.srCore.srConfig.TV_DOWNLOAD_DIR and not nzbName or proc_type == "manual": # Scheduled Post Processing Active
# Get at first all the subdir in the dirName
for path, dirs, files in scandir.walk(dirName):
for path, dirs, files in os.walk(dirName):
break
else:
path, dirs = os.path.split(dirName) # Script Post Processing
......
......@@ -25,7 +25,6 @@ import re
import stat
import subprocess
import scandir
from adba import aniDBAbstracter
import sickrage
......@@ -172,7 +171,7 @@ class PostProcessor(object):
def recursive_glob(treeroot, pattern):
results = []
for base, __, files in scandir.walk(treeroot):
for base, __, files in os.walk(treeroot):
goodfiles = fnmatch.filter(files, pattern)
results.extend(os.path.join(base, f) for f in goodfiles)
return results
......
......@@ -30,8 +30,6 @@ import tarfile
import threading
import traceback
import scandir
import sickrage
from sickrage.core.helpers import backupSR
from sickrage.notifiers import srNotifiers
......@@ -156,7 +154,7 @@ class srVersionUpdater(object):
# Clean up after update
to_clean = os.path.join(sickrage.CACHE_DIR, 'mako')
for root, dirs, files in scandir.walk(to_clean, topdown=False):
for root, dirs, files in os.walk(to_clean, topdown=False):
[os.remove(os.path.join(root, name)) for name in files]
[shutil.rmtree(os.path.join(root, name)) for name in dirs]
......@@ -605,7 +603,7 @@ class SourceUpdateManager(UpdateManager):
# walk temp folder and move files to main folder
sickrage.srCore.srLogger.info("Moving files from " + content_dir + " to " + sickrage.PROG_DIR)
for dirname, __, filenames in scandir.walk(content_dir):
for dirname, __, filenames in os.walk(content_dir):
dirname = dirname[len(content_dir) + 1:]
for curfile in filenames:
old_path = os.path.join(content_dir, dirname, curfile)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment