Page 1 of 1
Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 1:58 pm
by Jasper
HI there
I am hoping someone can help me write a simple script to save me from having to copy and paste this command into terminal each time I wish to use it.
I have tried this in pRun and Gexec but it fails to run correctly.
More than likely I do not know how to enter it correctly
This is it:
Code: Select all
yt-dlp -f wa --downloader aria2c --embed-thumbnail --batch-file /root/download.txt --path /root/Downloads/Podcasts
Thank you in advance!
**EDIT**
Updated the command 13 Nov 2022
Re: Writing an executable script
Posted: Sat Nov 12, 2022 3:19 pm
by rockedge
Try:
do_yt-dlp.sh
Code: Select all
#!/bin/sh
yt-dlp -f wa --downloader aria2c --progress --embed-thumbnail --batch-file /root/download.txt --path /root/Downloads/Podcasts
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 4:29 pm
by Jasper
Thank you so much rockedge for taking some time out to help me.
It's appreciated
I did see an option in when I opened up Rox there was an option for "New - Script". I was unsure, so I had to ask before I messed it up.
Works perfectly!!
Re: Writing an executable script
Posted: Sat Nov 12, 2022 5:35 pm
by fredx181
rockedge wrote: ↑Sat Nov 12, 2022 3:19 pm
Try:
do_yt-dlp.sh
Code: Select all
#!/bin/sh
yt-dlp -f wa --downloader aria2c --progress --embed-thumbnail --batch-file /root/download.txt --path /root/Downloads/Podcasts
If you want to see the progress to run it from urxvt terminal: (may show some error if thumbnail not found):
Code: Select all
#!/bin/sh
urxvt -e yt-dlp -f wa --downloader aria2c --progress --embed-thumbnail --batch-file /root/download.txt --path /root/Downloads/Podcasts
EDIT: Removed the single quotes in code above after urxvt -e
, perhaps won't always work to encapsulate the command with quotes.
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 5:53 pm
by Jasper
@fredx181
Thanks for that handy hint
Rockedge's script works and does open up terminal and conveniently tells me when the action has been completed, prompting me to press <enter>.
I will add your addition and try it out as well.
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 6:09 pm
by fredx181
Jasper wrote: ↑Sat Nov 12, 2022 5:53 pm
@fredx181
Rockedge's script works and does open up terminal and conveniently tells me when the action has been completed, prompting me to press <enter>.
...
So you mean when you click on Rockedge's script from file-manager it shows the terminal ? I doubt that , but may stand corrected.
EDIT: the script needs to be made executable; e.g. chmod +x do_yt-dlp.sh
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 6:31 pm
by Jasper
I have made a small gif to demonstrate that it works. Sorry only set it for 4 seconds as I hoped I could upload here as an attachment but even that was 900kb+.
Terminal opens up and runs the script.
https://gifyu.com/image/SEDFJ
The text box shows the code provided by rockedge.
All I did was save it with the filename provided. Then right clicked on the file and choose the option below.
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 6:40 pm
by fredx181
@Jasper Ah yes, you select 'run in terminal' that's ok, the script I suggested has the purpose to be able to just "click" on the script and it should open a terminal, but fine how you do it, of course.
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 7:02 pm
by Jasper
@fredx181
I have added your tips and I can confirm simply clicking on the file does run the script automatically.
Is there a way to keep the terminal visible?
It's fine for a single file, but it might be handy to have open when I have several links for eg for a drama series.
BTW I always the "Worst Audio" option as it's go enough for the phone and headphones to listen to. They always seem to improve the audio playback.
Also, I use yt-dlp as some programmes only allow you to download podcasts in high quality only.
It's not that important, I can trust the PC to do the job
**EDIT** just given it an icon to itself
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 7:12 pm
by rockedge
@fredx181 I could have added the code to open up a terminal on a click I suppose. Haven't tried it.
I am trying to figure out why the menu's in F96-CE are missing so many applications. Like Menu->Internet is almost completely empty.
(I need to consult @dimkr)
@Jasper If it ran in a terminal invoked in the script it would remain.
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 7:33 pm
by fredx181
Jasper wrote:Is there a way to keep the terminal visible?
Yes, try the -hold
option, so then e.g : urxvt -hold -e <yourcommandline>
EDIT: Can't test urxvt at the moment . but think -hold should work (or should it be --hold
perhaps , not sure).
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 7:48 pm
by Jasper
Thank you again
I am not 100% sure it does work, simply as I am only grabbing a single file at the moment.
I will have to add multiple url's to verify also the downloads are tiny at only 10mb or less each. So on a fast connection it completes the task quickly.
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 8:15 pm
by fredx181
Jasper wrote: ↑Sat Nov 12, 2022 7:48 pm
I will have to add multiple url's to verify also the downloads are tiny at only 10mb or less each. So on a fast connection it completes the task quickly.
Your yt-dlp command line works well for me to get very small size audio files, despite the error that sometimes I see about "thumbnail not found" (or something) the image shows for me when playing the audio with VLC.
Re: Writing an executable script [SOLVED]
Posted: Sat Nov 12, 2022 8:58 pm
by Jasper
Apologies, I didn't read your earlier message re:thumbnail.
There are two options to include the embedding of thumbnails.
Mutagen or Atomic Parsley.
Both I believe work in conjunction with FFMpeg.
Personally, I think Mutagen works best.
Yt-dlp will look for Mutagen first, if not found then will use Atomic Parsley.
Attached to my message.
You only need Mutagen. I just added Atomic Parsley as a backup.