You are not logged in.
Hello everyone,
So, to speed up the downloading of videos from youtube I wrote a simple line to have youtube-dl to download the audio from the link I just copied, like this
youtube-dl -x --audio-format vorbis -o 'home/user/Music/YoutubeDL/%(title)s.%(ext)s' $(clipit -c) && notify-send 'Audio downloaded'
Now, I'd like to assign the code to a keybind, so I can quickly download videos. I tried in two ways:
assigning an alias in .bash_aliases like youtubeclip and adding this line to ~/.config/openbox/rc.xml
<keybind key="W-A-y">
<command>youtubeclip</command>
</keybind>
Running youtubeclip from terminal works perfectly, but using Windows-Alt-y doesn't. Ok, so I tried using the code plainly in the file, like this:
<keybind key="W-A-y">
<command>youtube-dl -x --audio-format vorbis -o "home/tombom/Music/YoutubeDL/%(title)s.%(ext)s" $(clipit -c) ; notify-send "Audio downloaded"</command>
</keybind>
Nothing happens neither.
Before you ask: yes, I did openbox --restart and yes, I had a youtube valid link in the clipboard.
Why is OB behaving like this? I thought we were in love...
Last edited by devnull (2018-02-04 10:42:04)
Offline
assigning an alias in .bash_aliases like youtubeclip and adding this line to ~/.config/openbox/rc.xml
I don't think shell commands executed by rc.xml use bash (and even if they do I don't think they'll read ~/.bash_aliases) — try calling a script instead.
I tried using the code plainly in the file
The rc.xml file requires special escape codes for certain characters and I'm guessing you didn't use those?
Offline
Hi, thanks for your reply!
So, I did as you say and created a script and call it.
Then I just add the <action name="Execute"> to the whole call on rc.xml, and works, great!
Just as a reference for others, my call on rc.xml looks like this
<keybind key="W-A-y">
<action name="Execute">
<command>~/path/to/youtubeclip.sh</command>
</action>
</keybind>
Offline
@devnull, Nice, will come handy next time I decide I need 'play this youtube url in mpv'.
done: https://raw.githubusercontent.com/bront … in/mpvtube
Last edited by brontosaurusrex (2018-02-05 17:59:12)
Online
Oh, I like the use of notify-send.
Also, though I imagine you are aware, perhaps others are not. ClipIt's custom actions can be used in order to select from several actions, e.g., a script to stream audio, stream video, download, or share. I find it indispensable. Then copy a link to the clipboard, C-A-a, and select your custom action. Hopefully someday I can figure out how to bypass ClipIt and pipe URLS into Rofi in order to select an action with less mousing...
Offline
qcgxr, thanks, I didn't know clipit could do that!
To pass the action to rofi shouldn't take much, just create an alias with a command that uses clipit data, and it should be readily available on rofi (I use dmenu_extended but should be the same thing)
Nice job, brontosaurusrex, glad I could be of some help.
Offline
@devnull, yeah well, sometimes one has to create something useless ..., after some tinkering, much better workflow (and no scripts needed would be):
a. Run mpv like
mpv --force-window --idle --autofit-larger=50% --geometry 49%+0+0
b. drag & drop from browser. Or shift drag & drop to add.
Online
To pass the action to rofi shouldn't take much, just create an alias with a command that uses clipit data, and it should be readily available on rofi (I use dmenu_extended but should be the same thing)
@devnull, I hadn't thought of that. I'll have to do some digging as I don't see a way to expose clipit's custom actions to a script. As of now, I've been slowly trying to build a (clumsy) equivalent.
Offline
You can just use clipit as an input for your script.
For example, if you want to create a file using what's on clipit you can just do an alias like
FileFromClipit="echo $(clipit -c) >> ~/fileName.txt"
Then firing up rofi and selecting FileFromClipit action it will create the file.
Of course this is a very simple script, you can do way more complex stuff and just call the script from the alias.
If that's not the usecase you thought of let me know, maybe I didn't get it
Hope this helps
Last edited by devnull (2018-02-08 13:49:52)
Offline