mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-17 15:55:56 +00:00
feed script to osascript from stdin
This commit is contained in:
parent
a3da97129e
commit
f95c9ddad1
1 changed files with 4 additions and 7 deletions
|
@ -578,13 +578,10 @@ class YoutubeDL(object):
|
||||||
'end repeat',
|
'end repeat',
|
||||||
'end tell'
|
'end tell'
|
||||||
]
|
]
|
||||||
opts = []
|
scpt = '\n'.join(scpt).encode('utf-8')
|
||||||
for s in scpt:
|
cmd = [encodeFilename('osascript', True), encodeArgument('-')]
|
||||||
opts += ['-e', s]
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||||
cmd = ([encodeFilename('osascript', True)]
|
stdout, stderr = p.communicate(input=scpt)
|
||||||
+ [encodeArgument(o) for o in opts])
|
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
||||||
stdout, stderr = p.communicate()
|
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
window_title = stdout.decode('utf-8').strip()
|
window_title = stdout.decode('utf-8').strip()
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
|
|
Loading…
Reference in a new issue