<commit_before># packard

[![Coverage Status](https://coveralls.io/repos/othiym23/packard/badge.svg?branch=master)](https://coveralls.io/r/othiym23/packard?branch=master)

Optimize the storage of media files on fixed-size storage volumes.

## usage

```
$ packard unpack -s ~/Downloads/flac ~/Downloads/flac_SHXCXCHCXSH-STRGTHS.zip --archive
new albums from this run:

/Users/ogd/Downloads/flac/SHXCXCHCXSH/[2013] STRGTHS

full details:

SHXCXCHCXSH/[2013] STRGTHS/
   SHXCXCHCXSH - STRGTHS - 01 - SLVRBBL.flac
   SHXCXCHCXSH - STRGTHS - 02 - LTTLWLF.flac
   SHXCXCHCXSH - STRGTHS - 03 - RSRRCTN.flac
   SHXCXCHCXSH - STRGTHS - 04 - LDWGWTT.flac
   SHXCXCHCXSH - STRGTHS - 05 - PCTSTSS.flac
   SHXCXCHCXSH - STRGTHS - 06 - WHTLGHT.flac
   SHXCXCHCXSH - STRGTHS - 07 - LLDTMPS.flac
c: SHXCXCHCXSH/[2013] STRGTHS/cover.jpg
(unpacked to /var/folders/bf/1f70gl7x2_g0s1dchcrw97xm0000gn/T/packard-fecf5c346649efb4/49901c567bc9ae3ba1ffa13358beec2e9e525950)

now archived:

/Users/ogd/Downloads/flac_SHXCXCHCXSH-STRGTHS.zip
  -> /Users/ogd/Downloads/archives/flac_SHXCXCHCXSH-STRGTHS.zip
```

```
$ packard --root=~/Music/flac artists
Basic Channel [1318M]
<NAME> [2439M]
<NAME> [1671M]
Perc [1358M]
Shackleton [2257M]
```

## shared options

* `--loglevel` (_default: `info`_): `packard` uses `npmlog` (I know it,
  and it has excellent progress bar support). It takes the same log
  levels as npm: `error`, `warn`, `info`, `verbose`, and `silly`. It
  probably takes `http`, but there's no use for that. Yet.
* `--save-config`: Save this run's configuration to `~/.packardrc`.

## commands

### unpack a set of zip files containing tracks

```
$ packard unpack [zipfile [zipfile...]]
```

Unpack a set of zipped files containing FLAC files and cover art,
organizing the files into releases and then moving them, along with
their cover art, into a staging directory. You can either pass the list
of files to be expanded as command-line arguments, or use `--root` and
`--pattern` together to have `packard unpac` generate the list of files
you (or you can do both).

If you want to move the files to an archival location after unpacking them,
use `--archive` and set an `--archive-root`.

Options:

* `--staging`, `-s` **required**: The staging directory into which the
  unpacked and renamed files should be placed.
* `--root`, `-R`: The top level of a directory hierarchy containing zip
  files.
* `--pattern`, `-P`: bash glob pattern to join with `root` to find zip files.
  Be sure to single-quote the pattern if you use this option!
* `--archive`: If set, move the unpacked files to `archive-root` after
  extraction.
* `--archive-root`: Where to put zip files after extraction. Files in
  `archive-root` will not be unpacked or moved.

### generate a list of artists

```
$ packard artists
```

Scan one or more directory trees recursively, printing out a list of the artist
names found, with the sizes of the tracks by that artist, in
[mebibytes](http://en.wikipedia.org/wiki/Mebibyte). This list, in this format,
can be fed into `packard`'s other commands.

Options:

* `--root`: The top level of a directory hierarchy, laid out in
  `root/Artist/Album` format. Can be used more than once.

## MIT License

The MIT License (MIT)

Copyright (c) 2015 <NAME> <<EMAIL>>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.<commit_msg>doc: document PLS in README<commit_after>[![Build Status](https://travis-ci.org/othiym23/packard.svg)](https://travis-ci.org/othiym23/packard)
[![Coverage Status](https://coveralls.io/repos/othiym23/packard/badge.svg?branch=master)](https://coveralls.io/r/othiym23/packard?branch=master)

# packard

Optimize the storage of media files on fixed-size storage volumes. Currently
supports FLAC files with Vorbis comments.

## usage

```
$ packard
Usage: packard [options] <command>

Commands:
  artists    generate a list of artists from roots
  inspect    dump all the metadata from a track or album
  pls        print a list of albums as a .pls file, sorted by date
  unpack     unpack a set of zipped files into a staging directory

Options:
  -S, --save-config  save this run's configuration to ~/.packardrc [default: false]
  --loglevel         logging level                                 [default: "info"]
  -h, --help         Show help
  --version          Show version number
```

### unpack a set of zip files containing audio files

```
$ packard unpack [zipfile [zipfile...]]
```

example run:

```
$ packard unpack -s ~/Downloads/flac ~/Downloads/flac_SHXCXCHCXSH-STRGTHS.zip --archive
new albums from this run:

/Users/ogd/Downloads/flac/SHXCXCHCXSH/[2013] STRGTHS

full details:

SHXCXCHCXSH/[2013] STRGTHS/
   SHXCXCHCXSH - STRGTHS - 01 - SLVRBBL.flac
   SHXCXCHCXSH - STRGTHS - 02 - LTTLWLF.flac
   SHXCXCHCXSH - STRGTHS - 03 - RSRRCTN.flac
   SHXCXCHCXSH - STRGTHS - 04 - LDWGWTT.flac
   SHXCXCHCXSH - STRGTHS - 05 - PCTSTSS.flac
   SHXCXCHCXSH - STRGTHS - 06 - WHTLGHT.flac
   SHXCXCHCXSH - STRGTHS - 07 - LLDTMPS.flac
c: SHXCXCHCXSH/[2013] STRGTHS/cover.jpg
(unpacked to /var/folders/bf/1f70gl7x2_g0s1dchcrw97xm0000gn/T/packard-fecf5c346649efb4/49901c567bc9ae3ba1ffa13358beec2e9e525950)

now archived:

/Users/ogd/Downloads/flac_SHXCXCHCXSH-STRGTHS.zip
  -> /Users/ogd/Downloads/archives/flac_SHXCXCHCXSH-STRGTHS.zip
```

Unpack a set of zipped files containing FLAC files and cover art,
organizing the files into releases and then moving them, along with
their cover art, into a staging directory. You can either pass the list
of files to be expanded as command-line arguments, or use `--root` and
`--pattern` together to have `packard unpac` generate the list of files
you (or you can do both).

If you want to move the files to an archival location after unpacking them,
use `--archive` and set an `--archive-root`.

Options:

* `--staging`, `-s` **required**: The staging directory into which the
  unpacked and renamed files should be placed.
* `--root`, `-R`: The top level of a directory hierarchy containing zip
  files.
* `--pattern`, `-P`: bash glob pattern to join with `root` to find zip files.
  Be sure to single-quote the pattern if you use this option!
* `--archive`: If set, move the unpacked files to `archive-root` after
  extraction.
* `--archive-root`: Where to put zip files after extraction. Files in
  `archive-root` will not be unpacked or moved.

### generate a .pls version 2 playlist, sorted by release date

```
$ packard pls
```

example run:

```
$ packard pls -R ~/Downloads/flac2 > ~/Downloads/dark-shadows.pls
WARN artists many dates found [ '2014-10-17', '2014' ]
WARN artists many album names found [ 'Serum' ]
WARN artists many dates found [ '2011-09-12', '2011' ]
WARN artists many album names found [ 'Carrier' ]
info pls Processing /Users/ogd/Downloads/flac2
info pls playlist generated with 275 entries
```

Read one or more directory trees containing media files, and then generate a
chronologically sorted playlist of all of the tracks in those trees, auditing
the files as they go. The playlist is a version 2 .pls file (which includes
track names and durations as well as locations), and will be printed to
standard output (a future version will let you specify the output file, but
redirection works well enough for me for now).

Options:

* `--root`: The root of an `artist/album/tracks` directory tree. This option
  may be used multiple times.

### generate a list of artists

```
$ packard artists
```

example run:

```
$ packard --root=~/Music/flac artists
Basic Channel [1318M]
<NAME> [2439M]
<NAME> [1671M]
Perc [1358M]
Shackleton [2257M]
```

Scan one or more directory trees recursively, printing out a list of the artist
names found, with the sizes of the tracks by that artist, in
[mebibytes](http://en.wikipedia.org/wiki/Mebibyte). This list, in this format,
can be fed into `packard`'s other commands.

Options:

* `--root`: The top level of a directory hierarchy, laid out in
  `root/Artist/Album` format. Can be used more than once.

## shared options

* `--loglevel` (_default: `info`_): `packard` uses `npmlog` (I know it,
  and it has excellent progress bar support). It takes the same log
  levels as npm: `error`, `warn`, `info`, `verbose`, and `silly`. It
  probably takes `http`, but there's no use for that. Yet.
* `--save-config`: Save this run's configuration to `~/.packardrc`.


## MIT License

The MIT License (MIT)

Copyright (c) 2015 <NAME> <<EMAIL>>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{'fraction_non_alphanumeric': 0.09498553519768563, 'fraction_numerical': 0.022468659594985535, 'mean_word_length': 4.002894356005789, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 17, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5639258', 'n_tokens_mistral': 3570, 'n_tokens_neox': 3249, 'n_words': 1339}