Commit d6d97b2b authored by Tiago Dias's avatar Tiago Dias
Browse files

v0.1.0-beta

parents
.DS_Store
Thumbs.db
*.egg-info
*.pyc
.idea
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2015 Tiago Dias
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
beets-noimport
==============
Adds directories to the incremental import "do not import" list
Install
-------
To install this plugin, run
```
pip install beets-noimport
```
and add `noimport` to the `plugins` list in your beets config file.
Usage
-----
To use this plugin, simply use the `beet noimport` command like you would use the `beet import` command.
To add all the directories in your current directory, run
```
$ beet noimport .
Added 384 paths to the skip list
```
License
-------
This plugin is licensed under the MIT license.
For the complete license, read the `LICENSE` file.
\ No newline at end of file
# Make this a namespace package.
from __future__ import absolute_import
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
\ No newline at end of file
"""
add directories to the incremental import "do not import" list
"""
import logging
import os.path
from beets import plugins, ui, importer
from beets.util import syspath, normpath, displayable_path
# Global logger.
log = logging.getLogger('beets')
class NoImportPlugin(plugins.BeetsPlugin):
def __init__(self):
super(NoImportPlugin, self).__init__()
self._command = ui.Subcommand(
'noimport',
help='add directories to the incremental import "do not import" list')
def commands(self):
def func(lib, opts, args):
# to match "beet import" function
paths = args
if not paths:
raise ui.UserError('no path specified')
self.noimport_files(lib, paths)
self._command.func = func
return [self._command]
def noimport_files(self, lib, paths):
# Check the user-specified directories.
for path in paths:
if not os.path.exists(syspath(normpath(path))):
raise ui.UserError(u'no such file or directory: {0}'.format(
displayable_path(path)))
# Open the state file
state = importer._open_state()
# Create the 'taghistory' set if it doesn't exist
if 'taghistory' not in state:
state['taghistory'] = set()
# For every path...
for path in paths:
added = 0
# ...get the list of albums in that path...
for dirs, paths_in_dir in importer.albums_in_dir(path):
# ...check if they're not already in the 'taghistory' set
if tuple(dirs) not in state['taghistory']:
# ...and add them...
state['taghistory'].add(tuple(dirs))
added += 1
# Save the state file
importer._save_state(state)
log.info(u'Added {0} paths to the skip list', added)
\ No newline at end of file
from setuptools import setup
setup(
name='beets-noimport',
version='0.1.0-beta',
description='add directories to the incremental import "do not import" list',
long_description=open('README.md').read(),
author='Tiago Dias',
author_email='tiagoadias@gmail.com',
url='http://www.github.com/ttsda/beets-noimport',
license='MIT',
platforms='ALL',
packages=['beetsplug'],
install_requires=[
'beets>=1.3.7'
],
classifiers=[
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Multimedia :: Sound/Audio :: Players :: MP3',
'License :: OSI Approved :: MIT License',
'Environment :: Console',
'Environment :: Web Environment',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
],
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment