-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc07509
commit 9850d55
Showing
17 changed files
with
876 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# This is a repo for all my random code snippets. | ||
|
||
# Most of it is only useful to me, but if it is useful to me, it might be to others. | ||
|
||
# This file will list all the code snippets and give a brief overview of they do. | ||
|
||
simplersync.sh - a very simple rsync backup script that emails the results | ||
|
||
ffmpeg-progress.sh - a second attempt at an ffmpeg progress script, to get an ETA for a trasncode job | ||
|
||
xbmc_maverick_revo.sh - a script to install xbmc on Ubunut maverick, designed for the Revo 3610 | ||
|
||
ffmpeg_mic_stream.sh - use ffmpeg to stream a PC's mic to the network | ||
|
||
ffmpeg_audio_stream.sh - use to open the stream created by ffmpeg_mic_stream.sh | ||
|
||
forecast.py - get the weather forecast via Android SL4A | ||
|
||
say_forecast.py - say the forecast retrieved by forecast.py | ||
|
||
bash_progress.sh - monitor the progress of a bash script via bash | ||
|
||
mythtv_remodel.sh - rename, move then delete mythtv recordings - for mythtv 0.20 | ||
|
||
snort.txt - various snort tricks | ||
|
||
mediaportal_comskip.bat - windows batch script to comskip various recordings from mediaportal | ||
|
||
mediaportal_trans.sh - ubuntu script to transcode mediaportal recordings | ||
|
||
mkv_merge.sh - merge mkv files | ||
|
||
m2ts_trans.sh - transcode m2ts files produced by Sony's Playstation 3 PlayTV program | ||
|
||
file_name_conversion.txt - move between various file names in batch and bash scripts | ||
|
||
ubuntu_tricks.txt - various ubuntu tips |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
time=( $(tac /var/log/rsback/work-daily | grep -m 1 "total runtime" | awk '{ print $6 }') ) | ||
echo "last running time was" $time | ||
/bin/rsback -v work-daily >> /var/log/rsback/work-daily & | ||
pid=$! | ||
trap " | ||
#[ -e /proc/$pid ] && kill $pid | ||
#" EXIT | ||
|
||
while [ -e /proc/$pid ]; do | ||
sleep 10 | ||
runtime=( $(ps ax | grep -m 1 zenity | awk '{print $4}') ) | ||
echo "#" $runtime | ||
done | zenity --width 500 --progress --pulsate --title="work-daily running time: $time" --text="running time:" --auto-close | ||
retval=$? | ||
|
||
# If the progress bar was canceled, give a warning. | ||
if [ $retval -ne 0 ]; then | ||
zenity --title="work-daily rsback" --error --text="the work-daily rsback was cancelled" || exit 1 | ||
kill $pid | ||
fi | ||
time=( $(tac /var/log/rsback/work-daily | grep -m 1 "total runtime" | awk '{ print $6 }') ) | ||
zenity --info --title "Work rsback" --text "work rsback done in $time" | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
echo "starting vlc" | ||
VPID=( $(ps -e | grep vlc | awk '{print $1;}')) | ||
if [ $? = 1 ];then | ||
echo "error getting vlc PID, exiting" | ||
exit | ||
fi | ||
while [ -n "$VPID" ];do | ||
kill $VPID | ||
VPID=( $(ps -e | grep vlc | awk '{print $1;}')) | ||
done | ||
cvlc http://192.168.1.5:8081 & | ||
PID1=$? | ||
|
||
echo video status $PID1 | ||
if [ "$PID1" == "1" ];then | ||
echo "error starting vlc video" | ||
exit | ||
fi | ||
vlc rtp://234.5.5.5:1234 --equalizer-bands="0,0,15,15,15,-20,0,0,0,0" & | ||
PID2=$? | ||
|
||
echo audio status $PID2 | ||
if [ "$PID2" == "1" ];then | ||
echo "error starting vlc audio" | ||
exit | ||
fi | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://234.5.5.5:1234 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
#updated ffmpeg progress indicator | ||
#by Rupert Plumridge | ||
#for updates visit www.prupert.co.uk | ||
#Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales Licence | ||
# Based on the ffmpegprogress bar from: http://handybashscripts.blogspot.com/2011/01/ffmpeg-with-progress-bar-re-work.html | ||
# which was based on my initital progress script - circle of life and all that ;) | ||
# version 2.0 | ||
# 07.04.2011 | ||
# now uses apparently better progress detection, based on duration of overall video and progress along the conversion | ||
#################################################################################### | ||
# USAGE # | ||
# 1) Run the script with the name of the file to be converted after the name of the script (e.g. ./ffmpeg-progress.sh "My Awesome Video.mpg) | ||
################################################################################### | ||
# Please adjust the following variables as needed. | ||
# It is recommended you at least adjust the first variable, the name of the script | ||
SCRIPT=ffmpeg-progress.sh | ||
LOG=$HOME/ffmpegprog.log | ||
|
||
display () # Calculate/collect progress | ||
{ | ||
START=$(date +%s); FR_CNT=0; ETA=0; ELAPSED=0 | ||
while [ -e /proc/$PID ]; do # Is FFmpeg running? | ||
sleep 2 | ||
VSTATS=$(awk '{gsub(/frame=/, "")}/./{line=$1-1} END{print line}' \ | ||
/tmp/vstats) # Parse vstats file. | ||
if [ $VSTATS -gt $FR_CNT ]; then # Parsed sane or no? | ||
FR_CNT=$VSTATS | ||
PERCENTAGE=$(( 100 * FR_CNT / TOT_FR )) # Progbar calc. | ||
ELAPSED=$(( $(date +%s) - START )); echo $ELAPSED > /tmp/elapsed.value | ||
ETA=$(date -d @$(awk 'BEGIN{print int(('$ELAPSED' / '$FR_CNT') *\ | ||
('$TOT_FR' - '$FR_CNT'))}') -u +%H:%M:%S) # ETA calc. | ||
fi | ||
echo -ne "\rFrame:$FR_CNT of $TOT_FR Time:$(date -d @$ELAPSED -u +%H:%M:%S) ETA:$ETA Percent:$PERCENTAGE" # Text for stats output. | ||
|
||
done | ||
} | ||
|
||
trap "killall ffmpeg $SCRIPT; rm -f "$RM/vstats*"; exit" \ | ||
INT TERM EXIT # Kill & clean if stopped. | ||
|
||
# Get duration and PAL/NTSC fps then calculate total frames. | ||
FPS=$(ffprobe "$1" 2>&1 | sed -n "s/.*, \(.*\) tbr.*/\1/p") | ||
DUR=$(ffprobe "$1" 2>&1 | sed -n "s/.* Duration: \([^,]*\), .*/\1/p") | ||
HRS=$(echo $DUR | cut -d":" -f1) | ||
MIN=$(echo $DUR | cut -d":" -f2) | ||
SEC=$(echo $DUR | cut -d":" -f3) | ||
TOT_FR=$(echo "($HRS*3600+$MIN*60+$SEC)*$FPS" | bc | cut -d"." -f1) | ||
if [ ! "$TOT_FR" -gt "0" ]; then echo error; exit; fi | ||
|
||
# Re-code with it. | ||
|
||
nice -n 15 ffmpeg -deinterlace -vstats_file /tmp/vstats -y -i "$1" -vcodec libx264 -level 41 -vpre main -vpre medium -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 "$1".mkv 2>/dev/null & # CHANGE THIS FOR YOUR FFMPEG COMMAND. | ||
PID=$! && | ||
echo "ffmpeg PID = $PID" | ||
echo "Length: $DUR - Frames: $TOT_FR " | ||
display # Show progress. | ||
rm -f "$RM"/vstats* # Clean up tmp files. | ||
|
||
# Statistics for logfile entry. | ||
((BATCH+=$(cat /tmp/elapsed.value))) # Batch time totaling. | ||
ELAPSED=$(cat /tmp/elapsed.value) # Per file time. | ||
echo "\nDuration: $DUR - Total frames: $TOT_FR" >> $LOG | ||
AV_RATE=$(( TOT_FR / ELAPSED )) | ||
echo -e "Re-coding time taken: $(date -d @$ELAPSED -u +%H:%M:%S)"\ | ||
"at an average rate of $AV_RATE""fps.\n" >> $LOG | ||
|
||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
For Bash Scripting | ||
|
||
(taken from linuxgazette) | ||
|
||
Given: | ||
foo=/tmp/my.dir/filename.tar.gz | ||
We can use these expressions: | ||
path = ${foo%/*} | ||
To get: /tmp/my.dir (like dirname) | ||
file = ${foo##*/} | ||
To get: filename.tar.gz (like basename) | ||
base = ${file%%.*} | ||
To get: filename | ||
ext = ${file#*.} | ||
To get: tar.gz | ||
For Windows Batch Scripting | ||
|
||
(taken from imagemagick) | ||
|
||
%~1 expands %1 removing any surrounding quotes (“) | ||
%~f1 expands %1 to a fully qualified path name | ||
%~d1 expands %1 to a drive letter only | ||
%~p1 expands %1 to a path only | ||
%~n1 expands %1 to a file name only | ||
%~x1 expands %1 to a file extension only | ||
These two pieces of info can thus be used to pass any variable or variation of that variable to a command in your script. | ||
|
||
Using these tools I have been able to get MediaPortal to automatically scan each new recording for adverts using comskip and then transfer the recording, alongside the necessary advert info files to my network hard drive on my server using a batch script. Then the server runs a bash script each morning to scan for new files on the new recordings file, convert them to MKV using Handbrake and add chapter markers and then move the MKV files to my networked videos file. Cool! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
"""Retrieve the weather forecast for the current location.""" | ||
|
||
__author__ = 'Rupert Plumridge <r.plumridge@gmail.com>' | ||
__copyright__ = 'Copyleft (c) 2010, The World.' | ||
__license__ = 'Creative Commons Attribution-Non-Commercial-Share Alike 3.0 Unported Licence' | ||
# based on the weather.py script by T.V. Raman <raman@google.com>,from Google, from the ASE Python script examples | ||
|
||
|
||
import urllib2, re | ||
from xml.dom import minidom | ||
from urllib import quote | ||
|
||
GOOGLE_WEATHER_URL = 'http://www.google.co.uk/ig/api?weather=%s&hl=%s' | ||
|
||
def extract_value(dom, parent, child): | ||
"""Convenience function to dig out weather values.""" | ||
return dom.getElementsByTagName(parent)[0].getElementsByTagName(child)[0].getAttribute('data') | ||
|
||
def get_weather_from_google(location_id, hl = ''): | ||
""" | ||
Fetches weather report from Google | ||
Parameters | ||
location_id: a zip code (10001); city name, state (weather=woodland,PA); city name, country (weather=london, england); | ||
latitude/longitude(weather=,,,30670000,104019996) or possibly other. | ||
hl: the language parameter (language code). Default value is empty string, in this case Google will use English. | ||
Returns: | ||
weather_data: a dictionary of weather data that exists in XML feed. | ||
""" | ||
location_id, hl = map(quote, (location_id, hl)) | ||
url = GOOGLE_WEATHER_URL % (location_id, hl) | ||
handler = urllib2.urlopen(url) | ||
content_type = handler.info().dict['content-type'] | ||
xml_response = handler.read() | ||
dom = minidom.parseString(xml_response) | ||
handler.close() | ||
#some shenanigans to get to the first forecast | ||
dom1Node = dom.firstChild | ||
dom2Node = dom1Node.firstChild | ||
#current conditions | ||
current = dom2Node.childNodes[1] | ||
#next forecast | ||
forecast = dom2Node.childNodes[2] | ||
|
||
|
||
#return the data back | ||
data = {} | ||
current_dom = dom.getElementsByTagName('weather')[0] | ||
data['city'] = extract_value(current_dom, 'forecast_information','city') | ||
data['fdate'] = extract_value(current_dom, 'forecast_information','forecast_date') | ||
data['ccondition'] = current.getElementsByTagName('condition')[0].getAttribute('data') | ||
data['ctemp'] = current.getElementsByTagName('temp_c')[0].getAttribute('data') | ||
data['cwind'] = current.getElementsByTagName('wind_condition')[0].getAttribute('data') | ||
data['fcondition'] = forecast.getElementsByTagName('condition')[0].getAttribute('data') | ||
data['flow'] = forecast.getElementsByTagName('low')[0].getAttribute('data') | ||
data['fhigh'] = forecast.getElementsByTagName('high')[0].getAttribute('data') | ||
data['fday'] = forecast.getElementsByTagName('day_of_week')[0].getAttribute('data') | ||
dom.unlink() | ||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
echo transm2ts.sh started on `date "+%m/%d/%y %l:%M:%S %p"` > /mnt/media/documents/ruperts/TV/transm2ts.log | ||
find /mnt/media/documents/ruperts/TV -name "*.m2ts" >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
chmod -R 777 /mnt/media/documents/ruperts/TV | ||
find /mnt/media/documents/ruperts/TV -name "*.m2ts" -exec /home/server/Desktop/handbrake/HandBrakeCLI -i {} -t 1 -c 1 -o {}.mkv -f mkv -w 720 -e xvid -b 1200 -2 -a 1 -E faac -B 160 -R 0 -6 dpl2 -D 1 -C 2 -v '{}' \; >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
echo transm2ts.sh finished on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
echo starting clear up on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
cd "/mnt/media/documents/ruperts/TV/" || { echo >&2 "Source folder not found"; exit 1; } >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
find . -type f -name "*.m2ts" -exec sh -c '[ -f "${1%.m2ts}.m2ts.mkv" ]' _ {} \; -delete >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
find . -type f -name "*.m2ts" -exec sh -c '[ -f "${1%.m2ts}.mkv" ]' _ {} \; -delete >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
find /mnt/media/documents/ruperts/TV -name "*.mkv" -exec mv {} /media/video/Video/TV \; >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
echo m2ts files deleted and moved script stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/transm2ts.log | ||
exit | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@ECHO OFF | ||
ECHO ECHO. | ||
ECHO Rem Batch commands for %1 START >> "C:\scripts\comskip\trans.bat" | ||
ECHO CD "C:\scripts\comskip" >> "C:\scripts\comskip\trans.bat" | ||
ECHO START "" "C:\Program Files\VideoLAN\VLC\vlc.exe" >> "C:\scripts\comskip\trans.bat" | ||
ECHO %%SystemRoot%%\explorer.exe "Z:\" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO ************************** ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO Post Processing started on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO ECHO Starting mpeg2repair %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO mpeg2repairHelper.exe %1 %1-fixed.ts >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO ECHO mpeg2repair finished on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO Comskip started on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO comskip %1 >>"%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO Comskip finished on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO %%date%% %%time%% ^>^> "Z:\new_files.log" >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO ECHO ComClean started on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO mencoder "%~dpn1.ts" -edl "%~dpn1.edl" -alang eng,nar -noskip -vf harddup -oac copy -ovc copy -of mpeg -o "%~dpn1_clean.ts" >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO ECHO ComClean finished on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO New file %1 being moved to Server ^>^> "Z:\new_files.log" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO Tidying started on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO %%SystemRoot%%\explorer.exe "Z:\" >> "C:\scripts\comskip\trans.bat" | ||
ECHO CD "%~dp1" >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO ren *.edl *.ts.edl >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO ren *.txt *.ts.txt >> "C:\scripts\comskip\trans.bat" | ||
ECHO ren *.chap *.ts.chap >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO Moving Clean TS to Server directory on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO IF EXIST "%~dpn1_clean.ts" del %1 >> "C:\scripts\comskip\trans.bat" | ||
ECHO xcopy %1 Z:\ >> "C:\scripts\comskip\trans.bat" | ||
ECHO IF EXIST "Z:\%~n1.ts" del %1 >> "C:\scripts\comskip\trans.bat" | ||
REM ECHO xcopy "%~dpn1.edl" Z:\ >> "C:\scripts\comskip\trans.bat" | ||
ECHO del "%~dpn1.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO xcopy "%~dpn1.ts.chap" Z:\ >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO TS and others moved to Server directory on %%date%% %%time%% ^>^> "%~dpn1.PostLog.txt" >> "C:\scripts\comskip\trans.bat" | ||
ECHO ECHO %~n1.ts moved to Server on %%date%% %%time%% ^>^> "Z:\new_files.log" >> "C:\scripts\comskip\trans.bat" | ||
ECHO TASKKILL /IM vlc.exe >> "C:\scripts\comskip\trans.bat" | ||
ECHO Rem Batch commands for %1 FINISH >> "C:\scripts\comskip\trans.bat" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# Written by FakeOutdoorsman and updated by mysoogal further updated by prupert | ||
# Attribution-Noncommercial 3.0 Unported | ||
# http://creativecommons.org/licenses/by-nc/3.0/deed.en | ||
# trackback http://ubuntuforums.org/showthread.php?t=960627 | ||
echo trans.sh started on `date "+%m/%d/%y %l:%M:%S %p"` > /mnt/media/documents/ruperts/TV/trans.log | ||
find /mnt/media/documents/ruperts/TV -name "*.ts" >> /mnt/media/documents/ruperts/TV/trans.log | ||
chmod -R 777 /mnt/media/documents/ruperts/TV | ||
find /mnt/media/documents/ruperts/TV -name "*.ts" -exec /home/server/Desktop/handbrake/HandBrakeCLI -i {} -t 1 -c 1 -o {}.mkv -f mkv -e xvid -b 1200 -2 -a 1 -E faac -B 160 -R 0 -6 dpl2 -D 1 -C 2 -v '{}' \; >> /mnt/media/documents/ruperts/TV/trans.log | ||
echo trans.sh finished on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/trans.log | ||
echo attempting to add advert chapter markers on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/trans.log | ||
find /mnt/media/documents/ruperts/TV -name "*.mkv" -exec /home/server/scripts/mkvmerge.sh "{}" \; >> /mnt/media/documents/ruperts/TV/trans.log | ||
echo advert chapter markers added on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/trans.log | ||
echo starting clear up on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/trans.log | ||
cd "/mnt/media/documents/ruperts/TV/" || { echo >&2 "Source folder not found"; exit 1; } >> /mnt/media/documents/ruperts/TV/trans.log | ||
find . -type f -name "*.ts" -exec sh -c '[ -f "${1%.ts}.ts.mkv" ]' _ {} \; -delete >> /mnt/media/documents/ruperts/TV/trans.log | ||
find . -type f -name "*.ts" -exec sh -c '[ -f "${1%.ts}.mkv" ]' _ {} \; -delete >> /mnt/media/documents/ruperts/TV/trans.log | ||
find . -type f -name "*.ts.mkv" -exec sh -c '[ -f "${1%.ts.mkv}.mkv" ]' _ {} \; -delete >> /mnt/media/documents/ruperts/TV/trans.log | ||
find . -type f -name "*.ts.chap" -exec sh -c '[ -f "${1%.ts.chap}.mkv" ]' _ {} \; -delete >> /mnt/media/documents/ruperts/TV/trans.log | ||
find /mnt/media/documents/ruperts/TV -name "*.mkv" -exec mv {} /media/video/Video \; >> /mnt/media/documents/ruperts/TV/trans.log | ||
find /mnt/media/documents/ruperts/TV -name "*.edl" -exec rm {} \; >> /mnt/media/documents/ruperts/TV/trans.log | ||
find /mnt/media/documents/ruperts/TV -name "*.txt" -exec rm {} \; >> /mnt/media/documents/ruperts/TV/trans.log | ||
echo ts files deleted and moved script stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/trans.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
echo mkvmerge.sh started on `date "+%m/%d/%y %l:%M:%S %p"` >> /mnt/media/documents/ruperts/TV/trans.log | ||
VIDEO=$1 | ||
ENC=${VIDEO##*/} | ||
mkvmerge --chapters "${VIDEO%/*}/${ENC%%.*}.ts.chap" "$VIDEO" -o "/mnt/media/documents/ruperts/TV/${ENC%%.*}.mkv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#! /bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: mythtvremodel | ||
# Required-Start: $local_fs $syslog $remote_fs dbus | ||
# Required-Stop: $local_fs $syslog $remote_fs | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: rename, move delete recordings | ||
### END INIT INFO | ||
# script to rename files recorded from mythtv and then to move them and delete them | ||
#made by prupert.co.uk | ||
#creative commons licence, whichever is the most FREE (as in beer) | ||
|
||
#lets put in some variables so others can use this | ||
#location of log file, you can choose anything and any name | ||
log=/path/to/mythtvremodel.log | ||
#this is the full path to mythrename.pl | ||
mrename=/location/to/mythrename.pl | ||
#this is the full path to your recordings folder | ||
record=/var/www/mythweb/data/recordings/ | ||
#this is the extension your recordings are stored as, usually mpg or nuv | ||
ext=mpg | ||
#this is the full path to where you want your files moved to | ||
dest=/path/to/folder/to/move/recordings/to/ | ||
#this is the full path to myth.find_orphans.pl | ||
morphan=/path/to/myth.find_orphans.pl | ||
#mythtv database password for myth.find_orphans.pl | ||
pass=yourmythtvdatabasepassword | ||
|
||
# first, run mythtvrename to get nice names for the recordings | ||
echo starting mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` > $log | ||
perl $mrename --underscores --format %T-%S-%d%m%y >> $log | ||
# use find to search for all recorded files in the recording folder and move them to the TV folder | ||
find "$record" -name "*.$ext" >> $log | ||
find "$record" -name "*.$ext" -exec mv {} "$dest" \; >> $log | ||
# use mythorphan to remove the now missing recorded files from the database | ||
perl $morphan --pass=$pass --dodbdelete >> $log | ||
#that should be it | ||
echo stopping mythtvremodel on `date "+%m/%d/%y %l:%M:%S %p"` >> $log | ||
exit 0 |
Oops, something went wrong.