Skip to content

Commit

Permalink
fix: path contains spaces
Browse files Browse the repository at this point in the history
Use subprocess to run bbdown
  • Loading branch information
1299172402 committed Feb 18, 2022
1 parent 851591a commit 75444bb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions BBDown_GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import time
import json
import subprocess

from UI.main import Ui_Form_main
from UI.qrcode import Ui_Form_QRcode
Expand All @@ -19,7 +20,8 @@ def __init__(self, command):
super(RunBBDown, self).__init__()
self.command = command
def run(self):
os.system(f"{bbdowndir} {self.command}")
p = subprocess.Popen(f"\"{bbdowndir}\" {self.command}", shell=True)
p.wait()

class FormLogin(QMainWindow, Ui_Form_QRcode):
def __init__(self, arg):
Expand Down Expand Up @@ -170,9 +172,9 @@ def Save():
elif self.radioButton_8.isChecked():
arg += " -av1"
if self.checkBox_ffmpeg.isChecked():
arg += f" --ffmpeg-path {self.lineEdit_ffmpeg.text()}"
arg += f" --ffmpeg-path \"{self.lineEdit_ffmpeg.text()}\""
if self.checkBox_aria2c.isChecked():
arg += f" --use-aria2c --aria2c-path {self.lineEdit_aria2c.text()}"
arg += f" --use-aria2c --aria2c-path \"{self.lineEdit_aria2c.text()}\""
if self.checkBox_25.isChecked():
arg += " -p ALL"
if self.advanced:
Expand Down Expand Up @@ -221,13 +223,14 @@ def Save():
if self.checkBox_22.isChecked():
arg += f" -token {self.lineEdit_5.text()}"
if self.checkBox_23.isChecked():
arg += f" --mp4box-path {self.lineEdit_6.text()}"
arg += f" --mp4box-path \"{self.lineEdit_6.text()}\""
if self.checkBox_24.isChecked():
arg += f" --delay-per-page {self.lineEdit_7.text()}"
arg += f" --work-dir {self.lineEdit_dir.text()}"
arg += f" --work-dir \"{self.lineEdit_dir.text()}\""
arg += f" {self.lineEdit_url.text()}"
self.job1 = RunBBDown(arg)
self.job1.start()

def advanced(self):
if not self.advanced:
self.pushButton_advanced.setText("简易选项<")
Expand All @@ -246,3 +249,4 @@ def about(self):
win_main = FormMain()
win_main.show()
sys.exit(app.exec_())

1 comment on commit 75444bb

@1299172402
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1

Please sign in to comment.