-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
136 lines (125 loc) · 4.59 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import curses
from datetime import date, timedelta
#Database directory. Must match MPD music directories (multiple dirs not supported by MPD anyway)
db_dir = ["/home/guillermo/bach/Music/all-music"]
#db_dir = ["/home/guillermo/programming/music-player/test-music"]
playlists_dir = "/home/guillermo/programming/music-player/playlists"
install_dir = "/home/guillermo/programming/music-player"
#Keybindings
number_keys = [ord(str(num)) for num in range(9)]
#recent days
dates = [str(date.today() - timedelta(days=i)) for i in range(20)]
mvmt_keys = {
'j': 'move_down',
'k': 'move_up',
'h': 'move_left',
'l': 'move_right',
'n': 'play_track',
't': 'jump_to_track_pane',
's': 'toggle_random',
'f': 'search_mode',
'\x1b': 'reset_tab',
' ': 'select_track',
'm': 'add_to_playlist_pane',
'\n': 'add_to_playlist',
'.': 'skip_down_pane',
',': 'skip_up_pane',
'r': 'remove_tracks'
}
#Interface configuration
ui_config = {
'SCRLL-TH': 8,
'refresh-delay': 15
}
tabs_config = [
{
'tab-type': "SINGLE",
'include-only': ["composer", ["Bach"]],
'exclude': [None, None]
},
{
'tab-type': "4-PANE",
'include-only': ["composer", ["Bach"]],
'exclude': [None, None],
'filter-keys': ["genre", "album", "performer", "TRACK"],
'pane-titles': ["Genre", "Work", "Performer", None]
},
{
'tab-type': "3-PANE",
'include-only': ["composer", ["Bach"]],
'exclude': [None, None],
'filter-keys': ["performer", "album", "TRACK"],
'pane-titles': ["Performer", "Work", None]
},
{
'tab-type': "3-PANE",
'include-only': [None, None],
'exclude': ["composer", ["Bach"]],
'filter-keys': ["artist", "album", "TRACK"],
'pane-titles': ["Artist", "Album", None]
},
{
'tab-type': "3-PANE",
'include-only': [None, None],
'exclude': ["composer", ["Bach"]],
'filter-keys': ["genre", "album", "TRACK"],
'pane-titles': ["Genre", "Album", None]
},
{
'tab-type': "2-PANE",
'include-only': [None, None],
'exclude': ["composer", ["Bach"]],
'filter-keys': ["album", "TRACK"],
'pane-titles': ["Album", None]
},
{
'tab-type': "3-PANE",
'include-only': ["PLAYLISTS", None],
'exclude': [None, None],
'filter-keys': ["PLAYLIST", "album", "TRACK"],
'pane-titles': ["Playlist", "Album/Work", None]
},
{
'tab-type': "2-PANE",
'include-only': ["last-modified", dates],
'exclude': [None, None],
'filter-keys': ["album", "TRACK"],
'pane-titles': ["Album/Work", None]
}
]
#Example Tab Config
#tabs_config = [
# {
# 'tab-type': "3-PANE",
# 'include-only': [None, None],
# 'exclude': ["COMPOSER", ["Bach"]],
# 'filter-keys': ["ARTIST", "ALBUM", "TRACK"],
# 'pane-titles': ["Artist", "Album", None]
# },
# {
# 'tab-type': "PLAYLIST"
# },
# {
# 'tab-type': "2-PANE",
# 'include-only': ["PLAYLISTS", None],
# 'exclude': [None, None],
# 'filter-keys': ["PLAYLIST", "TRACK"],
# 'pane-titles': ["Playlist", None]
# }
# ]
#Curses settings
def load_curses_config(stdscr):
curses.curs_set(False)
stdscr.nodelay(0)
curses.start_color()
curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
curses.init_pair(3, curses.COLOR_BLACK, 124)
curses.init_pair(4, curses.COLOR_BLACK, curses.COLOR_WHITE)
curses.init_pair(5, curses.COLOR_BLACK, 124)
curses.init_pair(6, 124, curses.COLOR_BLACK) #list cursor color
curses.init_pair(7, curses.COLOR_BLACK, curses.COLOR_WHITE) #selected tracks
curses.init_pair(8, 232, 235)
############
#Don't touch
mvmt_keys = {ord(k): v for k, v in mvmt_keys.items()}