From b9844ccf3a65392dd1468c10eb0242391c9f8655 Mon Sep 17 00:00:00 2001 From: Lucas Duailibe Date: Wed, 13 Mar 2013 01:05:25 -0300 Subject: [PATCH] importfeeds: absolute path option (#180) --- beetsplug/importfeeds.py | 14 +++++++++----- docs/plugins/importfeeds.rst | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/beetsplug/importfeeds.py b/beetsplug/importfeeds.py index a45e6013d..6a62130fb 100644 --- a/beetsplug/importfeeds.py +++ b/beetsplug/importfeeds.py @@ -34,10 +34,11 @@ class ImportFeedsPlugin(BeetsPlugin): 'm3u_name': u'imported.m3u', 'dir': None, 'relative_to': None, + 'absolute_path': False }) - + feeds_dir = self.config['dir'].get() - if feeds_dir: + if feeds_dir: feeds_dir = os.path.expanduser(bytestring_path(feeds_dir)) self.config['dir'] = feeds_dir if not os.path.exists(syspath(feeds_dir)): @@ -92,9 +93,12 @@ def _record_items(lib, basename, items): paths = [] for item in items: - paths.append(os.path.relpath( - item.path, relative_to - )) + if config['importfeeds']['absolute_path']: + paths.append(item.path) + else: + paths.append(os.path.relpath( + item.path, relative_to + )) if 'm3u' in formats: basename = bytestring_path( diff --git a/docs/plugins/importfeeds.rst b/docs/plugins/importfeeds.rst index 09b831246..41c53cd84 100644 --- a/docs/plugins/importfeeds.rst +++ b/docs/plugins/importfeeds.rst @@ -15,11 +15,14 @@ relative to another folder than where the playlist is being written. If you're using importfeeds to generate a playlist for MPD, you should set this to the 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 -setting the ``formats`` parameter: +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). +- ``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. Here's an example configuration for this plugin::