Skip to content

Commit 9f9dfe2

Browse files
committed
completed docs(todo: fix link in readme.md)
1 parent 16f82fe commit 9f9dfe2

File tree

8 files changed

+173
-93
lines changed

8 files changed

+173
-93
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ CHANGELOG
44
v0.7.0
55
------
66

7+
- [ ] Create docs
8+
- [ ] Add unit tests
79
- [x] Batch tag files
810
- [ ] Customizable keybindings
11+
- [ ] Refactor the whole codebase
912
- [ ] Autocomplete in genre tag field
1013
- [x] Filename field in tag editing view
1114
- [ ] Short description of preferences option in status line

README.md

Lines changed: 38 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,13 @@
11
# clid
22

3-
Clid is a command line app written in Python3 for command-line lovers to edit mp3 files' ID3 tags. This app is different from other
4-
command line tools to edit tags, as you can edit tags in a graphical interface.(It's like [cmus](https://github.com/cmus/cmus),
5-
without the player and with a tag editor)
6-
7-
Made with a lot of help from
8-
9-
- [npyscreen](https://bitbucket.org/npcole/npyscreen), a Python wrapper around ncurses.
10-
- [stagger](https://github.com/lorentey/stagger), an ID3v1/ID3v2 tag manipulation package written in pure Python 3
11-
- [configobj](https://github.com/DiffSK/configobj), a Python 3+ compatible port of the configobj library
12-
- and a laptop with 512 MB RAM(Yeah. I know.)
13-
14-
## Changelog
15-
16-
### v0.6.3
17-
18-
- [x] Vi keybindings
19-
- [x] Added option for smooth scroll
20-
- [x] Preferences are now saved when updating the app
21-
- [x] Validators for `smooth_scroll` and `preview_format`
22-
- [x] Display a "What's New" Popup when app is run after an update
23-
24-
### v0.6.2
25-
26-
- [x] Fix: Issue #1 in Github
27-
- [x] Added key-binding(`u`) for reloading `music_dir`
28-
- [x] Fix: All option are now aligned properly in preferences view
29-
- [x] Added validators for preferences(Error message is shown if an error occurs)
3+
Clid is a command line app for editing tags of mp3 files. Clid is different from other
4+
command line tools to edit tags, as you can edit tags in a curses based ui.
305

6+
![clid main window](main.png "Main Window")
317

328
## Installation
339

34-
> Note: You should have Python 3 installed, not Python 2, to install and use clid.
35-
36-
> Note: You will have to install pip manually if the Python version is < 3.4
37-
10+
See wiki for detailed installation instructions.<!--link-->
3811

3912
### Using pip
4013

@@ -50,53 +23,54 @@ $ cd clid
5023
$ [sudo] python3 setup.py install
5124
```
5225

53-
You can then launch the app by entering `clid` in the command line.
54-
26+
### Updating
5527

56-
## Usage
28+
To update the app, run
5729

58-
### Viewing Files
30+
```shell
31+
$ [sudo] pip install -U clid
32+
```
5933

60-
The main window will show the mp3 files you have in `~/Music`. The interface is similar to that of cmus:
34+
You can launch the app by entering `clid` in the command line.
6135

62-
![clid main window](./img/main.png "Main Window")
36+
## Usage
6337

64-
You will have a command line at the bottom of the window, to recieve commands. You will also see a live preview of the
65-
common tags of the file under the cursor.
38+
### Quick Start
6639

67-
> Note: The status line shows the tags in `artist - album - track_number title` format by default; you can change it in preferences
40+
1. Move with arrow keys or `j` and `k`.
41+
2. <kbd>Enter</kbd> to select a file.
42+
3. Edit the tags.
43+
4. `OK` to save the tags or `Cancel` to abort edit.
44+
5. Type `:q` at main window to quit.
6845

69-
### Editing Tags
46+
See the [wiki](#docs/docs/index.md) for documentation and additional details.
47+
<!--Real link-->
7048

71-
To edit the tags of a file, simply hit <kbd>Enter</kbd>(or <kbd>Return</kbd>). You will see a new window:
49+
## Changelog
7250

73-
![clid tag edit](./img/edit.png "Tag Editing Window")
51+
### v0.6.3
7452

75-
Use the arrow keys to move through the tags; edit them if needed and hit `OK`(or <kbd>Ctrl</kbd> + <kbd>S</kbd>) when you're done. `Cancel`(<kbd>Ctrl</kbd> + <kbd>Q</kbd>) will discard changes.
53+
- [x] Vi keybindings
54+
- [x] Added option for smooth scroll
55+
- [x] Preferences are now saved when updating the app
56+
- [x] Validators for `smooth_scroll` and `preview_format`
57+
- [x] Display a "What's New" Popup when app is run after an update
7658

59+
### v0.6.2
7760

78-
### Editing Preferences
61+
- [x] Fix: Issue #1 in Github
62+
- [x] Added key-binding(`u`) for reloading `music_dir`
63+
- [x] Fix: All option are now aligned properly in preferences view
64+
- [x] Added validators for preferences(Error message is shown if an error occurs)
7965

80-
To edit preferences, press `2`. Then hit <kbd>Enter</kbd> on the highlighted setting to edit it (it will be then shown
81-
at the bottom of the screen; edit it and hit <kbd>Enter</kbd> again).
66+
## Thanks
8267

83-
![clid preferences](./img/pref.png "Preferences Window")
68+
I couldn't have made this app without these amazing libraries...
8469

85-
| Option | Description | Default Value|
86-
|--------|-------|---------|
87-
| `music_dir` | Directory in which the app will search for mp3 files | `~/Music` |
88-
| `preview_format` | Format in which a preview of the file under cursor will be shown | `%a - %l - %n. %t` |
89-
| `smooth_scroll` | Enable or disable smooth scroll | `true` |
90-
| `vim_mode` | Enable or disable Vim keybindings when editing metadata | `false` |
70+
- [npyscreen](https://bitbucket.org/npcole/npyscreen), a Python wrapper around ncurses.
71+
- [stagger](https://github.com/lorentey/stagger), an ID3v1/ID3v2 tag manipulation package written in pure Python 3
72+
- [configobj](https://github.com/DiffSK/configobj), a Python 3+ compatible port of the configobj library
9173

92-
#### Supported Format Specifiers
74+
...And my dear laptop with 512 MB RAM ;)
9375

94-
| Format Specifier | Expands to... |
95-
|:----------------:|:-------------:|
96-
| %t | Title |
97-
| %a | Artist |
98-
| %l | Album |
99-
| %n | Track Number |
100-
| %c | Comment |
101-
| %A | Album Artist |
102-
| %y | Date |
76+
Enjoy!

clid/base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@ class ClidActionController(npy.ActionControllerSimple):
1414
"""Base class for the command line at the bottom of the screen"""
1515

1616
def create(self):
17-
self.add_action('^:q$', self.exit_app, live=False) # quit with ':q'
17+
self.add_action('^:q$', lambda *args, **kwargs: exit(), live=False) # quit with ':q'
1818
self.add_action('^:set .+', self.change_setting, live=False)
1919

20-
21-
def exit_app(self, command_line, widget_proxy, live):
22-
"""Exit the app with ':q'"""
23-
exit() # args are used internally by npyscreen
24-
2520
def change_setting(self, command_line, widget_proxy, live):
2621
"""Change a setting in the ini file"""
2722
pass # different for main and pref view; defined in respective files

clid/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
__version__ = '0.6.3'
3+
__version__ = '0.7.0'
44

55
import os
66
import curses
@@ -32,7 +32,6 @@ def change_setting(self, command_line, widget_proxy, live):
3232
setting = command_line[5:].split(sep='=')
3333
pref_form = self.parent.parentApp.getForm("SETTINGS")
3434
pref_form.value.change_setting(setting[0], setting[1]) # writes to the ini file
35-
pref_form.value.when_changed[setting[0]]()
3635

3736
pref_form.load_pref()
3837
pref_form.wMain.display()
@@ -119,6 +118,7 @@ def h_cursor_page_up(self, char):
119118
@special_handler
120119
def h_cursor_page_down(self, char):
121120
super().h_cursor_page_down(char)
121+
self.parent._resize()
122122

123123
@special_handler
124124
def h_cursor_line_up(self, char):
@@ -268,6 +268,7 @@ class ClidApp(npy.NPSAppManaged):
268268
settings(configobj.ConfigObj):
269269
object used to read and write preferences
270270
"""
271+
271272
def __init__(self, *args, **kwargs):
272273
super().__init__(*args, **kwargs)
273274
self.current_files = [] # changed when a file is selected in main screen

docs/docs/batch_tag_edit.png

2.76 KB
Loading

docs/docs/batch_tag_main.png

-97.7 KB
Loading

docs/docs/index.md

Lines changed: 128 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# clid
22

3-
Clid is an app for those whose home is the terminal and can't live without a well organized music collection :)
4-
With clid, you can edit the metadata(tags) of mp3 files, right from the terminal. Awesome ? Let's get started !
3+
Clid is an app for editing metadata(tags) of mp3 files without leaving the coziness of the terminal ;)
4+
Clid differs from other command line tools to edit tags, as it provides a curses based ui.
55

66
## Installation
77

@@ -29,50 +29,71 @@ $ cd clid
2929
$ [sudo] python3 setup.py install
3030
```
3131

32+
### Updating
33+
34+
To update the app, run
35+
36+
```shell
37+
$ [sudo] pip install -U clid
38+
```
39+
3240
## Launching The App
3341

34-
Enter `clid` in the command line to start the app:
42+
Type `clid` in the command line to start the app(and `:q` in the main window to quit):
3543

3644
![clid main window](main.png "Main Window")
3745

38-
What do ya think, eh ?
39-
4046
## Quick Start
4147

42-
The basics are simple:
4348
1. Move with arrow keys or `j` and `k`.
4449
2. <kbd>Enter</kbd> to select a file.
4550
3. Edit the tags.
4651
4. `OK` to save the tags or `Cancel` to abort edit.
52+
5. Type `:q` at main window to quit.
4753

4854
## Main Window
4955

5056
Main window has 3 parts:
5157

5258
![clid main annnotated](main_annotated.png)
5359

54-
<!--link-->
55-
1. File viewer, showing files in `~/Music` by default,
56-
2. Status line , showing live preview of tags of file under cursor,
57-
3. Command line, which accepts commands.
58-
60+
1. [File viewer](#file-viewer), showing files in `~/Music` by default,
61+
2. [Status line](#status-line), showing live preview of tags of file under cursor,
62+
3. [Command line](#command-line), which accepts commands.
5963

6064
### File Viewer
6165

62-
You can see the mp3 files in the selected directory<!--link--> in the main window. You can use <kbd>UpArrow</kbd>,
63-
<kbd>DownArrow</kbd>, <kbd>j</kbd>, <kbd>k</kbd>, <kbd>Home</kbd>, <kbd>PageUp</kbd>, etc to move around.
64-
Hit <kbd>Enter</kbd> when you've found the file you want to edit, or batch tag files<!--link-->. You can also search
65-
for files<!--link-->.
66+
You can see the mp3 files in the [selected directory](#list-of-available-options) in the main window.
67+
Files are read every time the app is started. You can use <kbd>UpArrow</kbd>, <kbd>DownArrow</kbd>,
68+
<kbd>j</kbd>, <kbd>k</kbd>, <kbd>Home</kbd>, <kbd>PageUp</kbd>, etc to move around. Hit <kbd>Enter</kbd>
69+
when you've found the file you want to edit, or [batch tag files](#tagging-multiple-files-at-once).
70+
You can also [search for files](#searching-for-files).
71+
72+
#### Searching For Files
73+
74+
You can search for files by pressing <kbd>/</kbd>. Note that this is only a basic search - it doesn't search the tags
75+
of every file, only the filename is checked.
76+
77+
1. Press <kbd>/</kbd>.
78+
2. Enter the search term. Results are shown as you type.
79+
3. Press <kbd>Enter</kbd> to terminate search and navigate search results.
80+
4. Press <kbd>Esc</kbd> to return to normal view.
81+
82+
Your selections for batch tagginf(if any) are kept intact when searching.
83+
[See a note](#esc-key) on the <kbd>Esc</kbd> key.
6684

6785
### Status Line
6886

69-
The status line shows a live preview of metadata of file under cursor in the specified format<!--link-->.
70-
The default format is `artist - album - track_number title`.
87+
![tag preview](tag_preview_default.png)
88+
89+
The status line shows a live preview of metadata of file under cursor in the
90+
[specified format](#customizing-tag-preview-format). The default format is
91+
`artist - album - track_number title`.
7192

7293
### Command Line
7394

74-
You can execute commands and perform searches from here. Press `:` to enter commands<!--link--> and
75-
`/` to search<!--link--> for files
95+
You can execute commands and perform searches from here. Press `:` to enter [commands](#available-commands)
96+
and `/` to [search for files](#searching-for-files).
7697

7798
## Editing Tags
7899

@@ -91,16 +112,102 @@ saving tags is <kbd>Ctrl</kbd> + <kbd>S</kbd> and canceling is <kbd>Ctrl</kbd> +
91112
You can batch tag files in clid:
92113

93114
1. Select and deselect files with <kbd>Space</kbd> and press <kbd>Enter</kbd> to edit the files. *Note that
94-
pressing <kbd>Enter</kbd> will also add the file currently under the cursor to list of files that will be edited*.
115+
pressing <kbd>Enter</kbd> will also add the file currently under the cursor to list of files that will be edited*. You can also search for files and then add them to the list of files to be edited.
116+
117+
> Note: Press <kbd>Esc</kbd> to discard selections. [See a note](#esc-key) on the <kbd>Esc</kbd> key.
118+
119+
![clid batch tag selecting](batch_tag_main.png)
95120

96121
2. You will see a window with blank tag fields. Only the tag fields which you modify here will be saved to the
97122
files, that is, if this is what you have,
98123

99124
![clid batch tagging](batch_tag_edit.png)
100125

101-
then
126+
then since Album and Artist are the only fields with text, only those will be written to the selected mp3 files.
102127

103128
3. You can save or cancel as mentioned above.
104129

130+
## Editing Preferences
131+
132+
> Config file is located at `~/.config/clid/clid.ini`.
133+
134+
You can edit preferences by pressing <kbd>2</kbd>.
135+
136+
1. Select the option you want to edit and press <kbd>Enter</kbd>.
137+
2. There will be a prompt in the command line; edit the option and press <kbd>Enter</kbd>.
138+
3. If you gave an invalid value, an error message will be shown.
139+
140+
### List Of Available Options
141+
142+
| Option | Description | Default Value | Acceptable Values |
143+
|:--------:|-------|:---------:|----------|
144+
| `music_dir` | Directory in which the app will search for mp3 files recursively | `~/Music` | Any valid path
145+
| `preview_format` | Format in which a preview of the file under cursor will be shown | `%a - %l - %n. %t` | See [list of valid format specifiers](#customizing-tag-preview-format)
146+
| `smooth_scroll` | Enable or disable smooth scroll | `true` | `true` / `false`
147+
| `vim_mode` | Enable or disable Vim style keybindings | `false` | `true` / `false`
148+
149+
#### Vim Mode
150+
151+
Vim style keybindings can be enabled, which currently supports basic stuff like adding, inserting and deleting text.
152+
[See a note](#esc-key) on the <kbd>Esc</kbd> key.
153+
154+
#### Customizing Tag Preview Format
155+
156+
The preview format can be edited using format specifiers:
157+
158+
| Format Specifier | Expands to... |
159+
|:----------------:|:-------------:|
160+
| %t | Title |
161+
| %a | Artist |
162+
| %l | Album |
163+
| %n | Track Number |
164+
| %c | Comment |
165+
| %A | Album Artist |
166+
| %y | Date |
167+
168+
Example: `%a - %l [%n] %t (%y)` expands to `Artist - Album [Track Number] Title (Date)`
169+
170+
## Default Keybindings
171+
172+
| Action | Key | Context |
173+
|:------|:---:|:-------|
174+
| Move Up | `k`, `UpArrow` | Preferences / Main View |
175+
| Move Down | 'j', `DownArrow` | Preferences / Main View |
176+
| Select file for editing / select option to be edited | `Enter`, `x` | Preferences / Main View |
177+
| Switch to Main View | `1` | Preferences |
178+
| Select files | `Space` | Main View |
179+
| Switch to Preferences | `2` | Main View |
180+
| Reload mp3 files in current directory | `u` | Main View |
181+
| Discard selection | `Esc` | Main View(after selecting for batch tagging) |
182+
| Discard search results and show all files | `Esc` | Main View(after searching) |
183+
| Save changes | `Ctrl + S` | Meta Editing Window |
184+
| Discard changes | `Ctrl + Q` | Meta Editing Window |
185+
186+
## Available Commands
187+
188+
Press `:` to start entering commands
189+
190+
`set <option name>=<value>`
191+
Set the option(from preferences) to value
192+
193+
`q`
194+
Quit the app
195+
196+
## Miscellaneous
197+
198+
### Esc Key
199+
200+
The `Esc` key is a bit sluggish. It seems to be a problem with one of the dependencies.
201+
When `vim_mode` is enabled, pressing `Esc` after editing text to enter Normal mode
202+
will take some time(just a bit).
203+
204+
Discarding search results and selection are both bound to the `Esc`. When `Esc` is pressed
205+
in Main View, clid first checks if there are any search results being displayed. If there are
206+
any, that is cleared *first* and no further actions are taken. If there are no search results,
207+
*then* file selections are discarded. This ensures that you can search for files, add them
208+
to file selection list, and return to Main View with the selection list intact.
105209

210+
### What's New
106211

212+
When clid is updated a "What's New" window is shown. Contents of `~/.config/clid/NEW` are
213+
shown in it.

docs/docs/tag_preview_default.png

25.4 KB
Loading

0 commit comments

Comments
 (0)