mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
add extractor
This commit is contained in:
parent
1cb43e4ad6
commit
1a5e697148
7 changed files with 147 additions and 0 deletions
17
extractor/which.py
Normal file
17
extractor/which.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
def which(program):
|
||||
# Author Credit: Jay @ http://stackoverflow.com/a/377028
|
||||
import os
|
||||
def is_exe(fpath):
|
||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||
|
||||
fpath, fname = os.path.split(program)
|
||||
if fpath:
|
||||
if is_exe(program):
|
||||
return program
|
||||
else:
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
exe_file = os.path.join(path, program)
|
||||
if is_exe(exe_file):
|
||||
return exe_file
|
||||
|
||||
return None
|
Loading…
Add table
Add a link
Reference in a new issue