Browse Source

Corrections (due to problems with git merge)

pull/70/head
Louis 10 years ago
parent
commit
edf844f98d
  1. 4
      patacrep/content/song.py
  2. 6
      patacrep/files.py
  3. 6
      patacrep/songs/__init__.py

4
patacrep/content/song.py

@ -64,16 +64,16 @@ def parse(keyword, argument, contentlist, config):
continue continue
with files.chdir(songdir.datadir): with files.chdir(songdir.datadir):
for filename in glob.iglob(os.path.join(songdir.subpath, elem)): for filename in glob.iglob(os.path.join(songdir.subpath, elem)):
LOGGER.debug('Parsing file "{}"'.format(filename))
extension = filename.split(".")[-1] extension = filename.split(".")[-1]
if extension not in plugins: if extension not in plugins:
LOGGER.warning( LOGGER.warning(
'File "{}" does not end with one of {}. Ignored.' 'I do not know how to parse "{}": name does not end with one of {}. Ignored.'
).format( ).format(
os.path.join(songdir.datadir, filename), os.path.join(songdir.datadir, filename),
", ".join(["'.{}'".format(key) for key in plugins.keys()]), ", ".join(["'.{}'".format(key) for key in plugins.keys()]),
) )
continue continue
LOGGER.debug('Parsing file "{}"'.format(filename))
renderer = SongRenderer(plugins[extension]( renderer = SongRenderer(plugins[extension](
songdir.datadir, songdir.datadir,
filename, filename,

6
patacrep/files.py

@ -13,7 +13,11 @@ LOGGER = logging.getLogger(__name__)
def recursive_find(root_directory, extensions): def recursive_find(root_directory, extensions):
"""Recursively find files with the given extensions, from a root_directory. """Recursively find files with the given extensions, from a root_directory.
Return a list of files ending with one of the given extensions. Return a list of files matching those conditions.
Arguments:
- `extensions`: list of accepted extensions.
- `root_directory`: root directory of the search.
""" """
if not os.path.isdir(root_directory): if not os.path.isdir(root_directory):
return [] return []

6
patacrep/songs/__init__.py

@ -96,12 +96,6 @@ class Song(Content):
"_version", "_version",
] ]
# Default data
DEFAULT_DATA = {
'@titles': [],
'@languages': [],
}
def __init__(self, datadir, subpath, config): def __init__(self, datadir, subpath, config):
self.fullpath = os.path.join(datadir, subpath) self.fullpath = os.path.join(datadir, subpath)
self.datadir = datadir self.datadir = datadir

Loading…
Cancel
Save