Skip to content

Commit ae05ec3

Browse files
committed
docs: add usage docs to the readme
1 parent e496e7c commit ae05ec3

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

README.rst

+54
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,58 @@ Moe is our resident Music-Organizer-Extraordinaire who's sole purpose is to give
55

66
In short, Moe maintains a database of your music library that can be updated with various metadata sources, queried, edited, etc. through either an API or command-line interface. All of these features, and more, are made available by a highly extensible plugin ecosystem.
77

8+
Usage
9+
=====
10+
Moe comes with a command-line interface which is how most users will take advantage of the library management features. Below is a screenshot of Moe importing an album from the filesystem and adding it to the underlying database all while fixing tags, relocating the files, and anything else you can imagine.
11+
12+
.. image:: _static/import_example.png
13+
14+
Alternatively, because all the core functionality is available via an API, the underlying music management system can be incorporated into any existing program or other user interface.
15+
16+
Finally, although a lot of Moe's functionality exists around the idea of operating on a library database of your music, the database is entirely optional. In this case, Moe provides a convenient set of tools and functionality for handling music in a general sense. For example, below is a standalone python script that takes an album directory and Musicbrainz release ID from the command-line, and then updates the underlying files' tags with any changes from Musicbrainz.
17+
18+
.. code:: python
19+
20+
#!/usr/bin/env python3
21+
22+
import argparse
23+
import pathlib
24+
25+
import moe.plugins.musicbrainz as moe_mb
26+
from moe.config import Config, ConfigValidationError
27+
from moe.library import Album
28+
from moe.plugins.write import write_tags
29+
30+
31+
def main():
32+
try:
33+
Config(init_db=False)
34+
except ConfigValidationError as err:
35+
raise SystemExit(1) from err
36+
37+
parser = argparse.ArgumentParser(
38+
description="Update an album with musicbrainz tags."
39+
)
40+
parser.add_argument("path", help="dir of the album to update")
41+
parser.add_argument("mb_id", help="musicbrainz id of the album to fetch")
42+
args = parser.parse_args()
43+
44+
album = Album.from_dir(pathlib.Path(args.path))
45+
46+
album.merge(moe_mb.get_album_by_id(args.mb_id), overwrite=True)
47+
48+
for track in album.tracks:
49+
write_tags(track)
50+
51+
52+
if __name__ == "__main__":
53+
main()
54+
55+
.. note::
56+
57+
Notice the use of ``init_db=False`` when initializing the configuration to tell Moe you don't want to use or create a database file.
58+
59+
60+
This is just a small taste of what Moe is capable of and how it can make your life easier when dealing with music in Python. Stop re-inventing the wheel; use Moe.
61+
862
If you want to learn more, check out the `Getting Started <https://mrmoe.readthedocs.io/en/latest/getting_started.html>`_ docs.

_static/import_example.png

76.5 KB
Loading

docs/_static/import_example.png

76.5 KB
Loading

0 commit comments

Comments
 (0)