mirror of
https://github.com/beetbox/beets.git
synced 2026-01-20 15:14:13 +01:00
Add support for naming remote libraries
This commit is contained in:
parent
4109d825d1
commit
a091f9e71a
1 changed files with 8 additions and 3 deletions
|
|
@ -121,14 +121,19 @@ class IPFSPlugin(BeetsPlugin):
|
|||
stdout=subprocess.PIPE)
|
||||
self._log.info("hash of library: {0}", _proc.stdout.readline())
|
||||
|
||||
def ipfs_import(self, lib, _hash):
|
||||
def ipfs_import(self, lib, args):
|
||||
_hash = args[0]
|
||||
if len(args) > 1:
|
||||
lib_name = args[1]
|
||||
else:
|
||||
lib_name = _hash
|
||||
# TODO: should be able to tag libraries, for example by nicks
|
||||
lib_root = os.path.dirname(lib.path)
|
||||
remote_libs = lib_root + "/remotes"
|
||||
if not os.path.exists(remote_libs):
|
||||
os.makedirs(remote_libs)
|
||||
path = remote_libs + "/" + _hash[0] + ".db"
|
||||
subprocess.call(["ipfs", "get", _hash[0], "-o", path])
|
||||
path = remote_libs + "/" + lib_name + ".db"
|
||||
subprocess.call(["ipfs", "get", _hash, "-o", path])
|
||||
|
||||
# add all albums from remotes into a combined library
|
||||
jpath = remote_libs + "/joined.db"
|
||||
|
|
|
|||
Loading…
Reference in a new issue