Sponsored Content
Full Discussion: Learning to Script in Linux
Top Forums Shell Programming and Scripting Learning to Script in Linux Post 303017750 by Rhysers on Monday 21st of May 2018 08:57:47 PM
Old 05-21-2018
@Chubler_XL Thanks! I don't have the time right now to dive all the way in but just playing with the find command and digging through its manual...thanks so much. I'll let you know.

---------- Post updated at 08:57 PM ---------- Previous update was at 05:39 PM ----------

So the find command prints out all of the ts files, and the script works when I run it, but it stops after the first encode. I'm not sure why. Is it something to do with handbrakecli coming back and basically saying "hey i'm done" causing the script to then think that it too is done?
Heres the output for the end:
Code:
Muxing: this may take awhile...[00:44:05] mux: track 0, 133307 frames, 1434924901 bytes, 2520.47 kbps, fifo 2048
 [00:44:05] mux: track 1, 213492 frames, 93191479 bytes, 163.69 kbps, fifo 4096
[00:44:05] mux: track 2, 142325 frames, 218611200 bytes, 383.99 kbps, fifo 2048
[00:44:05] libhb: work result = 0

Encode done!

HandBrake has exited.
 rhys@odin:~$

and here's what I ran. a couple small changes, one to correct a mistake in what I originally posted, and a change to the path to limit the number of tracks it would find.
Code:
#!/bin/bash

SRC=./SOURCE_FOLDER/
DEST=./DESTINATION_FOLDER/
DEST_EXT=mp4
#HANDBRAKE_CLI=/Applications/HandBrakeCLI
PRESET="Roku 720p30 Surround"


find '/mnt/raid/Kids Movies' -iname "*.ts" -print | while read filepath
do
    LOCATION=${filepath%/*}  # Delete everything in $filepath from last slash to end and store in LOCATION
    FILENAME=${filepath##*/} # Delete everything in $filepath from front to last slash and store in FILENAME
    SRC=${LOCATION}
    DEST=${FILENAME%.*}      # Delete everything in $FILENAME from last dot to end and store in DEST

    HandBrakeCLI -i "$SRC/$FILENAME" -o "$SRC/${DEST}.${DEST_EXT}" --preset="$PRESET"
    if [ -s "$SRC/${DEST}.${DEST_EXT}" ]    # File exists and has size greater than zero
    then
        rm "$filepath"
    fi
done

It should have moved on to the second movie in the folder with the matching .ts extension, but it stopped after the first one.


I'm assuming that the done is the closer of the while loop and that it should hit done and move back to the while (so long as there is another input).


Thanks for any help.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Learning Unix & Linux

I'm new to Unix. I'm just looking for really good unix documents through Internet as pdf format on programming in all shells, and system adminstrator documents, and well as just all around really good documents on unix. Thank you (5 Replies)
Discussion started by: faaarin
5 Replies

2. Shell Programming and Scripting

learning how to use shell script

hello everyone, i am still trying to get this script to work, but with no luck. It is a little beyond my knowledge of scripting at the moment. The beginner book i have has an exercise listed that asks me to write a script tha allows for user input. For example " what is your name: " and then you... (3 Replies)
Discussion started by: bebop1111116
3 Replies

3. UNIX for Dummies Questions & Answers

Learning Unix/Linux from the Start?

I was wondering if someone could tell me where I could learn everything about Unix/Linux and I was also wondering what the differance between Unix and Linux was :confused: Ive never used it, never seen it.. But Im interested in learning :D (3 Replies)
Discussion started by: Vallzi
3 Replies

4. UNIX for Dummies Questions & Answers

learning how to script

I have this command line entry that I would like to turn into a script. I want to be able to just run the script with options for the report name and switch. Can anyone help me get started? I am hoping that by creating this script it will help me be able to create more. I have never written one. I... (11 Replies)
Discussion started by: llsmr777
11 Replies

5. Linux

which linux is best for learning unix?

I have just installed Ubuntu because I need a linux system asap and Ubuntu seems to be easiest for that. But I plan on installing some other Linux distro's for a while (maybe on virtualBox too) so i can understand the inner workings of linux and especially more about unix. I know that alot of the... (11 Replies)
Discussion started by: fuzzylogic25
11 Replies

6. Programming

Learning OS design, Linux Vs. Minix???

Hi friends, I hope everybody is fine. I have been studing operating system concepts at college, and I find this subject very interesting. I've decided that I must go into this field no matter what, hopefully someday I would design my own operating system. I have two choices infront of me, studying... (9 Replies)
Discussion started by: gabam
9 Replies

7. Shell Programming and Scripting

Learning abt Linux OS

hi guys, i got job recently in a company which provide a product for data backup and data recovery... as dis product is wrriten in c++ am workin in c++.. now am under training and i want to learn abt Operating System concepts and OS programming using c and c++. i know basic c and c++ programming... (0 Replies)
Discussion started by: senthil.march
0 Replies

8. UNIX for Dummies Questions & Answers

Setting up a home network for learning Linux

I am working on learning Linux, and somebody suggested setting up Linux on a separate computer, and searching for answers to whatever may be needed, on a different computer plugged in to the Internet. I have a Windows 7 PC, plugged in to a cable modem, and an old notebook, Compaq Presario R3000... (5 Replies)
Discussion started by: AdultFoundry
5 Replies

9. Programming

Learning python, lost with script

Hi there, im just having a hard time understanding why this code does not print anything that is suppose to print: score = raw_input ('what is your score? \n') try: if 1.0 == float(score) >= 0.9: print "A" elif 0.9 > float(score) >= 0.8: ... (1 Reply)
Discussion started by: la2015
1 Replies
Net::Server::MultiType(3)				User Contributed Perl Documentation				 Net::Server::MultiType(3)

NAME
Net::Server::MultiType - Net::Server personality SYNOPSIS
use base qw(Net::Server::MultiType); sub process_request { #...code... } my @types = qw(PreFork Fork Single); Net::Server::MultiType->run(server_type => @types); DESCRIPTION
Please read the pod on Net::Server first. This module is a personality, or extension, or sub class, of the Net::Server module. This personality is intended to allow for easy use of multiple Net::Server personalities. Given a list of server types, Net::Server::MultiType will require one at a time until it finds one that is installed on the system. It then adds that package to its @ISA, thus inheriting the methods of that personality. ARGUMENTS
In addition to the command line arguments of the Net::Server base class, Net::Server::MultiType contains one other configurable parameter. Key Value Default server_type 'server_type' 'Single' server_type May be called many times to build up an array or possible server_types. At execution, Net::Server::MultiType will find the first available one and then inherit the methods of that personality CONFIGURATION FILE
"Net::Server::MultiType" allows for the use of a configuration file to read in server parameters. The format of this conf file is simple key value pairs. Comments and white space are ignored. #-------------- file test.conf -------------- ### multi type info ### try PreFork first, then go to Single server_type PreFork server_type Single ### server information min_servers 20 max_servers 80 spare_servers 10 max_requests 1000 ### user and group to become user somebody group everybody ### logging ? log_file /var/log/server.log log_level 3 pid_file /tmp/server.pid ### access control allow .+.(net|com) allow domain.com deny a.+ ### background the process? background 1 ### ports to bind host 127.0.0.1 port localhost:20204 port 20205 ### reverse lookups ? # reverse_lookups on #-------------- file test.conf -------------- PROCESS FLOW
See Net::Server HOOKS
There are no additional hooks in Net::Server::MultiType. TO DO
See Net::Server AUTHOR
Paul T. Seamons paul@seamons.com SEE ALSO
Please see also Net::Server::Fork, Net::Server::INET, Net::Server::PreFork, Net::Server::MultiType, Net::Server::Single perl v5.18.2 2012-06-05 Net::Server::MultiType(3)
All times are GMT -4. The time now is 10:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy