{"id":15690281,"url":"https://github.com/mpolden/unp","last_synced_at":"2025-05-07T23:37:09.580Z","repository":{"id":20715507,"uuid":"23999520","full_name":"mpolden/unp","owner":"mpolden","description":"Monitor directories and unpack files","archived":false,"fork":false,"pushed_at":"2023-06-04T17:24:55.000Z","size":168,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-26T05:41:31.756Z","etag":null,"topics":["file-events","go","sfv","unpack"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpolden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-13T16:36:33.000Z","updated_at":"2024-09-18T22:46:49.000Z","dependencies_parsed_at":"2024-06-20T08:19:33.407Z","dependency_job_id":"fc6d5d1c-9c31-4005-a93a-c7c5f6926df5","html_url":"https://github.com/mpolden/unp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolden%2Funp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolden%2Funp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolden%2Funp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolden%2Funp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpolden","download_url":"https://codeload.github.com/mpolden/unp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243042917,"owners_count":20226721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-events","go","sfv","unpack"],"created_at":"2024-10-03T18:08:33.483Z","updated_at":"2025-03-11T13:32:01.037Z","avatar_url":"https://github.com/mpolden.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unp\n\n![Build Status](https://github.com/mpolden/unp/workflows/ci/badge.svg)\n\n`unp` monitors a list of configured directories and automatically verifies and\nunpacks multi-volume RAR archives as they are written. A combination of file\nsystem events and SFV files are used to determine when archives should be\nunpacked.\n\n## Usage\n\n```\n$ unp -h\nUsage of unp:\n  -f string\n    \tPath to config file (default \"~/.unprc\")\n  -t\tTest and print config\n```\n\n## Example config\n\n```json\n{\n  \"BufferSize\": 1024,\n  \"Paths\": [\n    {\n      \"Name\": \"/home/foo/videos\",\n      \"Handler\": \"rar\",\n      \"MinDepth\": 4,\n      \"MaxDepth\": 5,\n      \"SkipHidden\": true,\n      \"Patterns\": [\n        \"*.r??\",\n        \"*.sfv\"\n      ],\n      \"Remove\": false,\n      \"PostCommand\": \"mv {{.Dir}} /tmp/\"\n    }\n  ]\n}\n```\n\n## Configuration options\n\n`BufferSize` sets the maximum number of file system events to queue in memory.\nThis should be large enough to store any events that occur while an event is\nprocessed by its handler. The default value is `1024`.\n\n`Paths` is an array of paths to watch.\n\n`Name` is the path that should be watched.\n\n`Handler` sets the handler to use. This can be either `rar` (default if\nunspecified) or `script`. The `rar` handler automatically unpacks RAR archives\nand uses SFV files to determine completeness. The `script` handler calls the\nspecified `PostCommand` without any processing or completeness checks.\n\n`MinDepth` sets the minimum depth allowed to trigger the handler. A `MinDepth`\nof `4` would allow files in `/home/foo/videos/bar` to trigger an event.\n\n`MaxDepth` sets the maximum depth allowed to trigger the handler. A `MaxDepth`\nof `5` would allow files in `/home/foo/videos/bar/baz` to trigger an event.\n\n`SkipHidden` determines whether events for hidden files (files prefix with `.`)\nshould be ignored.\n\n`Patterns` sets the wildcard patterns that a file needs to match to trigger an\nevent.\n\n`Remove` determines whether the handler should delete files after processing\nthem.\n\n`PostCommand` is an optional command to run after the handler processing\ncompletes.\n\n## Command templates\n\nThe following template variables are available for use in the `PostCommand`\noption:\n\nVariable | Description                                    | Example\n-------- | ---------------------------------------------- | -------\n`Base`   | Basename of the file triggering the event      | `baz.rar`\n`Dir`    | Directory holding the file                     | `/tmp/foo/bar`\n`Name`   | Full path to archive file triggering the event | `/tmp/foo/bar/baz.rar`\n\nThe template is compiled using the\n[text/template](http://golang.org/pkg/text/template/) package. Variables can be\nused like this: `{{.Name}}`\n\nThe working directory of `PostCommand` will be set to the directory where the\narchive is located, equal to `{{.Dir}}`.\n\n## Signals\n\n`unp` reacts to the following signals:\n\n`SIGUSR1` triggers a re-scan which walks all configured paths and triggers its\nhandler for any matching files that are found.\n\n`SIGUSR2` reloads configuration from disk. This can be used to watch new paths\nwithout restarting the program.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpolden%2Funp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpolden%2Funp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpolden%2Funp/lists"}