lsdj_tools/lib.rs
1//! # lsdj-tools
2//!
3//! [LittleSoundDj](https://www.littlesounddj.com/lsd/index.php), or _LSDJ_ for short, is popular music tracker software for the original [Nintendo Game Boy](https://en.wikipedia.org/wiki/Game_Boy). While the handheld console originally was released in 1989, ([chiptune](https://en.wikipedia.org/wiki/Chiptune)) musicians still use its hardware to create and perform electronic music nowadays.
4//!
5//! While LSDJ has a built-in filesystem for managing tracks, you need tools to get out the individual files for back-ups or constructing new save files from exported tracks. This crate provides a command-line utility that does exactly that.
6//!
7//! ## Inspect
8//!
9//! Inspect LSDJ .sav and .lsdsng files, or even entire directories for their contents
10//!
11//! ```console
12//! USAGE:
13//! lsdj-tools inspect [OPTIONS] [PATH]...
14//!
15//! ARGS:
16//! <PATH>... The path(s) to inspect
17//!
18//! OPTIONS:
19//! -h, --help Print help information
20//! -r, --recursive Search the folder recursively
21//! -V, --version Print version information
22//! ```
23//!
24//! ### Example
25//!
26//! ```console
27//! 4ntler@mbp > lsdj-tools inspect bangers.sav
28//! Mem 144/192 [================== ]
29//! 0 | YOKAI | v027 | f005
30//! 1 | ASPHALT | v019 | f005
31//! 2 | NEWSHOES | v014 | f005
32//! 3 | FUNGAL | v019 | f005
33//! 4 | LOGCBN | v015 | f005
34//! 5 | NOSTALGA | v031 | f005
35//! 6 | GJITSU | v026 | f005
36//! 7 | PRISTINE | v016 | f005
37//! 8 | KALEIDO | v024 | f005
38//! 9 | CACTUAR | v046 | f005
39//! 10 | DODGBALL | v018 | f005
40//! 11 | DNTSWEAT | v025 | f005
41//! 12 | HONEY | v031 | f005
42//! ```
43//!
44//! ## Export
45//!
46//! Export .lsdsng's from .sav files
47//!
48//! ```console
49//! USAGE:
50//! lsdj-tools export [OPTIONS] <PATH> [INDEX]...
51//!
52//! ARGS:
53//! <PATH> The path to the save file to export from
54//! <INDEX>... Indices of the songs that should be exported. No indices means all songs
55//!
56//! OPTIONS:
57//! -d, --decimal Use decimal version numbers, instead of hexadecimal
58//! -h, --help Print help information
59//! -o, --output <OUTPUT> The destination folder to place the songs
60//! -p, --output-pos Prepend the song position to the start of the filename
61//! -v, --output-version Append the song version to the end of the filename
62//! -V, --version Print version information
63//! ```
64//!
65//! ### Example
66//!
67//! ```console
68//! 4ntler@mbp > lsdj-tools export -pv bangers.sav
69//! 00. YOKAI => 00_YOKAI_v1B.lsdsng
70//! 01. ASPHALT => 01_ASPHALT_v13.lsdsng
71//! 02. NEWSHOES => 02_NEWSHOES_v0E.lsdsng
72//! 03. FUNGAL => 03_FUNGAL_v13.lsdsng
73//! 04. LOGCBN => 04_LOGCBN_v0F.lsdsng
74//! 05. NOSTALGA => 05_NOSTALGA_v1F.lsdsng
75//! 06. GJITSU => 06_GJITSU_v1A.lsdsng
76//! 07. PRISTINE => 07_PRISTINE_v10.lsdsng
77//! 08. KALEIDO => 08_KALEIDO_v18.lsdsng
78//! 09. CACTUAR => 09_CACTUAR_v2E.lsdsng
79//! 10. DODGBALL => 10_DODGBALL_v12.lsdsng
80//! 11. DNTSWEAT => 11_DNTSWEAT_v19.lsdsng
81//! 12. HONEY => 12_HONEY_v1F.lsdsng
82//! ```
83//!
84//! ## Import
85//!
86//! Import .lsdsng's into a .sav file
87//!
88//! ```console
89//! USAGE:
90//! lsdj-tools import --output <OUTPUT> [SONG]...
91//!
92//! ARGS:
93//! <SONG>... Paths to the songs that should be imported into a save
94//!
95//! OPTIONS:
96//! -h, --help Print help information
97//! -o, --output <OUTPUT> The output path
98//! -V, --version Print version information
99//! ```
100//!
101//! ### Example
102//!
103//! ```console
104//! 4ntler@mbp > lsdj-tools import banger1.lsdsng banger2.lsdsng -o ./test.sav
105//! 00 => banger1.lsdsng
106//! 01 => banger2.lsdsng
107//! Wrote test.sav
108//! ```
109//!
110//! ## Collect
111//!
112//! Collect goes through a set of files and folders, and matches songs together by their name.
113//!
114//! It then lists all versions it has found per song, and in which file it has found them.
115//!
116//! The second column shows a SHA-256 hash of the song contents, to be able to compare them to other versions.
117//!
118//! Collect is also capable of writing this data to a json file instead.
119//!
120//! ```console
121//! Usage: lsdj-tools collect [OPTIONS] [PATHS]...
122//!
123//! Arguments:
124//! [PATHS]...
125//! The paths to walk and check for songs
126//!
127//! Options:
128//! -r, --recursive
129//! Should folders be walked recursively
130//!
131//! --json <JSON>
132//! A JSON file the outcome should be written to
133//!
134//! -h, --help
135//! Print help (see a summary with '-h')
136//!
137//! -V, --version
138//! Print version
139//! ```
140//!
141//! ### Example
142//!
143//! ```console
144//! 4ntler@mbp > lsdj-tools collect ./best_songs_ever
145//! BREATHE
146//! v003 86 /usr/best_songs_ever/lsdj9_2_L.sav[0]
147//! v002 43 /usr/best_songs_ever/lsdj9_2_A.sav[0]
148//!
149//! SUN
150//! v004 f3 /usr/best_songs_ever/lsdj9_4_0_sun.sav[1]
151//! v004 f3 /usr/best_songs_ever/lsdj9_4_0.sav[1]
152//! ```
153
154pub mod collect;
155pub mod export;
156pub mod import;
157pub mod inspect;
158pub(crate) mod utils;