Tue Jan 15, 2013 5:35 pm
#!/usr/bin/env bash
# youtube2what
[[ $# -ne 0 ]] || { echo "
Missing argument.
You need to name at least one video file.
" ; exit 1 ; }
# if yad is installed, use in preference
if [[ -f /usr/bin/yad ]]; then
DIALOG="yad"
INFO="image=gtk-dialog-info"
QUESTION="image=gtk-dialog-question"
WARNING="image=gtk-dialog-warning"
ERROR="image=gtk-dialog-error"
#buttons
BUTTON0="button"
BUTTON1="button"
BUTTON0NUM=":0"
BUTTON1NUM=":1"
#cancel button always returns 1 as $?
#ok button always returns 0 as $?
#ok is default (highlighted)
#buttons in yad dialog window may show reversed from zenity window, e.g.
#yad: ok -- cancel (0 -- 1)
#zenity: cancel -- ok (1 -- 0)
elif [[ -f /usr/bin/zenity ]]; then
# use zenity
DIALOG="zenity"
INFO="info"
QUESTION="question"
WARNING="warning"
ERROR="error"
#buttons
BUTTON0="ok-label"
BUTTON1="cancel-label"
BUTTON0NUM=""
BUTTON1NUM=""
else
nodialog="yes"
fi
if [[ $nodialog = "yes" ]]; then
while true ; do
echo "
Enter one of the following formats:
mp3 flac ogg avi mp4 mkv
"
read format
done
else
format=$($DIALOG --entry --title="Choose format" --text="Enter one of the following target formats:
mp3 flac ogg avi mp4 mkv")
fi
case "$format" in
mp3)
for MOVIE in "$@" ; do
AUDIOOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
ffmpeg -i "$MOVIE" -f mp3 "$AUDIOOUT".mp3
done ;;
flac)
for MOVIE in "$@" ; do
AUDIOOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
ffmpeg -i "$MOVIE" -f flac "$AUDIOOUT".flac
done ;;
ogg)
for MOVIE in "$@" ; do
AUDIOOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
ffmpeg -i "$MOVIE" -f ogg "$AUDIOOUT".ogg
done ;;
avi)
for MOVIE in "$@" ; do
VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
ffmpeg -i "$MOVIE" -b 798k -ab 128k "$VIDOUT".avi
done ;;
mp4)
for MOVIE in "$@" ; do
VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
ffmpeg -i "$MOVIE" -acodec copy -vcodec copy "$VIDOUT".mp4
done ;;
mkv)
for MOVIE in "$@" ; do
VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
ffmpeg -i "$MOVIE" -acodec copy -vcodec copy "$VIDOUT".mkv
done ;;
*) if [[ $nodialog = "yes" ]]; then
echo "
Unsupported format. Try one of these next time:
mp3 flac avi mp4 mkv
"
exit 1
else
$DIALOG --$ERROR --title=Error! --text="Unsupported format. Try one of these next time\:
mp3 flac ogg avi mp4 mkv "
exit 1
fi
esac
exit 0
Tue Jan 15, 2013 11:32 pm
Wed Jan 16, 2013 12:27 am
$ sudo gdebi youtube-viewer_0.0.1_i386.deb
...
Package: youtube-viewer-antix
Version: 0.0.1
Architecture: i386
...
Failed to open the software package
The package might be corrupted or you are not allowed to open the file. Check the permissions of the file.
Wed Jan 16, 2013 2:38 am
dpkg -i youtube-viewer_0.0.1_i386.deb
Wed Jan 16, 2013 2:27 pm
$ gtk-youtube-viewer
Can't locate WWW/YoutubeViewer.pm in @INC (@INC contains: [slash]etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/bin/gtk-youtube-viewer line 35.
Wed Jan 16, 2013 3:30 pm
Wed Jan 16, 2013 4:38 pm
Wed Jan 16, 2013 5:09 pm
Tue Jan 22, 2013 4:19 pm
Is there a way to get it to use gnome-mplayer or to show the controls in mplayer?
Tue Jan 22, 2013 4:55 pm