Skip to content

Commit d2e59a4

Browse files
committed
Fix which_exe issue
1 parent d259e13 commit d2e59a4

File tree

5 files changed

+104
-42
lines changed

5 files changed

+104
-42
lines changed
0 Bytes
Binary file not shown.

autosub/data/locale/zh_CN/LC_MESSAGES/autosub.ffmpeg_utils.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-08-02 11:00+0800\n"
10+
"POT-Creation-Date: 2019-11-03 20:25+0800\n"
1111
"PO-Revision-Date: 2019-07-28 15:09+0800\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"
@@ -39,22 +39,22 @@ msgstr "输入你视频的帧率。任何非法的值会被当作\".srt\"格式
3939
msgid "Use \".srt\" instead."
4040
msgstr "改用\".srt\"格式。"
4141

42-
#: autosub/ffmpeg_utils.py:210
42+
#: autosub/ffmpeg_utils.py:217
4343
msgid ""
4444
"Warning: Dependency ffmpeg-normalize not found on this machine. Try default "
4545
"method."
4646
msgstr ""
4747
"警告:依赖ffmpeg-normalize未在这台电脑上找到。尝试默认的方法去转换格式。"
4848

49-
#: autosub/ffmpeg_utils.py:222
49+
#: autosub/ffmpeg_utils.py:229
5050
msgid ""
5151
"There is already a file with the same name in this location: \"{dest_name}\"."
5252
msgstr "在此处已有同名文件:\"{dest_name}\"。"
5353

54-
#: autosub/ffmpeg_utils.py:225
54+
#: autosub/ffmpeg_utils.py:232
5555
msgid "Input a new path (including directory and file name) for output file.\n"
5656
msgstr "为输出文件输入一个新的路径(包括路径和文件名)。\n"
5757

58-
#: autosub/ffmpeg_utils.py:243 autosub/ffmpeg_utils.py:276
58+
#: autosub/ffmpeg_utils.py:250 autosub/ffmpeg_utils.py:283
5959
msgid "Audio pre-processing failed. Try default method."
6060
msgstr "音频预处理失败。尝试默认的方法去转换格式。"

autosub/ffmpeg_utils.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,26 +157,33 @@ def ffprobe_check_file(filename):
157157
return True
158158

159159

160-
def which_exe(program_name):
160+
def is_exe(file_path):
161161
"""
162-
Return the path for a given executable.
162+
Checks whether a file is executable.
163163
"""
164-
def is_exe(file_path):
165-
"""
166-
Checks whether a file is executable.
167-
"""
168-
return os.path.isfile(file_path) and os.access(file_path, os.X_OK)
164+
return os.path.isfile(file_path) and os.access(file_path, os.X_OK)
169165

170-
fpath = os.path.split(program_name)[0]
171-
if fpath:
172-
if is_exe(program_name):
173-
return program_name
166+
167+
def which_exe(program_path):
168+
"""
169+
Return the path for a given executable.
170+
"""
171+
program_dir = os.path.split(program_path)[0]
172+
if program_dir:
173+
# if program directory exists
174+
if is_exe(program_path):
175+
return program_path
174176
else:
177+
# else find the program path
175178
for path in os.environ["PATH"].split(os.pathsep):
176179
path = path.strip('"')
177-
exe_file = os.path.join(path, program_name)
178-
if is_exe(exe_file):
179-
return exe_file
180+
program = os.path.join(path, program_path)
181+
if is_exe(program):
182+
return program
183+
# if program located locally
184+
program_name = os.path.join(constants.APP_PATH, os.path.basename(program_path))
185+
if is_exe(program_name):
186+
return program_name
180187
return None
181188

182189

docs/issue_labels.json

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,74 @@
11
[
2-
{ "name": "Type: Bug", "color": "#FF6E40" },
3-
{ "name": "Type: Duplicated", "color": "#B0BEC5" },
4-
{ "name": "Type: Maintenance", "color": "#A5D6A7" },
5-
{ "name": "Type: Enhancement", "color": "#80DEEA" },
6-
{ "name": "Type: Question", "color": "#69F0AE" },
7-
{ "name": "Type: Invalid", "color": "#B0BEC5" },
8-
{ "name": "Type: Help Wanted", "color": "#FFE082" },
9-
{ "name": "Priority: Low", "color": "#9FA8DA" },
10-
{ "name": "Priority: Medium", "color": "#CE93D8" },
11-
{ "name": "Priority: High", "color": "#EF9A9A" },
12-
{ "name": "Priority: Critical", "color": "#F48FB1" },
13-
{ "name": "Status: Abandoned", "color": "#BCAAA4" },
14-
{ "name": "Status: Accepted", "color": "#E6EE9C" },
15-
{ "name": "Status: Blocked", "color": "#B0BEC5" },
16-
{ "name": "Status: Completed", "color": "#FDF6E3" },
17-
{ "name": "Status: In Progress", "color": "#EEE8D5" },
18-
{ "name": "Status: Review Needed", "color": "#FFF59D" }
19-
]
2+
{
3+
"name": "Priority: Critical",
4+
"color": "#F48FB1"
5+
},
6+
{
7+
"name": "Priority: High",
8+
"color": "#EF9A9A"
9+
},
10+
{
11+
"name": "Priority: Low",
12+
"color": "#9FA8DA"
13+
},
14+
{
15+
"name": "Priority: Medium",
16+
"color": "#CE93D8"
17+
},
18+
{
19+
"name": "Status: Abandoned",
20+
"color": "#BCAAA4"
21+
},
22+
{
23+
"name": "Status: Accepted",
24+
"color": "#a5d6a7"
25+
},
26+
{
27+
"name": "Status: Blocked",
28+
"color": "#B0BEC5"
29+
},
30+
{
31+
"name": "Status: Completed",
32+
"color": "#FDF6E3"
33+
},
34+
{
35+
"name": "Status: In Progress",
36+
"color": "#EEE8D5"
37+
},
38+
{
39+
"name": "Status: Review Needed",
40+
"color": "#FFF59D"
41+
},
42+
{
43+
"name": "Type: Bug",
44+
"color": "#FF6E40"
45+
},
46+
{
47+
"name": "Type: Duplicated",
48+
"color": "#B0BEC5"
49+
},
50+
{
51+
"name": "Type: Enhancement",
52+
"color": "#80DEEA"
53+
},
54+
{
55+
"name": "Type: Help Wanted",
56+
"color": "#FFE082"
57+
},
58+
{
59+
"name": "Type: Invalid",
60+
"color": "#B0BEC5"
61+
},
62+
{
63+
"name": "Type: Maintenance",
64+
"color": "#80cbc4"
65+
},
66+
{
67+
"name": "Type: Pin",
68+
"color": "#00b0ff"
69+
},
70+
{
71+
"name": "Type: Question",
72+
"color": "#E6EE9C"
73+
}
74+
]

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
pysubs2==0.2.4
2-
langcodes_py2==1.2.0
31
googletrans==2.4.0
4-
requests==2.21.0
52
wcwidth==0.1.7
3+
langcodes_py2==1.2.0
64
auditok==0.1.5
7-
google_api_python_client==1.7.10
5+
pysubs2==0.2.4
6+
requests==2.21.0
7+
google_api_python_client==1.7.11
88
langcodes==1.4.1
9-
progressbar2==3.42.0
9+
progressbar2==3.47.0

0 commit comments

Comments
 (0)