Skip to content

Instantly share code, notes, and snippets.

@lifeofguenter
Last active November 11, 2018 21:14
Show Gist options
  • Select an option

  • Save lifeofguenter/d3e6d50999eac73dd60e to your computer and use it in GitHub Desktop.

Select an option

Save lifeofguenter/d3e6d50999eac73dd60e to your computer and use it in GitHub Desktop.

Revisions

  1. lifeofguenter revised this gist Jun 21, 2014. 2 changed files with 4 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions mkv2mp4
    Original file line number Diff line number Diff line change
    @@ -66,7 +66,7 @@ for FILE in *.mkv *.MKV; do
    done

    if [ "$RAN" -ne "1"]; then
    exit $POSTPROCESS_SKIP
    exit $POSTPROCESS_SKIP
    else
    exit $POSTPROCESS_SUCCESS
    exit $POSTPROCESS_SUCCESS
    fi
    4 changes: 2 additions & 2 deletions xvid2mp4
    Original file line number Diff line number Diff line change
    @@ -66,7 +66,7 @@ for FILE in *.avi *.AVI; do
    done

    if [ "$RAN" -ne "1"]; then
    exit $POSTPROCESS_SKIP
    exit $POSTPROCESS_SKIP
    else
    exit $POSTPROCESS_SUCCESS
    exit $POSTPROCESS_SUCCESS
    fi
  2. lifeofguenter revised this gist Jun 21, 2014. 2 changed files with 4 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions mkv2mp4
    Original file line number Diff line number Diff line change
    @@ -66,7 +66,7 @@ for FILE in *.mkv *.MKV; do
    done

    if [ "$RAN" -ne "1"]; then
    exit $POSTPROCESS_SKIP
    exit $POSTPROCESS_SKIP
    else
    exit $POSTPROCESS_SUCCESS
    exit $POSTPROCESS_SUCCESS
    fi
    4 changes: 2 additions & 2 deletions xvid2mp4
    Original file line number Diff line number Diff line change
    @@ -66,7 +66,7 @@ for FILE in *.avi *.AVI; do
    done

    if [ "$RAN" -ne "1"]; then
    exit $POSTPROCESS_SKIP
    exit $POSTPROCESS_SKIP
    else
    exit $POSTPROCESS_SUCCESS
    exit $POSTPROCESS_SUCCESS
    fi
  3. lifeofguenter revised this gist Jun 21, 2014. 2 changed files with 0 additions and 7 deletions.
    1 change: 0 additions & 1 deletion Z
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,6 @@
    ### NZBGET POST-PROCESSING SCRIPT ###
    ##############################################################################


    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    POSTPROCESS_ERROR=94
    6 changes: 0 additions & 6 deletions mkv2mp4
    Original file line number Diff line number Diff line change
    @@ -24,12 +24,6 @@
    ### NZBGET POST-PROCESSING SCRIPT ###
    ##############################################################################


    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # TODO:
    # http://nzbget.net/Extension_scripts#Testing_NZBGet_version

  4. lifeofguenter revised this gist Jun 21, 2014. 3 changed files with 96 additions and 30 deletions.
    14 changes: 10 additions & 4 deletions Z
    Original file line number Diff line number Diff line change
    @@ -3,15 +3,16 @@
    ##############################################################################
    ### NZBGET POST-PROCESSING SCRIPT ###

    # Move files...
    # Move files if all daisy-chained PP prior succeeded.
    # Version: 0.1.0
    #
    # Author: Günter Grodotzki <guenter@perlhipster.com>
    # Version: 2014-05-27
    #
    # NOTE: For support visit the forum thread: http://nzbget.net/forum/viewtopic.php?f=8&t=1265

    ##############################################################################
    ### OPTIONS ###

    # The final destination dir
    # The final directory for post-processed files
    #FinalDestination=~/downloads/z

    ### NZBGET POST-PROCESSING SCRIPT ###
    @@ -28,6 +29,11 @@ if [ "$NZBPP_TOTALSTATUS" != "SUCCESS" ]; then
    exit $POSTPROCESS_SKIP
    fi

    # only move files if there was no error prior
    if [ "$NZBPP_SCRIPTSTATUS" = "FAILURE" ]; then
    exit $POSTPROCESS_SKIP
    fi

    # move complete folder
    mv "$NZBPP_DIRECTORY" "$NZBPO_FINALDESTINATION"

    59 changes: 46 additions & 13 deletions mkv2mp4
    Original file line number Diff line number Diff line change
    @@ -3,15 +3,36 @@
    ##############################################################################
    ### NZBGET POST-PROCESSING SCRIPT ###

    # Simple dimple mkv to mp4 conversion (Sony Bravia compatible)
    # Transcode mkv to mp4 (Sony Bravia compatible).
    # Version: 0.1.0
    #
    # Author: Günter Grodotzki <guenter@perlhipster.com>
    # Version: 2014-06-17
    #
    # NOTE: For support visit the forum thread: http://nzbget.net/forum/viewtopic.php?f=8&t=1265

    ##############################################################################
    ### OPTIONS ###

    # Full path to ffmpeg executable
    #
    #
    # Example: /usr/bin/ffmpeg
    #
    #
    # If ffmpeg is in your PATH you may leave the path part and set only the executable name (e.g. "ffmpeg")
    #FfmpegCmd=ffmpeg

    ### NZBGET POST-PROCESSING SCRIPT ###
    ##############################################################################


    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # TODO:
    # http://nzbget.net/Extension_scripts#Testing_NZBGet_version

    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    POSTPROCESS_ERROR=94
    @@ -22,24 +43,36 @@ if [ "$NZBPP_TOTALSTATUS" != "SUCCESS" ]; then
    exit $POSTPROCESS_SKIP
    fi


    # check for valid executable
    command -v "$NZBPO_FFMPEGCMD" >/dev/null 2>&1 || { echo >&2 "[ERROR] ffmpeg not found."; exit $POSTPROCESS_ERROR; }

    # change to working dir
    cd "$NZBPP_DIRECTORY"

    # get all avi files
    for file in *.mkv *.MKV; do
    if [[ ! -e "$file" ]]; then
    RAN=0
    for FILE in *.mkv *.MKV; do
    if [[ ! -e "$FILE" ]]; then
    continue
    fi

    basename=$(basename "$file")
    extension="${basename##*.}"
    filename="${basename%.*}"

    ffmpeg -loglevel panic -i "$basename" -c:v copy -c:a libfaac -b:a 192k -ac 2 "$filename.mp4"
    BASENAME=$(basename "$FILE")
    EXTENSION="${BASENAME##*.}"
    FILENAME="${BASENAME%.*}"

    rm "$file"
    RESULT=`$NZBPO_FFMPEGCMD -y -loglevel error -i "$BASENAME" -c:v copy -c:a libfaac -b:a 192k -ac 2 "$FILENAME.mp4" > /dev/null 2>/dev/stdout`
    RC=$?
    if [ "$RC" -ne "0" ]; then
    echo "[ERROR] $NZBPP_NZBNAME ($BASENAME): $RESULT"
    exit $POSTPROCESS_ERROR
    else
    RAN=1
    rm "$FILE"
    fi
    done

    exit $POSTPROCESS_SUCCESS
    if [ "$RAN" -ne "1"]; then
    exit $POSTPROCESS_SKIP
    else
    exit $POSTPROCESS_SUCCESS
    fi
    53 changes: 40 additions & 13 deletions xvid2mp4
    Original file line number Diff line number Diff line change
    @@ -3,14 +3,29 @@
    ##############################################################################
    ### NZBGET POST-PROCESSING SCRIPT ###

    # Simple dimple xvid to mp4 conversion (Sony Bravia compatible)
    # Transcode xvid to mp4 (Sony Bravia compatible).
    # Version: 0.1.0
    #
    # Author: Günter Grodotzki <guenter@perlhipster.com>
    # Version: 2014-05-27
    #
    # NOTE: For support visit the forum thread: http://nzbget.net/forum/viewtopic.php?f=8&t=1265

    ##############################################################################
    ### OPTIONS ###

    # Full path to ffmpeg executable
    #
    #
    # Example: /usr/bin/ffmpeg
    #
    #
    # If ffmpeg is in your PATH you may leave the path part and set only the executable name (e.g. "ffmpeg")
    #FfmpegCmd=ffmpeg

    ### NZBGET POST-PROCESSING SCRIPT ###
    ##############################################################################

    # TODO:
    # http://nzbget.net/Extension_scripts#Testing_NZBGet_version

    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    @@ -22,24 +37,36 @@ if [ "$NZBPP_TOTALSTATUS" != "SUCCESS" ]; then
    exit $POSTPROCESS_SKIP
    fi


    # check for valid executable
    command -v "$NZBPO_FFMPEGCMD" >/dev/null 2>&1 || { echo >&2 "[ERROR] ffmpeg not found."; exit $POSTPROCESS_ERROR; }

    # change to working dir
    cd "$NZBPP_DIRECTORY"

    # get all avi files
    for file in *.avi *.AVI; do
    if [[ ! -e "$file" ]]; then
    RAN=0
    for FILE in *.avi *.AVI; do
    if [[ ! -e "$FILE" ]]; then
    continue
    fi

    basename=$(basename "$file")
    extension="${basename##*.}"
    filename="${basename%.*}"
    BASENAME=$(basename "$FILE")
    EXTENSION="${BASENAME##*.}"
    FILENAME="${BASENAME%.*}"

    ffmpeg -loglevel panic -i "$basename" -c:v libx264 -crf 20 -pix_fmt yuv420p -profile:v high -level 4.0 -c:a libfaac -b:a 192k -ac 2 "$filename.mp4"

    rm "$file"
    RESULT=`$NZBPO_FFMPEGCMD -y -loglevel error -i "$BASENAME" -c:v libx264 -crf 20 -pix_fmt yuv420p -profile:v high -level 4.0 -c:a libfaac -b:a 192k -ac 2 "$FILENAME.mp4" > /dev/null 2>/dev/stdout`
    RC=$?
    if [ "$RC" -ne "0" ]; then
    echo "[ERROR] $NZBPP_NZBNAME ($BASENAME): $RESULT"
    exit $POSTPROCESS_ERROR
    else
    RAN=1
    rm "$FILE"
    fi
    done

    exit $POSTPROCESS_SUCCESS
    if [ "$RAN" -ne "1"]; then
    exit $POSTPROCESS_SKIP
    else
    exit $POSTPROCESS_SUCCESS
    fi
  5. lifeofguenter revised this gist Jun 18, 2014. 3 changed files with 3 additions and 3 deletions.
    2 changes: 1 addition & 1 deletion Z
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # only post process 100% ok files
    if [ "$NZBPP_PARSTATUS" -ne 2 ] && [ "$NZBPP_UNPACKSTATUS" -ne 2 ]; then
    if [ "$NZBPP_TOTALSTATUS" != "SUCCESS" ]; then
    exit $POSTPROCESS_SKIP
    fi

    2 changes: 1 addition & 1 deletion mkv2mp4
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # only post process 100% ok files
    if [ "$NZBPP_TOTALSTATUS" -ne "SUCCESS" ]; then
    if [ "$NZBPP_TOTALSTATUS" != "SUCCESS" ]; then
    exit $POSTPROCESS_SKIP
    fi

    2 changes: 1 addition & 1 deletion xvid2mp4
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # only post process 100% ok files
    if [ "$NZBPP_PARSTATUS" -ne 2 ] && [ "$NZBPP_UNPACKSTATUS" -ne 2 ]; then
    if [ "$NZBPP_TOTALSTATUS" != "SUCCESS" ]; then
    exit $POSTPROCESS_SKIP
    fi

  6. lifeofguenter created this gist Jun 17, 2014.
    34 changes: 34 additions & 0 deletions Z
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    #!/bin/bash

    ##############################################################################
    ### NZBGET POST-PROCESSING SCRIPT ###

    # Move files...
    #
    # Author: Günter Grodotzki <guenter@perlhipster.com>
    # Version: 2014-05-27

    ##############################################################################
    ### OPTIONS ###

    # The final destination dir
    #FinalDestination=~/downloads/z

    ### NZBGET POST-PROCESSING SCRIPT ###
    ##############################################################################


    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # only post process 100% ok files
    if [ "$NZBPP_PARSTATUS" -ne 2 ] && [ "$NZBPP_UNPACKSTATUS" -ne 2 ]; then
    exit $POSTPROCESS_SKIP
    fi

    # move complete folder
    mv "$NZBPP_DIRECTORY" "$NZBPO_FINALDESTINATION"

    exit $POSTPROCESS_SUCCESS
    45 changes: 45 additions & 0 deletions mkv2mp4
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    #!/bin/bash

    ##############################################################################
    ### NZBGET POST-PROCESSING SCRIPT ###

    # Simple dimple mkv to mp4 conversion (Sony Bravia compatible)
    #
    # Author: Günter Grodotzki <guenter@perlhipster.com>
    # Version: 2014-06-17

    ### NZBGET POST-PROCESSING SCRIPT ###
    ##############################################################################


    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # only post process 100% ok files
    if [ "$NZBPP_TOTALSTATUS" -ne "SUCCESS" ]; then
    exit $POSTPROCESS_SKIP
    fi



    # change to working dir
    cd "$NZBPP_DIRECTORY"

    # get all avi files
    for file in *.mkv *.MKV; do
    if [[ ! -e "$file" ]]; then
    continue
    fi

    basename=$(basename "$file")
    extension="${basename##*.}"
    filename="${basename%.*}"

    ffmpeg -loglevel panic -i "$basename" -c:v copy -c:a libfaac -b:a 192k -ac 2 "$filename.mp4"

    rm "$file"
    done

    exit $POSTPROCESS_SUCCESS
    45 changes: 45 additions & 0 deletions xvid2mp4
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    #!/bin/bash

    ##############################################################################
    ### NZBGET POST-PROCESSING SCRIPT ###

    # Simple dimple xvid to mp4 conversion (Sony Bravia compatible)
    #
    # Author: Günter Grodotzki <guenter@perlhipster.com>
    # Version: 2014-05-27

    ### NZBGET POST-PROCESSING SCRIPT ###
    ##############################################################################


    # Exit codes used by NZBGet
    POSTPROCESS_SUCCESS=93
    POSTPROCESS_ERROR=94
    POSTPROCESS_SKIP=95

    # only post process 100% ok files
    if [ "$NZBPP_PARSTATUS" -ne 2 ] && [ "$NZBPP_UNPACKSTATUS" -ne 2 ]; then
    exit $POSTPROCESS_SKIP
    fi



    # change to working dir
    cd "$NZBPP_DIRECTORY"

    # get all avi files
    for file in *.avi *.AVI; do
    if [[ ! -e "$file" ]]; then
    continue
    fi

    basename=$(basename "$file")
    extension="${basename##*.}"
    filename="${basename%.*}"

    ffmpeg -loglevel panic -i "$basename" -c:v libx264 -crf 20 -pix_fmt yuv420p -profile:v high -level 4.0 -c:a libfaac -b:a 192k -ac 2 "$filename.mp4"

    rm "$file"
    done

    exit $POSTPROCESS_SUCCESS