mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2024-11-14 17:40:24 -08:00
56c6773c6b
Updates colorama to 0.4.6 Adds confuse version 1.7.0 Updates jellyfish to 0.9.0 Adds mediafile 0.10.1 Updates munkres to 1.1.4 Updates musicbrainzngs to 0.7.1 Updates mutagen to 1.46.0 Updates pyyaml to 6.0 Updates unidecode to 1.3.6
69 lines
2.2 KiB
Python
69 lines
2.2 KiB
Python
# This file is part of beets.
|
|
# Copyright 2019, Joris Jensen
|
|
#
|
|
# 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.
|
|
|
|
"""
|
|
List all files in the library folder which are not listed in the
|
|
beets library database, including art files
|
|
"""
|
|
|
|
import os
|
|
|
|
from beets import util
|
|
from beets.plugins import BeetsPlugin
|
|
from beets.ui import Subcommand, print_
|
|
|
|
__author__ = 'https://github.com/MrNuggelz'
|
|
|
|
|
|
class Unimported(BeetsPlugin):
|
|
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.config.add(
|
|
{
|
|
'ignore_extensions': []
|
|
}
|
|
)
|
|
|
|
def commands(self):
|
|
def print_unimported(lib, opts, args):
|
|
ignore_exts = [
|
|
('.' + x).encode()
|
|
for x in self.config["ignore_extensions"].as_str_seq()
|
|
]
|
|
ignore_dirs = [
|
|
os.path.join(lib.directory, x.encode())
|
|
for x in self.config["ignore_subdirectories"].as_str_seq()
|
|
]
|
|
in_folder = {
|
|
os.path.join(r, file)
|
|
for r, d, f in os.walk(lib.directory)
|
|
for file in f
|
|
if not any(
|
|
[file.endswith(ext) for ext in ignore_exts]
|
|
+ [r in ignore_dirs]
|
|
)
|
|
}
|
|
in_library = {x.path for x in lib.items()}
|
|
art_files = {x.artpath for x in lib.albums()}
|
|
for f in in_folder - in_library - art_files:
|
|
print_(util.displayable_path(f))
|
|
|
|
unimported = Subcommand(
|
|
'unimported',
|
|
help='list all files in the library folder which are not listed'
|
|
' in the beets library database')
|
|
unimported.func = print_unimported
|
|
return [unimported]
|