8000 Local trash folder instead of global one via environment variable (automated) · Issue #398 · jlesage/docker-handbrake · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Local trash folder instead of global one via environment variable (automated) #398
Open
@aronmgv

Description

@aronmgv

VIDEO_TRASH_PATH="/trash/${video#"$wf"}"

Can you please implement logic here to use local trash folder instead of global one? E.g. based on env variable AUTOMATED_CONVERSION_USE_TRASH_LOCAL if equals to 1? Disadvantage of global trash folder is that it full copies the files to the trash folder even if the trash folder is within the same partition as watch folder on the host.. caveats of docker volumes..

My scenario is that my handbrake instance is running on remote server and it is doing conversion on my local server files - via NFS. Thus after the conversion it wants to move file to the trash folder and it takes ages to "copy" it over the ipsec tunnel back and forth.

Using .trash folder within each /watch folder would solve this caveat.. tested it with post_conversion.sh script and works good.. and I think it is good idea to implement it as a env variable option. Thanks!

post_conversion.sh test

#!/bin/sh
#
# This is an example of a post-conversion hook.  This script is always invoked
# with /bin/sh (shebang ignored).
#
# The first parameter is the conversion status.  A value of 0 indicates that
# the video has been converted successfully.  Else, conversion failed.
#
# The second parameter is the full path to the converted video (the output).
#
# The third parameter is the full path to the source file.
#
# The fourth argument is the name of the HandBrake preset used to convert the
# video.
#

CONVERSION_STATUS=$1
CONVERTED_FILE="$2"
SOURCE_FILE="$3"
PRESET="$4"

#echo "post-conversion: Status = $CONVERSION_STATUS"
#echo "post-conversion: Output File = $CONVERTED_FILE"
#echo "post-conversion: Source File = $SOURCE_FILE"
#echo "post-conversion: Preset = $PRESET"

if [ "$CONVERSION_STATUS" -eq 0 ]; then
    # Move the source file to the .trash folder in the same directory
    SOURCE_DIR=$(dirname "$SOURCE_FILE")
    TRASH_DIR="$SOURCE_DIR/.trash"
    
    if [ -d "$TRASH_DIR" ]; then
        echo "Trash directory exists: $TRASH_DIR"
        mv "$SOURCE_FILE" "$TRASH_DIR"
    else
        echo "Trash directory does not exist: $TRASH_DIR"
        # Optionally, create the trash directory if it doesn't exist
        mkdir -p "$TRASH_DIR"
        mv "$SOURCE_FILE" "$TRASH_DIR"
    fi
else
    # Failed conversion.

    # TODO: Do something useful.
    :
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0