#!/bin/bash #Author: Copyright Jelle de Jong #Note: Please send me an email if you enhanced this script #Version: 0.0.1 #Date: 05-04-07 #System: Ubuntu/Debian GNU/Linux #Information: man cat #Category Thunar scripts #Name: Merge MPG Files #Description: Merge multiple MPG files into one file #Command: xfce4-terminal --disable-server --hide-toolbars --execute /usr/share/pct-thunar-scripts/scripts/merge-file %F #Patterns: * #Video Files: True # Did the script work for you? # Yes # Yes, but with some errors # Yes, but I had to change some things # Not at all # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. TEXTDOMAINDIR=/usr/share/locale TEXTDOMAIN=${0##*/} NAME=$"Merge MPG Files" DESCRIPTION=$"Merge multiple MPG files into one file" cecho() { case "$1" in "black") echo -ne "\E[30m" ;; "red") echo -ne "\E[31m" ;; "green") echo -ne "\E[32m" ;; "yellow") echo -ne "\E[33m" ;; "blue") echo -ne "\E[34m" ;; "magenta") echo -ne "\E[35m" ;; "cyan") echo -ne "\E[36m" ;; *) echo -ne "\E[30m" exit ;; esac echo "$2" "$3" tput sgr0 } cecho "green" $"program:" echo "$0" cecho "green" $"description:" echo "$DESCRIPTION" check_program() { #whereis $1 if [ ! -e /usr/bin/$1 ] then cecho "red" $"$1 not found, installing now" sudo apt-get install "$1" fi } cecho "green" $"processing:" for I in "$@" do filename=${I##*/} cecho "green" "$filename" done echo -n $"are you sure you want to continue [Y/n]? " read input if [ "$input" = "n" ] then exit 0 fi cecho "blue" "---------------" for I in "$@" do cecho "green" $"starting: " # step 1: get name of file # step 2: get file extention # step 3: get location of the file # step 4: create a list of file to merge # step 5: display all the data and ask to continue # step 6: merge the files # step 7: display reslult and ask to exit if [ -f "$I" ] then dirname=${I%/*} file=${I##*/} filename=${I##*/}; filename=${filename%.*} extension=${I##*.} filetype=$(file -b "$I" | cut -f 1 -d ",") if [ "$extension" = "mpg" ] then echo "added ${I##*/} to query mpg" query_mpg+=("$I") fi fi cecho "green" $"completed:" cecho "blue" "---------------" done if [ -n "$query_mpg" ] then echo $"starting to merge the files, please standby..." cat "${query_mpg[@]}" > "$dirname/$filename"-merge.mpg fi echo -n $"completed task, are you sure you want to exit [Y/n]? " read input if [ "$input" = "n" ] then exit 0 fi exit