summaryrefslogtreecommitdiff
path: root/urlopen.py
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2018-01-31 09:12:45 +1030
committerdaniel-Jones <daniel@danieljon.es>2018-01-31 09:12:45 +1030
commit51d49250ca01b6545fc6d0515d696b9f157b85bc (patch)
tree6cb34c5b7aa8756869b29eb5098040525e88d6f9 /urlopen.py
parent0d0c62f6f5f7ae99c8204c82bf942432e796a270 (diff)
downloadurlopen-51d49250ca01b6545fc6d0515d696b9f157b85bc.tar.gz
urlopen-51d49250ca01b6545fc6d0515d696b9f157b85bc.zip
added gifv to videos. added ability to detect urls, currently detecting youtube links as videos
Diffstat (limited to 'urlopen.py')
-rwxr-xr-xurlopen.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/urlopen.py b/urlopen.py
index ee16a13..21bd78c 100755
--- a/urlopen.py
+++ b/urlopen.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python2.7
import sys, os;
-
+from urlparse import urlparse;
def run(process, arg):
L = [];
for each in process:
@@ -10,11 +10,13 @@ def run(process, arg):
def main(args):
images = ["jpg", "png"]; imageapp = ["feh"];
- videos = ["gif", "webm", "mp4"]; videoapp = ["mpv", "--loop"];
+ videos = ["gif", "gifv", "webm", "mp4"]; videoapp = ["mpv", "--loop"];
pdf = ["pdf"]; pdfapp = ["mupdf"];
defaultapp = ["/home/daniel_j/compiled/waterfox/waterfox"];
x = 0;
for each in args:
+ parsed_uri = urlparse(each)
+ domain = '{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri)
if (each.endswith(tuple(images))):
print("image {}".format(each));
run(imageapp, each);
@@ -24,6 +26,9 @@ def main(args):
elif (each.endswith(tuple(pdf))):
print("pdf {}".format(each));
run(pdfapp, each);
+ elif ("youtube.com" or "youtu.be" in domain):
+ print("video {}".format(each));
+ run(videoapp, each);
else:
print("running with default application {}".format(each));
run(defaultapp, each);