I have just learned about the wonderful ability to add functionality to your nautilus file browser buy using scripts. I thought it would be fun to share the useful scripts I've found and I hope you will share yours too!
Just copy these text files to your .gnome2/nautilus-scripts directory and make them executable. Then when using nautilus if you right click you will see your scripts in dropdown menu!
Copy to directoy
move to directoryCode:#! /bin/bash location=`zenity --file-selection --directory --title="Select a directory"` for arg do if [ -e "$location"/"$arg" ];then zenity --question --title="Conflict While Copying" --text="File ""$location"/"$arg"" already exists. Would you like to replace it?" case "$?" in 1 ) exit 1 ;; 0 ) cp "$arg" "$location" ;; esac else cp "$arg" "$location" fi done zenity --info --text "Finished Copying Files"
open terminal to your open directoryCode:#! /bin/bash location=`zenity --file-selection --directory --title="Select a directory"` for arg do if [ -e "$location"/"$arg" ];then zenity --question --title="Conflict While Moving" --text="File ""$location"/"$arg"" already exists. Would you like to replace it?" case "$?" in 1 ) exit 1 ;; 0 ) mv "$arg" "$location" ;; esac else mv "$arg" "$location" fi done zenity --info --text "Finished Moving Files"
easier than starting terminal then changing to the directory you want
create an iso image - thanks to disturbed1Code:#!/bin/sh /usr/bin/gnome-terminal
Make sure there are no spaces in the directory.
burn iso - thanks to disturbed1#!/bin/bash
#Makes a DVD UDF(1.02) ISO
#from the selected folders
xterm -bg white -fg black +hold -T "Building $1.iso" -e mkisofs -V "$1" -o "/media/path/to/output/iso/$1.iso" -dvd-video "$1" && zenity --info --text="Finished building $1.iso"
Code:#!/bin/bash #Burn iso @ 16 speed #large buffer xterm -bg white -fg black +hold -T "Burning $1" -e cdrecord speed=16 fs=128m -v -eject "$1" && zenity --info --text="Finished Burning $1"
Batch Encode AC3 from Avi using FFmpeg to get the wav and Aften to encode the AC3
Just right click anywhere in your directory containing avi files and select this script to batch encode AC3 audio.
Code:#! /bin/bash for i in *.avi do BASEFILENAME=$(basename "$i") ffmpeg -i "$i" -ar 48000 "$BASEFILENAME.wav" && \ aften "$BASEFILENAME.wav" -acmod 2 -readtoeof 1 -b 192 "$BASEFILENAME.ac3" && \ rm "$BASEFILENAME.wav" done zenity --info --text="Finished Encoding AC3 Files"
I am still woking on a full rewrite of HCbatchGUI to be a completely linux based app but in the meantime I have thrown together a nautilus script that can be used to batch encode video and audio using HCenc for video and native linux ffmpeg and aften for audio.
Make sure to change the text in bold blue to the path of your HCenc executable. Also make sure to copy your HCenc ini/template files from your wine directory to some other directory because zenity can't look into the wine directory.#! /bin/bash
################################################## #############################
#
#
#
# AUTHOR: freebird73717
#
# DESCRIPTION: This script encodes avs video files with HCenc and avi audio files
# with FFmpeg and Aften.
#
# REQUIREMENTS: Nautilus file manager
# feh (see http://www.linuxbrit.co.uk)
# zenity/gdialog, which is usually included in the gnome-utils package
# FFmpeg
# Aften
# HCenc
#
# INSTALLATION: GNOME 1.4.x: copy this script to the ~/Nautilus/scripts directory
# GNOME 2.x: copy to the ~/.gnome2/nautilus-scripts directory
# Copy your HCenc ini-template files to any directory other than a wine directory.
# Zenity can't read into the wine directory.
#
# USAGE: Make sure your avs and avi files are in the same directory.
# Right click in your video files directory, go to Scripts, and then select this script.
# You will then be asked to select an Output Directory for your video and audio files.
# Next you will be asked to select your HCenc ini-template file.
# Then you will enter the Average Video Bitrate and AC3 Audio bitrate.
# HCenc will then encode your avs files and ffmpeg and aften will encode your avi to ac3 audio.
#
#
#
# WHAT WORKS: Everything but the cancel buttons
#
# WHAT DOSENT
# WORK : The aforementioned cancel buttons
#
# VERSION INFO:
# 0.1 (20080311) - Initial public release
#
#
#
# LICENSE: GNU GPL
#
################################################## #############################
location=$(zenity --file-selection --directory --title="Select Audio & Video Output Directory")
HCini=$(zenity --file-selection --title="Select HCenc ini-template file")
BITRATE=$(zenity --title="Video AVG Bitrate" --entry)
AUDIOBITRATE=$(zenity --title="Audio Bitrate" --entry)
for i in *.avs
do
BASEFILENAME=$(basename "$i")
"/home/yourusername/.wine/drive_c/Program Files/HCbatchGUI/HCenc_022.exe" -i "$i" -o "$location/$BASEFILENAME.m2v" -b $BITRATE -maxbitrate 8500 -ini "$HCini"
done
for j in *.avi
do
ffmpeg -i "$j" -ar 48000 "$j.wav" && \
aften "$j.wav" -acmod 2 -readtoeof 1 -b $AUDIOBITRATE "$location/$j.ac3" && \
rm "$j.wav"
done
zenity --info --text="Finished Encoding Video & Audio Files With HCenc and Aften!"
The maxbitrate for the video is set to 8500 but you can change that by changing the scripts text.
Hopfully this will help some until I get the rewrite of the gui done (which will probably take some time.)
I know there are hundreds more that can be used with nautilus these are just the few I am now using. If you have others you find useful please post them here!
+ Reply to Thread
Results 1 to 3 of 3
-
Donadagohvi (Cherokee for "Until we meet again")
-
I have edited the "copy to" and "move to" scripts to pop up a confirmation dialog letting you know that it finished copying or moving the files.
Donadagohvi (Cherokee for "Until we meet again") -
Well, you already posted my 2 favs
Here's another one I use. Since Muxman doesn't create AUDIO_TS/VIDEO_TS directories, and I have a few players that will not play a disc without the VIDEO_TS.VOB/VTS_01_0.VOB files. This creates those files/folders.
Code:#!/bin/bash mkdir AUDIO_TS VIDEO_TS && dd if=/dev/zero of=VIDEO_TS.VOB bs=10000 count=1 && cp VIDEO_TS.VOB VTS_01_0.VOB && mv *.* VIDEO_TS
I do a bit of karaoke. This script requires the small program cdg2video. It takes a .cdg file and .mp3 file encodes them to DVD compliant mpeg2 and ac3 streams ready for DVD authoring. Fits around 100 or so karaoke tracks on a single DVD. Problem is, cdg2video creates improper NTSC DVD compliant files by itself (uses mp2 audio) plus DVD Styler works better with elementary streams. This takes care of all of that.
Code:#!/bin/bash #Convert mp3+cdg files to #DVD compliant m2v and ac3 streams for i in *.cdg; do cdg2video -f dvd -s dvd-ntsc -r ntsc --force-encode-audio "$i" | zenity --progress --title "CDG2VIDEO" --text "Converting $i to DVD" --pulsate --auto-close;done && for i in *.mp3;do lame --decode "$i" | zenity --progress --title "LAME" --text "DECODING $i" --pulsate --auto-close; done && for i in *.wav;do ffmpeg -i "$i" -ab 192K -ar 48000 "$i".ac3 | zenity --progress --title "FFMPEG" --text "ENCODING $i TO AC3" --pulsate --auto-close; done && for i in *.dvd; do mpgtx -d -b "$i" "$i" | zenity --progress --title "MPGTX" --text "DEMULTIPLEXING $i" --pulsate --auto-close; done && rm *.wav *.mp3 *.cdg *.dvd *.mp2
Nautilus scripts are extremely functional. Makes GNOME the most useful DE around (IMO of course).Linux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
Similar Threads
-
Is there a way to see actions done by scripts?
By Marc01FR in forum ffmpegX general discussionReplies: 1Last Post: 21st Jan 2011, 14:27 -
About using AviSynth scripts with MeGUI 0.3.5.0.
By Nagashi in forum DVD RippingReplies: 56Last Post: 15th Jul 2010, 10:15 -
Favorite analog clean-up scripts for FAVC?
By Valnar in forum RestorationReplies: 5Last Post: 27th Dec 2008, 23:35 -
Are these scripts right?
By php111 in forum Newbie / General discussionsReplies: 7Last Post: 21st Jan 2008, 17:10 -
Scripts for Conversion
By jwfc in forum Newbie / General discussionsReplies: 2Last Post: 6th Nov 2007, 06:50