mirror of
https://github.com/beetbox/beets.git
synced 2026-02-10 09:25:42 +01:00
Merge pull request #3135 from wildthyme/master
Support ipfs add --nocopy in ipfs plugin
This commit is contained in:
commit
c7c90a51c6
3 changed files with 13 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue