Mailinglist Archive: opensuse (686 mails)

< Previous Next >
Re: [opensuse] bash: how to get file extension
On Mon, 2013-07-15 at 12:27 -0400, Anton Aylward wrote:
Brian K. White said the following on 07/15/2013 12:00 PM:



Now the important part, sometimes known as
Context is Everything

Is it?

How to code a particular thing vastly depends on the rest of the job it
is a part of.

Perfect. I want to get an mp3 from a movie. So here it is in all its
contextual glory:

#!/bin/bash
address=$1
echo YouTube $address
video_id=$(echo $1 | cut -d '=' -f2)
youtube-dl $1
echo Downoading: $video_id;
video_title="$(youtube-dl --get-title $address)"
if [ -z "$video_title" ]
then {
video_title="no title"
echo "cant get song title, using no title"
}
fi
full_name=$(ls "$video_title"*)
ext="${full_name##*.}"
echo Found "$video_title": Converting to "$video_title.mp3"
echo Converting. . .
ffmpeg -i "/home/lynn/Desktop/$video_title"-"$video_id"."$ext"
"$video_title".wav
lame --scale 2 "$video_title".wav "$video_title".mp3
#echo Cleaning up.
#rm "$full_name" "$video_title".wav
echo Written "$video_title.mp3"

But seriously guys. Thanks. This list is the best.



--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups