mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-16 22:26:21 +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 tell'
|
||||
]
|
||||
opts = []
|
||||
for s in scpt:
|
||||
opts += ['-e', s]
|
||||
cmd = ([encodeFilename('osascript', True)]
|
||||
+ [encodeArgument(o) for o in opts])
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
scpt = '\n'.join(scpt).encode('utf-8')
|
||||
cmd = [encodeFilename('osascript', True), encodeArgument('-')]
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate(input=scpt)
|
||||
if p.returncode == 0:
|
||||
window_title = stdout.decode('utf-8').strip()
|
||||
except EnvironmentError:
|
||||
|
|
Loading…
Reference in a new issue