Skip to content

Instantly share code, notes, and snippets.

@jonath92
Last active September 18, 2024 19:06
Show Gist options
  • Save jonath92/0f6bf4606bc8a34be1bb0826c99b73d1 to your computer and use it in GitHub Desktop.
Save jonath92/0f6bf4606bc8a34be1bb0826c99b73d1 to your computer and use it in GitHub Desktop.
Install-Update-Youtube-dl Linux Mint
# This is a simple script for install youtube-dl and creating a script in /etc/cron.daily
# to automatically update youtube-dl on a daily basis.
# can be executed with:
# sudo su -c "bash <(wget -qO- https://gist.githubusercontent.com/jonath92/0f6bf4606bc8a34be1bb0826c99b73d1/raw/914aabe6c4b15dc614f18c8816f5ad2828755c22/install-Update-Youtube-dl.sh)" root
# Remove apt version to prevent conflicts
apt purge -y youtube-dl
# Fix python not found error https://askubuntu.com/a/1149489/1013434
ln -s /usr/bin/python3 /usr/local/bin/python
# Install youtube-dl
# https://github.com/ytdl-org/youtube-dl#installation
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
chmod a+rx /usr/local/bin/youtube-dl
# create script for daily update
UPDATE_PATH="/etc/cron.daily/update_youtube_dl"
touch ${UPDATE_PATH}
echo "#! /bin/sh" > ${UPDATE_PATH}
echo "youtube-dl --update" >> ${UPDATE_PATH}
chmod +x ${UPDATE_PATH}
# To uninstall youtube-dl run:
# sudo rm /usr/local/bin/youtube-dl /etc/cron.daily/update_youtube_dl
@jimalex71
Copy link

jimalex71 commented Sep 28, 2022

Downloading with youtube-dl works but the log says the file can't be copied from tmp.

Gjs-Message: 15:05:36.113: JS LOG: [LookingGlass/error] Failed to copy download from tmp dir. The following error occurred: Error moving file /tmp/.123AB1/abcdefghi.mp3: No such file or directory

@jonath92
Copy link
Author

What do you mean with "youtube-dl" works? Is the Song in the end downloaded to the directory you selected in the settings? Does the directory you selected in the settings exist? Because this is the only thing I can imagine throwing such Kind of error..

@FoulerTripod
Copy link

FoulerTripod commented Aug 14, 2023

downloading once worked but i got a .webp instead of .mp4 or .mp3 when i tried to update and reload the radio it would give me this error:
JS LOG: [LookingGlass/error] Failed to copy download from tmp dir. The following error occurred: Error: filename couldn't be determined.
And yes the file exists as it is in the download and i tried to create a new file changed the dir and it didnt work

@jonath92
Copy link
Author

Does it happens in some cases or always?

@FoulerTripod
Copy link

it always happened i first suspected it bcs of python i tried to re install everything it would get be the same error would i provide something that will be more useful? I am using Linux Mint

@jonath92
Copy link
Author

yeah no you are right I can reproduce it. This needs to be fixed. As a workaround you can use yt-dlp which you can select in the radio applet settings. and install by sudo su -c "bash <(wget -qO- https://gist.githubusercontent.com/jonath92/039e998b3d3f6ba4afd5d5c671eaedf1/raw/23542a3aadadf5ba181fb8aff723c27610551abd/install-update-yt-dlp.sh)" root

@jimalex71
Copy link

jimalex71 commented Aug 15, 2023

What do you mean with "youtube-dl" works? Is the Song in the end downloaded to the directory you selected in the settings? Does the directory you selected in the settings exist? Because this is the only thing I can imagine throwing such Kind of error..

I mean the MP3 is being created in a temp directory.

It's just not being moved to the destination directory.

Have not fired up the Linux machine in a while but will give it a go again asap.

@FoulerTripod
Copy link

Thank you Jonath92! I love how dedicated you are to the project and I hope one day i can do my own project. Thanks again!

@jonath92
Copy link
Author

You are more than welcome to contribute to the Code. When you have question, I am absolutely willed to help.

@FoulerTripod
Copy link

unfortunately my coding expertise is still minimal at this moment with the only languages i know are java and c++ but if you are interested in translating your applet to Arabic I am proficient in Arabic

@luckyshot
Copy link

For those having problems with youtube-dl, there's already a script to use yt-dlp here:

https://gist.github.com/jonath92/039e998b3d3f6ba4afd5d5c671eaedf1

Then right click Radio++ icon > Configure, go to Preferences tab and choose yt-dlp as the CLI tool.

Make sure the Download directory exists, I had to create the folder Radio or else it would fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment