rekordbox-edit 0.4.0.dev18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rekordbox_edit/__init__.py +5 -0
- rekordbox_edit/_click.py +111 -0
- rekordbox_edit/cli.py +48 -0
- rekordbox_edit/commands/__init__.py +1 -0
- rekordbox_edit/commands/convert.py +574 -0
- rekordbox_edit/commands/search.py +117 -0
- rekordbox_edit/logger.py +109 -0
- rekordbox_edit/query.py +327 -0
- rekordbox_edit/utils.py +324 -0
- rekordbox_edit-0.4.0.dev18.dist-info/METADATA +264 -0
- rekordbox_edit-0.4.0.dev18.dist-info/RECORD +14 -0
- rekordbox_edit-0.4.0.dev18.dist-info/WHEEL +4 -0
- rekordbox_edit-0.4.0.dev18.dist-info/entry_points.txt +3 -0
- rekordbox_edit-0.4.0.dev18.dist-info/licenses/LICENSE +21 -0
rekordbox_edit/_click.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class PrintChoice(Enum):
|
|
7
|
+
SILENT = 0
|
|
8
|
+
IDS = 1
|
|
9
|
+
INFO = 2
|
|
10
|
+
DEBUG = 3
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
print_option = click.option(
|
|
14
|
+
"--print",
|
|
15
|
+
"print_opt", # avoid shadowing the print() function
|
|
16
|
+
default="info",
|
|
17
|
+
type=click.Choice(PrintChoice, case_sensitive=False),
|
|
18
|
+
help="Configures the kind of console output you want from the command, if any. The 'ids' option can be used to pipe a list of resulting content IDs into to another command.",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
track_ids_argument = click.argument("track-ids", type=str, required=False, nargs=-1)
|
|
22
|
+
|
|
23
|
+
global_click_filters = [
|
|
24
|
+
click.option(
|
|
25
|
+
"--track-id",
|
|
26
|
+
type=str,
|
|
27
|
+
multiple=True,
|
|
28
|
+
help="Filter by the given Database Track ID",
|
|
29
|
+
),
|
|
30
|
+
click.option(
|
|
31
|
+
"--title",
|
|
32
|
+
type=str,
|
|
33
|
+
multiple=True,
|
|
34
|
+
help="Find track names that include this value",
|
|
35
|
+
),
|
|
36
|
+
click.option(
|
|
37
|
+
"--exact-title",
|
|
38
|
+
type=str,
|
|
39
|
+
multiple=True,
|
|
40
|
+
help="Find track names that are exactly this value",
|
|
41
|
+
),
|
|
42
|
+
click.option(
|
|
43
|
+
"--playlist",
|
|
44
|
+
type=str,
|
|
45
|
+
multiple=True,
|
|
46
|
+
help="Find tracks in playlists whose names include this value",
|
|
47
|
+
),
|
|
48
|
+
click.option(
|
|
49
|
+
"--exact-playlist",
|
|
50
|
+
type=str,
|
|
51
|
+
multiple=True,
|
|
52
|
+
help="Find tracks in the plalist whose name is exactly this value",
|
|
53
|
+
),
|
|
54
|
+
click.option(
|
|
55
|
+
"--artist",
|
|
56
|
+
type=str,
|
|
57
|
+
multiple=True,
|
|
58
|
+
help="Find tracks whose Artist names include this value",
|
|
59
|
+
),
|
|
60
|
+
click.option(
|
|
61
|
+
"--exact-artist",
|
|
62
|
+
type=str,
|
|
63
|
+
multiple=True,
|
|
64
|
+
help="Find tracks whose Artists names are exactly this value",
|
|
65
|
+
),
|
|
66
|
+
click.option(
|
|
67
|
+
"--album",
|
|
68
|
+
type=str,
|
|
69
|
+
multiple=True,
|
|
70
|
+
help="Find tracks whose Album names include this value",
|
|
71
|
+
),
|
|
72
|
+
click.option(
|
|
73
|
+
"--exact-album",
|
|
74
|
+
type=str,
|
|
75
|
+
multiple=True,
|
|
76
|
+
help="Find tracks whose Album names are exactly this value",
|
|
77
|
+
),
|
|
78
|
+
click.option(
|
|
79
|
+
"--path",
|
|
80
|
+
type=str,
|
|
81
|
+
multiple=True,
|
|
82
|
+
help="Find tracks whose file paths include this value",
|
|
83
|
+
),
|
|
84
|
+
click.option(
|
|
85
|
+
"--exact-path",
|
|
86
|
+
type=str,
|
|
87
|
+
multiple=True,
|
|
88
|
+
help="Find tracks whose file paths are exactly this value",
|
|
89
|
+
),
|
|
90
|
+
click.option(
|
|
91
|
+
"--format",
|
|
92
|
+
type=click.Choice(["mp3", "flac", "aiff", "wav", "m4a"], case_sensitive=False),
|
|
93
|
+
multiple=True,
|
|
94
|
+
help="Find tracks of this format",
|
|
95
|
+
),
|
|
96
|
+
click.option(
|
|
97
|
+
"--match-all",
|
|
98
|
+
type=bool,
|
|
99
|
+
is_flag=True,
|
|
100
|
+
help="Results must match all given filters",
|
|
101
|
+
),
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def add_click_options(options):
|
|
106
|
+
def _add_options(func):
|
|
107
|
+
for option in reversed(options):
|
|
108
|
+
func = option(func)
|
|
109
|
+
return func
|
|
110
|
+
|
|
111
|
+
return _add_options
|
rekordbox_edit/cli.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Command line interface for rekordbox-edit."""
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
from rekordbox_edit.commands.convert import convert_command
|
|
10
|
+
from rekordbox_edit.commands.search import search_command
|
|
11
|
+
from rekordbox_edit.logger import get_debug_file_path, setup_logging
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@click.group(
|
|
17
|
+
epilog=f"Debug logs for each run can be found at:\n{get_debug_file_path().parent}"
|
|
18
|
+
)
|
|
19
|
+
@click.version_option()
|
|
20
|
+
def cli():
|
|
21
|
+
"""RekordBox Bulk Edit - Tools for bulk editing RekordBox database records."""
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
cli.add_command(search_command)
|
|
26
|
+
cli.add_command(
|
|
27
|
+
convert_command,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def main():
|
|
32
|
+
"""Entry point for the CLI."""
|
|
33
|
+
try:
|
|
34
|
+
setup_logging()
|
|
35
|
+
logger.debug(f"Running with input: {' '.join(sys.argv)}")
|
|
36
|
+
cli()
|
|
37
|
+
except KeyboardInterrupt:
|
|
38
|
+
logger.debug("User killed the process.")
|
|
39
|
+
except Exception as e:
|
|
40
|
+
logger.critical("Unhandled exception occured:", exc_info=e)
|
|
41
|
+
logger.info(
|
|
42
|
+
f"Please report this issue to https://github.com/jviall/rekordbox-edit/issues with the debug file for this run: {get_debug_file_path().absolute().as_uri()}",
|
|
43
|
+
)
|
|
44
|
+
sys.exit(1)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Commands package for rekordbox-edit."""
|