Browse Source

More path encoding

pull/3252/head
Ruud 11 years ago
parent
commit
b86853f06f
  1. 4
      couchpotato/core/_base/updater/main.py
  2. 2
      couchpotato/core/helpers/encoding.py
  3. 4
      couchpotato/core/plugins/base.py
  4. 4
      couchpotato/core/plugins/release/main.py
  5. 2
      couchpotato/core/plugins/renamer.py
  6. 2
      couchpotato/core/plugins/scanner.py

4
couchpotato/core/_base/updater/main.py

@ -323,8 +323,8 @@ class SourceUpdater(BaseUpdater):
def replaceWith(self, path):
path = sp(path)
app_dir = ss(Env.get('app_dir'))
data_dir = ss(Env.get('data_dir'))
app_dir = Env.get('app_dir')
data_dir = Env.get('data_dir')
# Get list of files we want to overwrite
self.deletePyc()

2
couchpotato/core/helpers/encoding.py

@ -78,7 +78,7 @@ def sp(path, *args):
# Replace *NIX ambiguous '//' at the beginning of a path with '/' (crashes guessit)
path = re.sub('^//', '/', path)
return toUnicode(path)
return path
def ek(original, *args):

4
couchpotato/core/plugins/base.py

@ -113,7 +113,7 @@ class Plugin(object):
fireEvent('register_%s' % ('script' if ext in 'js' else 'style'), path + os.path.basename(f), f)
def createFile(self, path, content, binary = False):
path = ss(path)
path = sp(path)
self.makeDir(os.path.dirname(path))
@ -131,7 +131,7 @@ class Plugin(object):
os.remove(path)
def makeDir(self, path):
path = ss(path)
path = sp(path)
try:
if not os.path.isdir(path):
os.makedirs(path, Env.getPermission('folder'))

4
couchpotato/core/plugins/release/main.py

@ -7,7 +7,7 @@ from CodernityDB.database import RecordDeleted
from couchpotato import md5, get_db
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import ss, toUnicode
from couchpotato.core.helpers.encoding import ss, toUnicode, sp
from couchpotato.core.helpers.variable import getTitle
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
@ -190,7 +190,7 @@ class Release(Plugin):
for file_type in raw_files:
for release_file in raw_files.get(file_type, []):
if os.path.isfile(ss(release_file)):
if os.path.isfile(sp(release_file)):
if file_type not in files:
files[file_type] = []
files[file_type].append(release_file)

2
couchpotato/core/plugins/renamer.py

@ -757,7 +757,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
return False
def moveFile(self, old, dest, forcemove = False):
dest = ss(dest)
dest = sp(dest)
try:
if forcemove or self.conf('file_action') not in ['copy', 'link']:
try:

2
couchpotato/core/plugins/scanner.py

@ -151,7 +151,7 @@ class Scanner(Plugin):
try:
files = []
for root, dirs, walk_files in scandir.walk(folder, followlinks=True):
files.extend([sp(os.path.join(root, filename)) for filename in walk_files])
files.extend([sp(os.path.join(sp(root), ss(filename))) for filename in walk_files])
# Break if CP wants to shut down
if self.shuttingDown():

Loading…
Cancel
Save