Giter VIP home page Giter VIP logo

unp's Introduction

unp

Build Status

unp monitors a list of configured directories and automatically verifies and unpacks multi-volume RAR archives as they are written. A combination of file system events and SFV files are used to determine when archives should be unpacked.

Usage

$ unp -h
Usage of unp:
  -f string
    	Path to config file (default "~/.unprc")
  -t	Test and print config

Example config

{
  "BufferSize": 1024,
  "Paths": [
    {
      "Name": "/home/foo/videos",
      "Handler": "rar",
      "MinDepth": 4,
      "MaxDepth": 5,
      "SkipHidden": true,
      "Patterns": [
        "*.r??",
        "*.sfv"
      ],
      "Remove": false,
      "PostCommand": "mv {{.Dir}} /tmp/"
    }
  ]
}

Configuration options

BufferSize sets the maximum number of file system events to queue in memory. This should be large enough to store any events that occur while an event is processed by its handler. The default value is 1024.

Paths is an array of paths to watch.

Name is the path that should be watched.

Handler sets the handler to use. This can be either rar (default if unspecified) or script. The rar handler automatically unpacks RAR archives and uses SFV files to determine completeness. The script handler calls the specified PostCommand without any processing or completeness checks.

MinDepth sets the minimum depth allowed to trigger the handler. A MinDepth of 4 would allow files in /home/foo/videos/bar to trigger an event.

MaxDepth sets the maximum depth allowed to trigger the handler. A MaxDepth of 5 would allow files in /home/foo/videos/bar/baz to trigger an event.

SkipHidden determines whether events for hidden files (files prefix with .) should be ignored.

Patterns sets the wildcard patterns that a file needs to match to trigger an event.

Remove determines whether the handler should delete files after processing them.

PostCommand is an optional command to run after the handler processing completes.

Command templates

The following template variables are available for use in the PostCommand option:

Variable Description Example
Base Basename of the file triggering the event baz.rar
Dir Directory holding the file /tmp/foo/bar
Name Full path to archive file triggering the event /tmp/foo/bar/baz.rar

The template is compiled using the text/template package. Variables can be used like this: {{.Name}}

The working directory of PostCommand will be set to the directory where the archive is located, equal to {{.Dir}}.

Signals

unp reacts to the following signals:

SIGUSR1 triggers a re-scan which walks all configured paths and triggers its handler for any matching files that are found.

SIGUSR2 reloads configuration from disk. This can be used to watch new paths without restarting the program.

unp's People

Contributors

mpolden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

aknysh

unp's Issues

Password list

Hi,
Nice project.

Did you considered adding option to specify password list so when gounpack encounter archive with password it will try all passwords from list on it before stopped processing it?

Best regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.