prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  unimported: Add an option to ignore some folders
  I use a hard drive as my Beets library 'folder'. 
  Because of its size I also store some other non-imported music folders on that drive.
  I ran into the situation that running 'beets unimported' showed me all the files in those unimported folders. 
  It's logical that the plugin scans those too but a more specific scan would be great.
  I could circumvent this by placing all Beets folders in another folder instead of the root of the drive but that would make for a deeper hierarchy which I wouldn't like.
  
  ### Proposed solution
  
  Add extra options for the command line
  `beets unimported /specific_folder`
  or in config.yaml
  ```
  unimported:
      ignore_folders: folder-with-non-imported-files
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `beetsplug/unimported.py`
  Content:
  ```
  1 # This file is part of beets.
  2 # Copyright 2019, Joris Jensen
  3 #
  4 # Permission is hereby granted, free of charge, to any person obtaining
  5 # a copy of this software and associated documentation files (the
  6 # "Software"), to deal in the Software without restriction, including
  7 # without limitation the rights to use, copy, modify, merge, publish,
  8 # distribute, sublicense, and/or sell copies of the Software, and to
  9 # permit persons to whom the Software is furnished to do so, subject to
  10 # the following conditions:
  11 #
  12 # The above copyright notice and this permission notice shall be
  13 # included in all copies or substantial portions of the Software.
  14 
  15 """
  16 List all files in the library folder which are not listed in the
  17  beets library database, including art files
  18 """
  19 
  20 import os
  21 
  22 from beets import util
  23 from beets.plugins import BeetsPlugin
  24 from beets.ui import Subcommand, print_
  25 
  26 __author__ = 'https://github.com/MrNuggelz'
  27 
  28 
  29 class Unimported(BeetsPlugin):
  30 
  31     def __init__(self):
  32         super().__init__()
  33         self.config.add(
  34             {
  35                 'ignore_extensions': []
  36             }
  37         )
  38 
  39     def commands(self):
  40         def print_unimported(lib, opts, args):
  41             ignore_exts = [('.' + x).encode() for x
  42                            in self.config['ignore_extensions'].as_str_seq()]
  43             in_folder = {
  44                 os.path.join(r, file) for r, d, f in os.walk(lib.directory)
  45                 for file in f if not any(
  46                     [file.endswith(extension) for extension in
  47                      ignore_exts])}
  48             in_library = {x.path for x in lib.items()}
  49             art_files = {x.artpath for x in lib.albums()}
  50             for f in in_folder - in_library - art_files:
  51                 print_(util.displayable_path(f))
  52 
  53         unimported = Subcommand(
  54             'unimported',
  55             help='list all files in the library folder which are not listed'
  56                  ' in the beets library database')
  57         unimported.func = print_unimported
  58         return [unimported]
  59
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/beetsplug/unimported.py b/beetsplug/unimported.py
  --- a/beetsplug/unimported.py
  +++ b/beetsplug/unimported.py
  @@ -38,13 +38,23 @@
   
       def commands(self):
           def print_unimported(lib, opts, args):
  -            ignore_exts = [('.' + x).encode() for x
  -                           in self.config['ignore_extensions'].as_str_seq()]
  +            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(extension) for extension in
  -                     ignore_exts])}
  +                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:
  
verification_info: {"golden_diff": "diff --git a/beetsplug/unimported.py b/beetsplug/unimported.py\n--- a/beetsplug/unimported.py\n+++ b/beetsplug/unimported.py\n@@ -38,13 +38,23 @@\n \n     def commands(self):\n         def print_unimported(lib, opts, args):\n-            ignore_exts = [('.' + x).encode() for x\n-                           in self.config['ignore_extensions'].as_str_seq()]\n+            ignore_exts = [\n+                ('.' + x).encode()\n+                for x in self.config[\"ignore_extensions\"].as_str_seq()\n+            ]\n+            ignore_dirs = [\n+                os.path.join(lib.directory, x.encode())\n+                for x in self.config[\"ignore_subdirectories\"].as_str_seq()\n+            ]\n             in_folder = {\n-                os.path.join(r, file) for r, d, f in os.walk(lib.directory)\n-                for file in f if not any(\n-                    [file.endswith(extension) for extension in\n-                     ignore_exts])}\n+                os.path.join(r, file)\n+                for r, d, f in os.walk(lib.directory)\n+                for file in f\n+                if not any(\n+                    [file.endswith(ext) for ext in ignore_exts]\n+                    + [r in ignore_dirs]\n+                )\n+            }\n             in_library = {x.path for x in lib.items()}\n             art_files = {x.artpath for x in lib.albums()}\n             for f in in_folder - in_library - art_files:\n", "issue": "unimported: Add an option to ignore some folders\nI use a hard drive as my Beets library 'folder'. \r\nBecause of its size I also store some other non-imported music folders on that drive.\r\nI ran into the situation that running 'beets unimported' showed me all the files in those unimported folders. \r\nIt's logical that the plugin scans those too but a more specific scan would be great.\r\nI could circumvent this by placing all Beets folders in another folder instead of the root of the drive but that would make for a deeper hierarchy which I wouldn't like.\r\n\r\n### Proposed solution\r\n\r\nAdd extra options for the command line\r\n`beets unimported /specific_folder`\r\nor in config.yaml\r\n```\r\nunimported:\r\n    ignore_folders: folder-with-non-imported-files\r\n```\n", "before_files": [{"content": "# This file is part of beets.\n# Copyright 2019, Joris Jensen\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n#\n# The above copyright notice and this permission notice shall be\n# included in all copies or substantial portions of the Software.\n\n\"\"\"\nList all files in the library folder which are not listed in the\n beets library database, including art files\n\"\"\"\n\nimport os\n\nfrom beets import util\nfrom beets.plugins import BeetsPlugin\nfrom beets.ui import Subcommand, print_\n\n__author__ = 'https://github.com/MrNuggelz'\n\n\nclass Unimported(BeetsPlugin):\n\n    def __init__(self):\n        super().__init__()\n        self.config.add(\n            {\n                'ignore_extensions': []\n            }\n        )\n\n    def commands(self):\n        def print_unimported(lib, opts, args):\n            ignore_exts = [('.' + x).encode() for x\n                           in self.config['ignore_extensions'].as_str_seq()]\n            in_folder = {\n                os.path.join(r, file) for r, d, f in os.walk(lib.directory)\n                for file in f if not any(\n                    [file.endswith(extension) for extension in\n                     ignore_exts])}\n            in_library = {x.path for x in lib.items()}\n            art_files = {x.artpath for x in lib.albums()}\n            for f in in_folder - in_library - art_files:\n                print_(util.displayable_path(f))\n\n        unimported = Subcommand(\n            'unimported',\n            help='list all files in the library folder which are not listed'\n                 ' in the beets library database')\n        unimported.func = print_unimported\n        return [unimported]\n", "path": "beetsplug/unimported.py"}], "after_files": [{"content": "# This file is part of beets.\n# Copyright 2019, Joris Jensen\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n#\n# The above copyright notice and this permission notice shall be\n# included in all copies or substantial portions of the Software.\n\n\"\"\"\nList all files in the library folder which are not listed in the\n beets library database, including art files\n\"\"\"\n\nimport os\n\nfrom beets import util\nfrom beets.plugins import BeetsPlugin\nfrom beets.ui import Subcommand, print_\n\n__author__ = 'https://github.com/MrNuggelz'\n\n\nclass Unimported(BeetsPlugin):\n\n    def __init__(self):\n        super().__init__()\n        self.config.add(\n            {\n                'ignore_extensions': []\n            }\n        )\n\n    def commands(self):\n        def print_unimported(lib, opts, args):\n            ignore_exts = [\n                ('.' + x).encode()\n                for x in self.config[\"ignore_extensions\"].as_str_seq()\n            ]\n            ignore_dirs = [\n                os.path.join(lib.directory, x.encode())\n                for x in self.config[\"ignore_subdirectories\"].as_str_seq()\n            ]\n            in_folder = {\n                os.path.join(r, file)\n                for r, d, f in os.walk(lib.directory)\n                for file in f\n                if not any(\n                    [file.endswith(ext) for ext in ignore_exts]\n                    + [r in ignore_dirs]\n                )\n            }\n            in_library = {x.path for x in lib.items()}\n            art_files = {x.artpath for x in lib.albums()}\n            for f in in_folder - in_library - art_files:\n                print_(util.displayable_path(f))\n\n        unimported = Subcommand(\n            'unimported',\n            help='list all files in the library folder which are not listed'\n                 ' in the beets library database')\n        unimported.func = print_unimported\n        return [unimported]\n", "path": "beetsplug/unimported.py"}]}