mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
parent
e103798b4a
commit
75c6af6329
2 changed files with 26 additions and 1 deletions
|
|
@ -1071,6 +1071,7 @@ def read_tasks(session):
|
|||
for toppath in session.paths:
|
||||
# Determine if we want to resume import of the toppath
|
||||
session.ask_resume(toppath)
|
||||
user_toppath = toppath
|
||||
|
||||
# Extract archives.
|
||||
archive_task = None
|
||||
|
|
@ -1093,7 +1094,9 @@ def read_tasks(session):
|
|||
toppath = archive_task.toppath
|
||||
|
||||
task_factory = ImportTaskFactory(toppath, session)
|
||||
imported = False
|
||||
for t in task_factory.tasks():
|
||||
imported |= not t.skip
|
||||
yield t
|
||||
|
||||
# Indicate the directory is finished.
|
||||
|
|
@ -1103,6 +1106,10 @@ def read_tasks(session):
|
|||
else:
|
||||
yield archive_task
|
||||
|
||||
if not imported:
|
||||
log.warn(u'No files imported from {0}'
|
||||
.format(displayable_path(user_toppath)))
|
||||
|
||||
# Show skipped directories.
|
||||
if skipped:
|
||||
log.info(u'Skipped {0} directories.'.format(skipped))
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ from mock import patch
|
|||
|
||||
import _common
|
||||
from _common import unittest
|
||||
from helper import TestImportSession, TestHelper, has_program
|
||||
from helper import TestImportSession, TestHelper, has_program, capture_log
|
||||
from beets import importer
|
||||
from beets.importer import albums_in_dir
|
||||
from beets.mediafile import MediaFile
|
||||
|
|
@ -600,6 +600,24 @@ class ImportTest(_common.TestCase, ImportHelper):
|
|||
self.importer.run()
|
||||
self.assertEqual(len(self.lib.items()), 1)
|
||||
|
||||
def test_empty_directory_warning(self):
|
||||
import_dir = os.path.join(self.temp_dir, 'empty')
|
||||
self.touch('non-audio', dir=import_dir)
|
||||
self._setup_import_session(import_dir=import_dir)
|
||||
with capture_log() as logs:
|
||||
self.importer.run()
|
||||
|
||||
self.assertIn('No files imported from {}'.format(import_dir), logs)
|
||||
|
||||
def test_empty_directory_singleton_warning(self):
|
||||
import_dir = os.path.join(self.temp_dir, 'empty')
|
||||
self.touch('non-audio', dir=import_dir)
|
||||
self._setup_import_session(import_dir=import_dir, singletons=True)
|
||||
with capture_log() as logs:
|
||||
self.importer.run()
|
||||
|
||||
self.assertIn('No files imported from {}'.format(import_dir), logs)
|
||||
|
||||
|
||||
class ImportTracksTest(_common.TestCase, ImportHelper):
|
||||
"""Test TRACKS and APPLY choice.
|
||||
|
|
|
|||
Loading…
Reference in a new issue