diff --git a/media/handbrake/hand_loop.sh b/media/handbrake/hand_loop.sh new file mode 100644 index 0000000..872b508 --- /dev/null +++ b/media/handbrake/hand_loop.sh @@ -0,0 +1,11 @@ +#/bin/bash + +file=$1 +if [ -f "$file" ]; then + while read -r line; + do + echo "" | ./handbrake.sh "$line" + done < "$file" +else + echo "$file does not exist or is not a file!" +fi diff --git a/media/handbrake/handbrake.sh b/media/handbrake/handbrake.sh new file mode 100644 index 0000000..26bfdd2 --- /dev/null +++ b/media/handbrake/handbrake.sh @@ -0,0 +1,18 @@ +#/bin/bash + +file="$1" +if [ -f "$file" ]; +then + + output="${file##*/}" + /usr/bin/HandBrakeCLI --preset-import-gui preset.json -map-metadata 0 -E mp3 -B 128 -b 1600 -e x265 -x vbv-maxrate=1600 -x vbv-bufsize=2200 -X 1920 -Y 1080 --audio-lang-list "eng" --subtitle-lang-list "eng" --all-subtitles -i "${file}" -o "${output%.*}.mkv" + if [ $? -eq 0 ] + then + echo "would have moved $file to $file.old" >> log.txt + echo "would have moved $output to $file" >> log.txt + else + echo "error with $file" >> error.txt + fi +else + echo "$file not found!" >> error.log +fi diff --git a/media/handbrake/preset.json b/media/handbrake/preset.json new file mode 100644 index 0000000..218aa77 --- /dev/null +++ b/media/handbrake/preset.json @@ -0,0 +1,112 @@ +{ + "PresetList": [ + { + "AlignAVStart": false, + "AudioCopyMask": [], + "AudioEncoderFallback": "mp3", + "AudioLanguageList":[ + "eng" + ], + "AudioList": [ + { + "AudioBitrate": 128, + "AudioCompressionLevel": 0, + "AudioEncoder": "mp3", + "AudioMixdown": "stereo", + "AudioNormalizeMixLevel": false, + "AudioSamplerate": "auto", + "AudioTrackQualityEnable": false, + "AudioTrackQuality": -1, + "AudioTrackGainSlider": 0, + "AudioTrackDRCSlider": 0 + } + ], + "AudioSecondaryEncoderMode": true, + "AudioTrackSelectionBehavior": "first", + "ChapterMarkers": true, + "ChildrenArray": [], + "Default": false, + "FileFormat": "av_mkv", + "Folder": false, + "FolderOpen": false, + "Mp4HttpOptimize": false, + "Mp4iPodCompatible": false, + "PictureAutoCrop": false, + "PictureBottomCrop": 0, + "PictureLeftCrop": 0, + "PictureRightCrop": 0, + "PictureTopCrop": 0, + "PictureDARWidth": 1080, + "PictureDeblockPreset": "off", + "PictureDeblockTune": "medium", + "PictureDeblockCustom": "strength=strong:thresh=20:blocksize=8", + "PictureDeinterlaceFilter": "off", + "PictureCombDetectPreset": "off", + "PictureCombDetectCustom": "", + "PictureDenoiseCustom": "", + "PictureDenoiseFilter": "off", + "PictureDenoisePreset": "medium", + "PictureDenoiseTune": "none", + "PictureSharpenCustom": "", + "PictureSharpenFilter": "off", + "PictureSharpenPreset": "medium", + "PictureSharpenTune": "none", + "PictureDetelecine": "off", + "PictureDetelecineCustom": "", + "PictureColorspacePreset": "off", + "PictureColorspaceCustom": "", + "PictureChromaSmoothPreset": "off", + "PictureChromaSmoothTune": "none", + "PictureChromaSmoothCustom": "", + "PictureItuPAR": false, + "PictureKeepRatio": true, + "PictureLooseCrop": false, + "PicturePAR": "auto", + "PicturePARWidth": 1, + "PicturePARHeight": 1, + "PictureWidth": 1920, + "PictureHeight": 1080, + "PictureUseMaximumSize": true, + "PictureAllowUpscaling": false, + "PictureForceHeight": 0, + "PictureForceWidth": 0, + "PicturePadMode": "none", + "PicturePadTop": 0, + "PicturePadBottom": 0, + "PicturePadLeft": 0, + "PicturePadRight": 0, + "PresetName": "dikburt", + "Type": 1, + "SubtitleAddCC": false, + "SubtitleAddForeignAudioSearch": true, + "SubtitleAddForeignAudioSubtitle": false, + "SubtitleBurnBehavior": "none", + "SubtitleBurnBDSub": false, + "SubtitleBurnDVDSub": false, + "SubtitleLanguageList": [ + "eng" + ], + "SubtitleTrackSelectionBehavior": "none", + "VideoColorMatrixCode": 0, + "VideoEncoder": "x265", + "VideoFramerateMode": "vfr", + "VideoGrayScale": false, + "VideoScaler": "swscale", + "VideoPreset": "fast", + "VideoTune": "", + "VideoProfile": "auto", + "VideoLevel": "auto", + "VideoOptionExtra": "", + "VideoQSVDecode": true, + "VideoQSVAsyncDepth": 0, + "VideoTwoPass": false, + "VideoTurboTwoPass": false, + "x264UseAdvancedOptions": false, + "PresetDisabled": false, + "MetadataPassthrough": false + } + ], + "VersionMajor": 47, + "VersionMicro": 0, + "VersionMinor": 0 +} diff --git a/util/gandi_dyndns b/util/gandi_dyndns new file mode 100644 index 0000000..739635f --- /dev/null +++ b/util/gandi_dyndns @@ -0,0 +1,25 @@ +#!/bin/bash + +# Gandi LiveDNS API KEY +API_KEY=$GANDI_DDNS_API_KEY + +# Domain hosted with Gandi +DOMAIN=$GANDI_DDNS_DOMAIN + +# Subdomain to update DNS +SUBDOMAIN=$GANDI_DDNS_SUBDOMAIN + +# Get external IP address +EXT_IP=$(curl -s ifconfig.me) + +#Get the current Zone for the provided domain +CURRENT_ZONE_HREF=$(curl -s -H "X-Api-Key: $API_KEY" https://dns.api.gandi.net/api/v5/domains/$DOMAIN | jq -r '.zone_records_href') + +# Update the A Record of the subdomain using PUT +curl -D- -X PUT -H "Content-Type: application/json" \ + -H "X-Api-Key: $API_KEY" \ + -d "{\"rrset_name\": \"$SUBDOMAIN\", + \"rrset_type\": \"A\", + \"rrset_ttl\": 1200, + \"rrset_values\": [\"$EXT_IP\"]}" \ + $CURRENT_ZONE_HREF/$SUBDOMAIN/A diff --git a/util/urle b/util/urle new file mode 100755 index 0000000..f9b3c8f --- /dev/null +++ b/util/urle @@ -0,0 +1,17 @@ +#!/bin/env bash + +urlencode_single_printf () { + string=$1; format=; set -- + while [ -n "$string" ]; do + tail=${string#?} + head=${string%$tail} + case $head in + [-._~0-9A-Za-z]) format=$format%c; set -- "$@" "$head";; + *) format=$format%%%02x; set -- "$@" "'$head";; + esac + string=$tail + done + printf "$format\\n" "$@" +} + +urlencode_single_printf $1 \ No newline at end of file