mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 04:55:10 +01:00
added bpd command to bts.py
--HG-- extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4099
This commit is contained in:
parent
e9fdac1293
commit
07974753e6
2 changed files with 16 additions and 4 deletions
|
|
@ -99,7 +99,7 @@ class Server(object):
|
|||
value = int(value)
|
||||
except:
|
||||
return ErrorResponse(ERROR_ARG, name, 'non-integer argument')
|
||||
if (minval is not None and value < minval) or
|
||||
if (minval is not None and value < minval) or \
|
||||
(maxval is not None and value > maxval):
|
||||
return ErrorResponse(ERROR_ARG, name, 'value out of range')
|
||||
else:
|
||||
|
|
@ -409,10 +409,10 @@ class BGServer(Server):
|
|||
library.
|
||||
"""
|
||||
|
||||
def __init__(self, host, port=DEFAULT_PORT, libpath='library.blb'):
|
||||
def __init__(self, library, host='127.0.0.1', port=DEFAULT_PORT):
|
||||
import gstplayer
|
||||
super(BGServer, self).__init__(host, port)
|
||||
self.library = Library(libpath)
|
||||
self.library = library
|
||||
self.player = gstplayer.GstPlayer()
|
||||
|
||||
def run(self):
|
||||
|
|
@ -435,4 +435,4 @@ class BGServer(Server):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
BGServer('0.0.0.0', 6600, 'library.blb').run()
|
||||
BGServer(Library('library.blb')).run()
|
||||
|
|
|
|||
12
bts.py
12
bts.py
|
|
@ -51,6 +51,13 @@ def read(lib, criteria):
|
|||
item.store()
|
||||
lib.save()
|
||||
|
||||
def bpd(lib, opts):
|
||||
host = opts.pop(0) if opts else '127.0.0.1'
|
||||
port = int(opts.pop(0)) if opts else 6600
|
||||
|
||||
import beets.player.bpd
|
||||
beets.player.bpd.BGServer(lib, host, port).run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
# parse options
|
||||
usage = """usage: %prog [options] command
|
||||
|
|
@ -78,11 +85,16 @@ command is one of: add, remove, update, write, list, help"""
|
|||
(imp, ['import', 'im', 'imp']),
|
||||
(remove, ['remove', 'rm']),
|
||||
(delete, ['delete', 'del']),
|
||||
|
||||
(read, ['read', 'r']),
|
||||
#(write, ['write', 'wr', 'w']),
|
||||
|
||||
(ls, ['list', 'ls']),
|
||||
|
||||
(option, ['set']),
|
||||
(help, ['help', 'h']),
|
||||
|
||||
(bpd, ['bpd']),
|
||||
]
|
||||
for test_command in avail_commands:
|
||||
if cmd in test_command[1]:
|
||||
|
|
|
|||
Loading…
Reference in a new issue