From 538a99599ec764eb5092312a3ce7e228bd8a32ae Mon Sep 17 00:00:00 2001 From: multikatt Date: Thu, 14 May 2015 22:54:55 -0400 Subject: [PATCH] Put all remote libs in a directory --- beetsplug/ipfs.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/beetsplug/ipfs.py b/beetsplug/ipfs.py index a98222aea..4fe2dea70 100644 --- a/beetsplug/ipfs.py +++ b/beetsplug/ipfs.py @@ -118,9 +118,14 @@ class IPFSPlugin(BeetsPlugin): def ipfs_import(self, lib, _hash): # TODO: should be able to tag libraries, for example by nicks - subprocess.Popen(["ipfs", "get", _hash[0]]) - path = os.path.dirname(lib.path) + "/" + _hash[0] + ".db" - shutil.move(_hash[0], path) + # TODO: should create a special library for all remotes, merging all + # entries + 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.Popen(["ipfs", "get", _hash[0], "-o", path]) def ipfs_added_albums(self, rlib, tmpname): """ Returns a new library with only albums/items added to ipfs """