Skip to content

Commit

Permalink
replace JS with Python to simplify install; cleanup everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Schweinepriester committed Jul 4, 2020
1 parent 480465a commit ceda8f2
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 93 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# node
node_modules

# idea
.idea

venv
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# beets-config

Config for https://github.com/beetbox/beets
Config for <https://github.com/beetbox/beets>

## Currently used commands

Expand All @@ -9,28 +9,25 @@ Config for https://github.com/beetbox/beets

## Install

1. [Install beets](http://beets.readthedocs.org/page/guides/main.html#installing) (we also need `pip`)
1. [Install Node.js (which includes npm)](https://nodejs.org)
1. [Install ImageMagick](http://imagemagick.org)
1. Create a folder somewhere, e.g. `…/beets`
1. Clone or [download](https://github.com/Schweinepriester/beets-config/releases) beets-config and put it in a folder (e.g. `beets-config`) in the newly created folder `…/beets`
1. Open your favorite shell (bash, powershell, …) and navigate to `…/beets/beets-config`)
1. [Install beets](https://beets.readthedocs.org/page/guides/main.html#installing) (we also need `pip`)
1. [Install ImageMagick](https://imagemagick.org)
1. Create a folder somewhere, e.g. `/beets`
1. Clone or [download](https://github.com/Schweinepriester/beets-config/releases) beets-config and put it in a folder (e.g. `beets-config`) in the newly created folder `/beets`
1. Open your favorite shell (Bash, PowerShell, …) and navigate to `/beets/beets-config`)
1. Install dependencies for several beets plugins: `pip install -r beets-config_requirements.txt`
1. Run `npm install`
1. [Install gulp globally: `npm install --global gulp`](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md#1-install-gulp-globally)
1. Create `…/beets/customconfig.yaml` and configure all properties you want to replace, probably at least `directory` and `library`, e.g.
1. Create `/beets/customconfig.yaml` and configure all properties you want to replace, probably at least `directory` and `library`, e.g.

```
directory: F:\Audio\Mediathek\Musik
library: E:\beets\musiclibrary.db
```
1. Run `gulp` (in `/beets/beets-config`)
1. [Set `BEETSDIR` to the created folder `/beets/beetsdir`](https://beets.readthedocs.org/en/stable/reference/config.html#configuration-location)
- Windows: Set as user variable
1. Check loaded config: Type `beet config -p` to see the path on your system
1. If it prints the path to `/beets/beetsdir/config.yaml` you are all set! :)
1. Run `python .\build.py` (in `/beets/beets-config`)
1. [Set `BEETSDIR` to the created folder `/beets/beetsdir`](https://beets.readthedocs.org/en/stable/reference/config.html#configuration-location)
- Windows: Set as user variable
1. Check loaded config: `beet config -p` to see the path on your system
1. If the path to `/beets/beetsdir/config.yaml` is printed you are all set! :)
1. Optional
1. Install `unrar` for extracting RAR-archives
- <http://www.rarlab.com/rar_add.htm>
- <https://rarfile.readthedocs.org/en/latest/faq.html#how-can-i-get-it-work-on-windows>
1. Install `unrar` for extracting RAR-archives
- <https://www.rarlab.com/rar_add.htm>
- <https://rarfile.readthedocs.org/en/latest/faq.html#how-can-i-get-it-work-on-windows>
2 changes: 2 additions & 0 deletions beets-config_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pyyaml # build.py

requests # fetchart, lyrics
pylast # lastgenre
discogs-client # discogs
Expand Down
11 changes: 0 additions & 11 deletions best practice tagging

This file was deleted.

22 changes: 22 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import yaml
import re

fConfigMaster = open("./config.yaml", "rt")
fOut = open("../beetsdir/config.yaml", "wt", newline="")

with open("../customconfig.yaml", "rt") as stream:
dataConfigOwn = yaml.safe_load(stream)

for line in fConfigMaster:
prog = re.compile("@(.*)@")
match = prog.search(line)
sOut = line
if match:
data = dataConfigOwn.get(match.group(1))
if data:
# TODO doesnt work if the # isnt the first char in the line, e.g. with indent, for example ` #google_API_key: @google_API_key@`
sOut = line[1:].replace(match.group(), data)
fOut.write(sOut)

fConfigMaster.close()
fOut.close()
32 changes: 0 additions & 32 deletions gulpfile.js

This file was deleted.

29 changes: 0 additions & 29 deletions package.json

This file was deleted.

0 comments on commit ceda8f2

Please sign in to comment.