mirror of
https://github.com/beetbox/beets.git
synced 2025-12-26 18:43:38 +01:00
Merge pull request #955 from robotanarchy/master
importfeeds: add new 'echo' type that writes to stdout
This commit is contained in:
commit
20968a92ee
2 changed files with 11 additions and 2 deletions
|
|
@ -13,17 +13,20 @@
|
|||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
"""Write paths of imported files in various formats to ease later import in a
|
||||
music player.
|
||||
music player. Also allow printing the new file locations to stdout in case
|
||||
one wants to manually add music to a player by its path.
|
||||
"""
|
||||
import datetime
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.util import normpath, syspath, bytestring_path
|
||||
from beets import config
|
||||
|
||||
M3U_DEFAULT_NAME = 'imported.m3u'
|
||||
log = logging.getLogger('beets')
|
||||
|
||||
|
||||
class ImportFeedsPlugin(BeetsPlugin):
|
||||
|
|
@ -126,6 +129,11 @@ def _record_items(lib, basename, items):
|
|||
if not os.path.exists(syspath(dest)):
|
||||
os.symlink(syspath(path), syspath(dest))
|
||||
|
||||
if 'echo' in formats:
|
||||
log.info("Location of imported music:")
|
||||
for path in paths:
|
||||
log.info(" " + path)
|
||||
|
||||
|
||||
@ImportFeedsPlugin.listen('library_opened')
|
||||
def library_opened(lib):
|
||||
|
|
|
|||
|
|
@ -18,12 +18,13 @@ root of your music library.
|
|||
The ``absolute_path`` configuration option can be set to use absolute paths
|
||||
instead of relative paths. Some applications may need this to work properly.
|
||||
|
||||
Three different types of outputs coexist, specify the ones you want to use by
|
||||
Four different types of outputs coexist, specify the ones you want to use by
|
||||
setting the ``formats`` parameter:
|
||||
|
||||
- ``m3u``: catalog the imports in a centralized playlist. By default, the playlist is named ``imported.m3u``. To use a different file, just set the ``m3u_name`` parameter inside the ``importfeeds`` config section.
|
||||
- ``m3u_multi``: create a new playlist for each import (uniquely named by appending the date and track/album name).
|
||||
- ``link``: create a symlink for each imported item. This is the recommended setting to propagate beets imports to your iTunes library: just drag and drop the ``dir`` folder on the iTunes dock icon.
|
||||
- ``echo``: do not write a playlist file at all, but echo a list of new file paths to the terminal.
|
||||
|
||||
Here's an example configuration for this plugin::
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue