oulipo Posted May 14, 2013 Share Posted May 14, 2013 I slightly modified a youtube-dl workflow to add an action to download the audio, I used this script url="{query}" if [ -z $url ] then echo "No url provided" else /usr/local/bin/youtube-dl --extract-audio --audio-format=mp3 -f 18 -o "$HOME/Desktop/%(title)s.%(ext)s" "{query}" echo "Completed" fi for some reason, if I type an equivalent command in a shell, this will result in an audio named "My Video.mp3" on my desktop, but if I use the Alfred Workflow, this will result in a video named "My Video.mp4" (and not only the audio) Someone sees where there might be a problem? As a reference https://dl.dropboxusercontent.com/u/70378973/Youtube%20Download.alfredworkflow Link to comment
jdfwarrior Posted May 15, 2013 Share Posted May 15, 2013 I slightly modified a youtube-dl workflow to add an action to download the audio, I used this script url="{query}" if [ -z $url ] then echo "No url provided" else /usr/local/bin/youtube-dl --extract-audio --audio-format=mp3 -f 18 -o "$HOME/Desktop/%(title)s.%(ext)s" "{query}" echo "Completed" fi for some reason, if I type an equivalent command in a shell, this will result in an audio named "My Video.mp3" on my desktop, but if I use the Alfred Workflow, this will result in a video named "My Video.mp4" (and not only the audio) Someone sees where there might be a problem? As a reference https://dl.dropboxusercontent.com/u/70378973/Youtube%20Download.alfredworkflow I tried it from the command line and still got an mp4 as well, and received this error: ERROR: WARNING: unable to obtain file audio codec with ffprobe Perhaps you're having the same issue? Link to comment
oulipo Posted May 15, 2013 Author Share Posted May 15, 2013 (edited) Perhaps this depends on the particular video that you are trying to download, or perhaps there was a problem with the download? I was trying with and it was working correctly in bash but indeed it would be nice that the workflow allows for errors to filter through to the Grunt notifications, do you know how this could be done? Edited May 15, 2013 by oulipo Link to comment
oulipo Posted May 15, 2013 Author Share Posted May 15, 2013 ~/tmp❯ url="www.youtube.com/watch?v=JllJTYrbn-w" ~/tmp❯ /usr/local/bin/youtube-dl --extract-audio --audio-format=mp3 -f 18 -o "%(title)s.%(ext)s" "$url" [youtube] Setting language [youtube] JllJTYrbn-w: Downloading video webpage [youtube] JllJTYrbn-w: Downloading video info webpage [youtube] JllJTYrbn-w: Extracting video information [download] Destination: We Were Evergreen - Penguins & Moonboots (2009).mp4 [download] 100.0% of 12.96MiB at 199.16KiB/s ETA 00:00 [ffmpeg] Destination: We Were Evergreen - Penguins & Moonboots (2009).mp3 Deleting original file We Were Evergreen - Penguins & Moonboots (2009).mp4 (pass -k to keep) ~/tmp❯ ls ▕-rw-r--r--▏14 sec │ 3.1M│We Were Evergreen - Penguins & Moonboots (2009).mp3 Link to comment
oulipo Posted May 15, 2013 Author Share Posted May 15, 2013 (edited) I've done it again in the shell and it works, I'm starting to believe that youtube-dl has not the same behavior when launching from the Alfred bash, perhaps because the youtube-dl script relies on ffmpeg and it does not find it in the PATH when launched from Alfred? How could I force this? Edited May 15, 2013 by oulipo Link to comment
oulipo Posted May 15, 2013 Author Share Posted May 15, 2013 This was indeed the problem and I fixed it by adding export PATH=/usr/local/bin:$PATH at the beginning of the script to allow it to find `ffmpeg`, but this is some hack is there a better solution? Link to comment
jdfwarrior Posted May 15, 2013 Share Posted May 15, 2013 This was indeed the problem and I fixed it by adding export PATH=/usr/local/bin:$PATH at the beginning of the script to allow it to find `ffmpeg`, but this is some hack is there a better solution? This is caused by Alfred not importing your profile. When creating workflows it's good to remember that the only thing in the $PATH variable is /bin;/sbin;/usr/sbin;/usr/bin. As mentioned in the other thread, for now, either appending paths to the $PATH variable or simply specifying full path to the additional components that you need access to is the most common solution to this issue. oulipo 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now