From 2b82831b7b081128c788423e9ce1382db4b66c37 Mon Sep 17 00:00:00 2001 From: Iris Wildthyme <46726098+wildthyme@users.noreply.github.com> Date: Wed, 30 Jan 2019 16:36:46 -0500 Subject: [PATCH 1/3] added --nocopy support --- beetsplug/ipfs.py | 11 +++++++++-- docs/plugins/ipfs.rst | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/beetsplug/ipfs.py b/beetsplug/ipfs.py index 9a9d6aa50..90ba5fdd0 100644 --- a/beetsplug/ipfs.py +++ b/beetsplug/ipfs.py @@ -32,6 +32,7 @@ class IPFSPlugin(BeetsPlugin): super(IPFSPlugin, self).__init__() self.config.add({ 'auto': True, + 'nocopy': False, }) if self.config['auto']: @@ -116,7 +117,10 @@ class IPFSPlugin(BeetsPlugin): self._log.info('Adding {0} to ipfs', album_dir) - cmd = "ipfs add -q -r".split() + if self.config['nocopy']: + cmd = "ipfs add --nocopy -q -r".split() + else: + cmd = "ipfs add -q -r".split() cmd.append(album_dir) try: output = util.command_output(cmd).split() @@ -174,7 +178,10 @@ class IPFSPlugin(BeetsPlugin): with tempfile.NamedTemporaryFile() as tmp: self.ipfs_added_albums(lib, tmp.name) try: - cmd = "ipfs add -q ".split() + if self.config['nocopy']: + cmd = "ipfs add --nocopy -q ".split() + else: + cmd = "ipfs add -q ".split() cmd.append(tmp.name) output = util.command_output(cmd) except (OSError, subprocess.CalledProcessError) as err: diff --git a/docs/plugins/ipfs.rst b/docs/plugins/ipfs.rst index a9b5538df..141143ae7 100644 --- a/docs/plugins/ipfs.rst +++ b/docs/plugins/ipfs.rst @@ -70,3 +70,5 @@ Configuration The ipfs plugin will automatically add imported albums to ipfs and add those hashes to the database. This can be turned off by setting the ``auto`` option in the ``ipfs:`` section of the config to ``no``. + +If the setting ``nocopy`` is true (defaults false) then the plugin will pass the ``--nocopy`` option when adding things to ipfs. If the filestore option of ipfs is enabled this will mean files are neither removed from beets nor copied somewhere else. From 367bb3026fa7b558bde29d59179afe7345f7c758 Mon Sep 17 00:00:00 2001 From: Iris Wildthyme <46726098+wildthyme@users.noreply.github.com> Date: Wed, 30 Jan 2019 17:13:12 -0500 Subject: [PATCH 2/3] added to changelog --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index b896604c2..242279583 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -63,6 +63,8 @@ New features: provider: you can match tracks and albums using the Spotify database. Thanks to :user:`rhlahuja`. :bug:`3123` +* :doc:`/plugins/ipfs`: The plugin now supports a ``nocopy`` option which passes that flag to ipfs. + THanks to :user:`wildthyme`. Changes: From c20c3a439858b7584104835abd250887e36a222e Mon Sep 17 00:00:00 2001 From: Iris Wildthyme <46726098+wildthyme@users.noreply.github.com> Date: Fri, 1 Feb 2019 09:36:51 -0500 Subject: [PATCH 3/3] fixed typo --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 242279583..9cab4a1e0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -64,7 +64,7 @@ New features: Thanks to :user:`rhlahuja`. :bug:`3123` * :doc:`/plugins/ipfs`: The plugin now supports a ``nocopy`` option which passes that flag to ipfs. - THanks to :user:`wildthyme`. + Thanks to :user:`wildthyme`. Changes: