Remove scandir lib, use os.walk
This commit is contained in:
@@ -18,7 +18,6 @@ from couchpotato.api import NonBlockHandler, ApiHandler
|
||||
from couchpotato.core.event import fireEventAsync, fireEvent
|
||||
from couchpotato.core.helpers.encoding import sp
|
||||
from couchpotato.core.helpers.variable import getDataDir, tryInt
|
||||
from scandir import scandir
|
||||
from tornado.httpserver import HTTPServer
|
||||
from tornado.web import Application, StaticFileHandler, RedirectHandler
|
||||
|
||||
@@ -99,7 +98,7 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
||||
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):
|
||||
for backup_file in files:
|
||||
ints = re.findall('\d+', backup_file)
|
||||
|
||||
@@ -116,7 +115,7 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
||||
# Create new backup
|
||||
new_backup = sp(os.path.join(backup_path, '%s.tar.gz' % int(time.time())))
|
||||
zipf = tarfile.open(new_backup, 'w:gz')
|
||||
for root, dirs, files in scandir.walk(db_path):
|
||||
for root, dirs, files in os.walk(db_path):
|
||||
for zfilename in files:
|
||||
zipf.add(os.path.join(root, zfilename), arcname = 'database/%s' % os.path.join(root[len(db_path) + 1:], zfilename))
|
||||
zipf.close()
|
||||
|
||||
Reference in New Issue
Block a user