Fix issue when deleting files and "Send to trash for actions" is enabled.

This commit is contained in:
JackDandy 2018-06-13 02:50:06 +01:00
parent 92baf81494
commit c5b5a7af0c
7 changed files with 5 additions and 31 deletions

View file

@ -21,6 +21,7 @@
[develop changelog] [develop changelog]
* Fix issue when deleting files and "Send to trash for actions" is enabled

View file

@ -42,6 +42,7 @@ import adba
import requests import requests
import requests.exceptions import requests.exceptions
from cfscrape import CloudflareScraper from cfscrape import CloudflareScraper
from lib.send2trash import send2trash
import sickbeard import sickbeard
import subliminal import subliminal

View file

@ -33,7 +33,6 @@ from sickbeard.metadata.generic import GenericMetadata
from lib.hachoir.parser import createParser from lib.hachoir.parser import createParser
from lib.hachoir.metadata import extractMetadata from lib.hachoir.metadata import extractMetadata
from lib.send2trash import send2trash
try: try:
import zlib import zlib
except: except:

View file

@ -43,11 +43,6 @@ from sickbeard.name_parser.parser import NameParser, InvalidNameException, Inval
from lib import adba from lib import adba
try:
from lib.send2trash import send2trash
except ImportError:
pass
class PostProcessor(object): class PostProcessor(object):
""" """
@ -235,13 +230,7 @@ class PostProcessor(object):
except: except:
self._log(u'Cannot change permissions to writeable to delete file: %s' % cur_file, logger.WARNING) self._log(u'Cannot change permissions to writeable to delete file: %s' % cur_file, logger.WARNING)
try: helpers.remove_file(cur_file, log_level=logger.DEBUG)
if self.use_trash:
ek.ek(send2trash, cur_file)
else:
ek.ek(os.remove, cur_file)
except OSError as e:
self._log(u'Unable to delete file %s: %s' % (cur_file, str(e.strerror)), logger.DEBUG)
if True is not ek.ek(os.path.isfile, cur_file): if True is not ek.ek(os.path.isfile, cur_file):
self._log(u'Deleted file ' + cur_file, logger.DEBUG) self._log(u'Deleted file ' + cur_file, logger.DEBUG)

View file

@ -48,11 +48,6 @@ try:
except ImportError: except ImportError:
from lib import simplejson as json from lib import simplejson as json
try:
from lib.send2trash import send2trash
except ImportError:
pass
# noinspection PyArgumentList # noinspection PyArgumentList
class ProcessTVShow(object): class ProcessTVShow(object):
@ -150,13 +145,8 @@ class ProcessTVShow(object):
ek.ek(os.chmod, cur_file_path, stat.S_IWRITE) ek.ek(os.chmod, cur_file_path, stat.S_IWRITE)
except OSError as e: except OSError as e:
self._log_helper(u'Cannot change permissions of %s: %s' % (cur_file_path, str(e.strerror))) self._log_helper(u'Cannot change permissions of %s: %s' % (cur_file_path, str(e.strerror)))
try:
if use_trash: helpers.remove_file(cur_file_path)
ek.ek(send2trash, cur_file_path)
else:
ek.ek(os.remove, cur_file_path)
except OSError as e:
self._log_helper(u'Unable to delete file %s: %s' % (cur_file, str(e.strerror)))
if ek.ek(os.path.isfile, cur_file_path): if ek.ek(os.path.isfile, cur_file_path):
result = False result = False

View file

@ -38,11 +38,6 @@ import fnmatch
from imdb._exceptions import IMDbError from imdb._exceptions import IMDbError
try:
from lib.send2trash import send2trash
except ImportError:
pass
from lib.imdb import imdb from lib.imdb import imdb
from sickbeard import db from sickbeard import db

View file

@ -77,7 +77,6 @@ from trakt_helpers import build_config, trakt_collection_remove_account
from sickbeard.bs4_parser import BS4Parser from sickbeard.bs4_parser import BS4Parser
from lib.fuzzywuzzy import fuzz from lib.fuzzywuzzy import fuzz
from lib.send2trash import send2trash
from lib.tmdb_api import TMDB from lib.tmdb_api import TMDB
from lib.tvdb_api.tvdb_exceptions import tvdb_exception from lib.tvdb_api.tvdb_exceptions import tvdb_exception