mirror of
https://gitlab.com/RemixDev/deemix-py.git
synced 2024-12-28 18:46:13 +00:00
Merge pull request 'Escape %folder% and %filename% in execute command' (#70) from kermit/deemix:escape-execute into main
Reviewed-on: https://codeberg.org/RemixDev/deemix/pulls/70
This commit is contained in:
commit
66be97bec4
|
@ -3,6 +3,7 @@ from eventlet.green.subprocess import call as execute
|
||||||
|
|
||||||
from os.path import sep as pathSep
|
from os.path import sep as pathSep
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from shlex import quote
|
||||||
import re
|
import re
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
|
@ -158,7 +159,7 @@ class DownloadJob:
|
||||||
f.write(orig.encode('utf-8'))
|
f.write(orig.encode('utf-8'))
|
||||||
# Execute command after download
|
# Execute command after download
|
||||||
if self.settings['executeCommand'] != "":
|
if self.settings['executeCommand'] != "":
|
||||||
execute(self.settings['executeCommand'].replace("%folder%", str(self.extrasPath)).replace("%filename%", result['filename']), shell=True)
|
execute(self.settings['executeCommand'].replace("%folder%", quote(str(self.extrasPath))).replace("%filename%", quote(result['filename'])), shell=True)
|
||||||
|
|
||||||
def collectionAfterDownload(self, tracks):
|
def collectionAfterDownload(self, tracks):
|
||||||
if not self.extrasPath:
|
if not self.extrasPath:
|
||||||
|
@ -213,7 +214,7 @@ class DownloadJob:
|
||||||
f.write((line + "\n").encode('utf-8'))
|
f.write((line + "\n").encode('utf-8'))
|
||||||
# Execute command after download
|
# Execute command after download
|
||||||
if self.settings['executeCommand'] != "":
|
if self.settings['executeCommand'] != "":
|
||||||
execute(self.settings['executeCommand'].replace("%folder%", str(self.extrasPath)), shell=True)
|
execute(self.settings['executeCommand'].replace("%folder%", quote(str(self.extrasPath))), shell=True)
|
||||||
|
|
||||||
def download(self, trackAPI_gw, track=None):
|
def download(self, trackAPI_gw, track=None):
|
||||||
result = {}
|
result = {}
|
||||||
|
|
Loading…
Reference in a new issue