Added download feature for Unix, Linux, and MacOS systems using native messaging.
This commit is contained in:
7
app/web_video_dl.json
Normal file
7
app/web_video_dl.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "web_video_dl",
|
||||
"description": "Video downloader using youtube-dl",
|
||||
"path": "/insert/your/path/here/to/youtube-dl-bridge.py",
|
||||
"type": "stdio",
|
||||
"allowed_extensions": [ "webVidDownloader@1itdominator.com", "betterYoutube@itdominator.com" ]
|
||||
}
|
23
app/youtube-dl-bridge.py
Executable file
23
app/youtube-dl-bridge.py
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import json
|
||||
import struct
|
||||
import subprocess
|
||||
|
||||
# Python 2.x version (if sys.stdin.buffer is not defined)
|
||||
# Read a message from stdin and decode it.
|
||||
def getMessage():
|
||||
rawLength = sys.stdin.read(4)
|
||||
if len(rawLength) == 0:
|
||||
sys.exit(0)
|
||||
messageLength = struct.unpack('@I', rawLength)[0]
|
||||
message = sys.stdin.read(messageLength)
|
||||
return json.loads(message)
|
||||
|
||||
while True:
|
||||
receivedMessage = getMessage()
|
||||
|
||||
if receivedMessage:
|
||||
command = "cd ~/Downloads && youtube-dl " + receivedMessage;
|
||||
subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
Reference in New Issue
Block a user