-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmissing_tags
More file actions
executable file
·39 lines (31 loc) · 916 Bytes
/
Copy pathmissing_tags
File metadata and controls
executable file
·39 lines (31 loc) · 916 Bytes
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
#!/usr/bin/env python3
from mpd import MPDClient
import os
client = MPDClient()
mpd_host = 'localhost'
mpd_port = '6600'
mpd_pass = ''
if 'MPD_HOST' in os.environ:
mpd_connection = os.environ['MPD_HOST'].split('@')
if len(mpd_connection) == 1:
mpd_host = mpd_connection[0]
elif len(mpd_connection) == 2:
mpd_host = mpd_connection[1]
mpd_pass = mpd_connection[0]
else:
print('Unable to parse MPD_HOST, using defaults')
if 'MPD_PORT' in os.environ:
mpd_port = os.environ['MPD_PORT']
client.connect(mpd_host, mpd_port)
if mpd_pass:
client.password(mpd_pass)
search=input("Which tag to search for? > ")
tagpool=client.search('filename', '')
for tag in tagpool:
newpool=[]
if 'directory' not in tag:
if search not in tag:
newpool.append(tag)
for entry in newpool:
if 'file' in entry:
print(entry['file'])