From c11a59db7bf7f36a54688334509100d872bdbb04 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 24 Sep 2015 10:49:42 +0200 Subject: [PATCH] Allow the search_image and search_partition to return None --- patacrep/songs/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patacrep/songs/__init__.py b/patacrep/songs/__init__.py index d1f24a99..297a993e 100644 --- a/patacrep/songs/__init__.py +++ b/patacrep/songs/__init__.py @@ -230,19 +230,19 @@ class Song: return os.path.abspath(fullpath) return None - def search_image(self, filename): + def search_image(self, filename, none_if_not_found=False): """Search for an image file""" filepath = self.search_file( filename, ['', '.jpg', '.png'], self.get_datadirs('img'), ) - return filepath if filepath else filename + return filepath if none_if_not_found or filepath else filename - def search_partition(self, filename): + def search_partition(self, filename, none_if_not_found=False): """Search for a lilypond file""" filepath = self.search_file(filename, ['', '.ly']) - return filepath if filepath else filename + return filepath if none_if_not_found or filepath else filename def unprefixed_title(title, prefixes): """Remove the first prefix of the list in the beginning of title (if any).