old_contents: import os
  import logging
  from flexget.plugin import register_plugin, priority, PluginWarning
  
  log = logging.getLogger('exists')
  
  
  class FilterExists(object):
  
      """
          Reject entries that already exist in given path.
  
          Example:
  
          exists: /storage/movies/
      """
  
      def validator(self):
          from flexget import validator
          root = validator.factory()
          root.accept('path')
          bundle = root.accept('list')
          bundle.accept('path')
          return root
  
      def get_config(self, feed):
          config = feed.config.get('exists', None)
          # If only a single path is passed turn it into a 1 element list
          if isinstance(config, basestring):
              config = [config]
          return config
  
      @priority(-1)
      def on_feed_filter(self, feed):
          config = self.get_config(feed)
          for path in config:
              # unicode path causes crashes on some paths
              path = str(os.path.expanduser(path))
              if not os.path.exists(path):
                  raise PluginWarning('Path %s does not exist' % path, log)
              # scan through
              for root, dirs, files in os.walk(path):
                  # convert filelists into utf-8 to avoid unicode problems
                  dirs = [x.decode('utf-8', 'ignore') for x in dirs]
                  files = [x.decode('utf-8', 'ignore') for x in files]
                  for entry in feed.entries:
                      name = entry['title']
                      if name in dirs or name in files:
                          log.debug('Found %s in %s' % (name, root))
                          feed.reject(entry, '%s/%s' % (name, root))
  
  register_plugin(FilterExists, 'exists')
  
new_contents: import os
  import logging
  from flexget.plugin import register_plugin, priority, PluginWarning
  
  log = logging.getLogger('exists')
  
  
  class FilterExists(object):
  
      """
          Reject entries that already exist in given path.
  
          Example:
  
          exists: /storage/movies/
      """
  
      def validator(self):
          from flexget import validator
          root = validator.factory()
          root.accept('path')
          bundle = root.accept('list')
          bundle.accept('path')
          return root
  
      def get_config(self, feed):
          config = feed.config.get('exists', None)
          # If only a single path is passed turn it into a 1 element list
          if isinstance(config, basestring):
              config = [config]
          return config
  
      @priority(-1)
      def on_feed_filter(self, feed):
          if not feed.accepted:
              log.debug('No accepted entries, not scanning for existing.')
              return
          log.verbose('Scanning path(s) for existing files.')
          config = self.get_config(feed)
          for path in config:
              # unicode path causes crashes on some paths
              path = str(os.path.expanduser(path))
              if not os.path.exists(path):
                  raise PluginWarning('Path %s does not exist' % path, log)
              # scan through
              for root, dirs, files in os.walk(path):
                  # convert filelists into utf-8 to avoid unicode problems
                  dirs = [x.decode('utf-8', 'ignore') for x in dirs]
                  files = [x.decode('utf-8', 'ignore') for x in files]
                  for entry in feed.accepted:
                      name = entry['title']
                      if name in dirs or name in files:
                          log.debug('Found %s in %s' % (name, root))
                          feed.reject(entry, os.path.join(root, name))
  
  register_plugin(FilterExists, 'exists')
  
subject: Tweak exists plugin rejection message. Prevent exists plugin scanning when there are no accepted entries. Add verbose log message to exists that indicates it is scanning. refs #1647