Browse Source

Allow the search_image and search_partition to return None

pull/103/head
Oliverpool 9 years ago
parent
commit
c11a59db7b
  1. 8
      patacrep/songs/__init__.py

8
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).

Loading…
Cancel
Save