From 349aecda09dbc393bbb281925529c66d67b2c58b Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 11 Apr 2014 19:59:08 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20warning=20si=20des=20chansons=20?= =?UTF-8?q?ne=20peuvent=20pas=20=C3=AAtre=20import=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Évoqué dans #24 --- songbook_core/songs.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/songbook_core/songs.py b/songbook_core/songs.py index 1aec8aa0..5f73e8ed 100644 --- a/songbook_core/songs.py +++ b/songbook_core/songs.py @@ -8,10 +8,12 @@ import glob import locale import os.path import re +import logging from songbook_core.authors import processauthors from songbook_core.plastex import parsetex +LOGGER = logging.getLogger(__name__) # pylint: disable=too-few-public-methods class Song(object): @@ -122,8 +124,14 @@ class SongsList(object): le module glob. """ for regexp in filelist: + before = len(self.songs) for filename in glob.iglob(os.path.join(self._songdir, regexp)): self.append(filename) + if len(self.songs) == before: + # No songs were added + LOGGER.warning( + "Expression '{}' did not match any file".format(regexp) + ) def languages(self): """Renvoie la liste des langues utilisées par les chansons"""