diff options
| author | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-10-06 13:29:31 +0000 |
|---|---|---|
| committer | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-10-06 13:29:31 +0000 |
| commit | ea2fb28071fee9f56ebdecc6878df4801888a1bb (patch) | |
| tree | 1e869fb13e7c2b3f212a0bd9040a56e98303f4d1 /mg_image_provider.c | |
| parent | 4b0f7c5b42c95714e62a31bf7aff44d42e9ddc16 (diff) | |
| download | vdr-plugin-muggle-ea2fb28071fee9f56ebdecc6878df4801888a1bb.tar.gz vdr-plugin-muggle-ea2fb28071fee9f56ebdecc6878df4801888a1bb.tar.bz2 | |
Seek hierarchy upwards for covers if there are none in the song tags or directory
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@845 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'mg_image_provider.c')
| -rw-r--r-- | mg_image_provider.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/mg_image_provider.c b/mg_image_provider.c index 2f48c22..13694c8 100644 --- a/mg_image_provider.c +++ b/mg_image_provider.c @@ -121,12 +121,27 @@ void mgImageProvider::updateItem( mgItemGd *item ) string dir = extractImagesFromTag( filename ); if( dir == "" ) { - // no images in tags, find images in the directory itself + // no images in tags, find images in the directory of the file itself dir = dirname( (char *) (item->getSourceFile().c_str()) ); - } - // finally put all image filenames here - fillImageList( dir ); + // go up hierarchy until we find at least one image or reach toplevel dir + bool toplevel_reached = false; + while( !m_image_list.size() || toplevel_reached ) + { + if( samedir( dir.c_str(), the_setup.ToplevelDir ) ) + { + toplevel_reached = true; + } + + fillImageList( dir ); + + if( !m_image_list.size() ) + { + // nothing found, turn up one directory level + dir = dirname( (char *)dir.c_str() ); + } + } + } // think of something, when there are no images here, either: // simply go up one step in the directory hierarchy, until we reach top level directory |
