URLs and terminal behavior - GNU/Linux

Users browsing this thread: 3 Guest(s)
Evolution
Long time nixers
I want to be able to save clicked links to a variable and then execute a bash script immediately afterwords.

This is so I can do things like open youtube videos posted in irc within mplayer, images with feh etc.
[Image: mg3nm7.gif]
We live as we dream, alone.
yrmt
Grey Hair Nixers
You can use the .Xdefault:


``URxvt*perl-ext-common: default,matcher
URxvt*urlLauncher: /usr/local/bin/chrome
URxvt*matcher.button: 1``

Replace chrome with your script.
Evolution
Long time nixers
Hm I have something similar but as urxvt absolutely hated me and refused to work I stopped using it.
(Links were unclickable, it wouldn't create tabs)



URxvt*perl-ext: default
URxvt*matcher.button: 1
URxvt*urlLauncher: firefox

!urxvt.matcher.pattern.0: \\b(?:(?:https?|ftp|news|file):\/\/|mailto:)[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~#]+ [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~]
URxvt*matcher.pattern.0: \\b(?:(?:https?|ftp):\/\/|mailto:)[\\w\-\@;\/?:&=%\$_.+!*\x27(),~#]+ [\\w\-\@;\/?:&=%\$_+!*\x27()~]
URxvt*matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-]

!!! This one matches image URLs and open them in FEH
URxvt*matcher.pattern.2: \\bhttps?:\/\/[\\w-.]*\/[\\w./?&@#-]*.(jpg|jpeg|png)
URxvt*matcher.launcher.2: feh $0

!!! Open youtubeliks in your own youtubescript
URxvt*matcher.pattern.3: \\bhttp:\/\/(www.youtube|youtube).com\/watch\\?v=([\\w-]*)
URxvt*matcher.launcher.3: /usr/bin/ytlaunch $2
[Image: mg3nm7.gif]
We live as we dream, alone.
crshd
Registered
If you say "refused to work", do you mean work in general, or _this config_ refused to work? Because if it works, I'm going to use it.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCA/IT d-(---)@ s+: a-- C+++(++++)$ UBL*+++ P+++>++++ L++ E W+++$ !N !o K !w !O M+>++ !V PS+++ PE !Y PGP+ !t-- !5 !X R@ tv- b+ DI D+ G e h r++ y+
------END GEEK CODE BLOCK------

Evolution
Long time nixers
(23-07-2012, 10:52 PM)crshd Wrote: If you say "refused to work", do you mean work in general, or _this config_ refused to work? Because if it works, I'm going to use it.

The feh bit works fine, you can click links to images right in irc and it will open.

Can't say much about the youtube matcher, it seems to either cutout the code after watch?v and open it in firefox or open the entire link in firefox.

This is the actual youtube-in-mplayer command:
mplayer -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g –cookies /tmp/cookie.txt “$2”) (this replaces /usr/bin/ytlaunch $2)

$2 is supposed to correspond with matcher.pattern.2
[Image: mg3nm7.gif]
We live as we dream, alone.
crshd
Registered
Actually I never really cared much about playing youtube videos in mplayer. It always seemed like it's more pain than gain. Last time I've tried it, none of the youtube-in-mplayer scripts seemed to work.

But I might play around with it again.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCA/IT d-(---)@ s+: a-- C+++(++++)$ UBL*+++ P+++>++++ L++ E W+++$ !N !o K !w !O M+>++ !V PS+++ PE !Y PGP+ !t-- !5 !X R@ tv- b+ DI D+ G e h r++ y+
------END GEEK CODE BLOCK------

Evolution
Long time nixers
(23-07-2012, 11:58 PM)crshd Wrote: Actually I never really cared much about playing youtube videos in mplayer. It always seemed like it's more pain than gain. Last time I've tried it, none of the youtube-in-mplayer scripts seemed to work.

But I might play around with it again.

Don't really need a script, besides mplayer all you need is youtube-dl from there you can use the command I posted above, just substitute the variable for a url.
[Image: mg3nm7.gif]
We live as we dream, alone.
yrmt
Grey Hair Nixers
(23-07-2012, 11:58 PM)crshd Wrote: Actually I never really cared much about playing youtube videos in mplayer. It always seemed like it's more pain than gain. Last time I've tried it, none of the youtube-in-mplayer scripts seemed to work.

But I might play around with it again.

Have you tried this -> http://pastebin.com/eWLM1Wgm awesome perl script ?
Alexander
Members
(24-07-2012, 06:43 AM)Beastie Wrote: Have you tried this -> http://pastebin.com/eWLM1Wgm awesome perl script ?
That one is awesome.
I use it all the time.
crshd
Registered
That script is great. But I have issues with audio and video being out of sync. I suppose that's not the script's fault, though.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCA/IT d-(---)@ s+: a-- C+++(++++)$ UBL*+++ P+++>++++ L++ E W+++$ !N !o K !w !O M+>++ !V PS+++ PE !Y PGP+ !t-- !5 !X R@ tv- b+ DI D+ G e h r++ y+
------END GEEK CODE BLOCK------

yrmt
Grey Hair Nixers
(25-07-2012, 01:40 AM)crshd Wrote: That script is great. But I have issues with audio and video being out of sync. I suppose that's not the script's fault, though.

I guess because I didn't get any problems like that.
crshd
Registered
No, it can't be the script's fault. All it does is grab the actual video URL. Playback after that is handled by Mplayer.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCA/IT d-(---)@ s+: a-- C+++(++++)$ UBL*+++ P+++>++++ L++ E W+++$ !N !o K !w !O M+>++ !V PS+++ PE !Y PGP+ !t-- !5 !X R@ tv- b+ DI D+ G e h r++ y+
------END GEEK CODE BLOCK------