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 | |
| 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
| -rw-r--r-- | HISTORY | 3 | ||||
| -rw-r--r-- | README | 18 | ||||
| -rw-r--r-- | TODO | 1 | ||||
| -rw-r--r-- | mg_image_provider.c | 23 | ||||
| -rw-r--r-- | mg_tools.c | 42 | ||||
| -rw-r--r-- | mg_tools.h | 3 | ||||
| -rw-r--r-- | vdr_player.c | 2 | ||||
| -rw-r--r-- | vdr_setup.c | 1 |
8 files changed, 78 insertions, 15 deletions
@@ -246,11 +246,12 @@ XXXXXXXXXX: Version 0.0.8-ALPHA did not get updated. 2005-10-xx: Version 0.1.9-BETA +- adapt SQL tables for use with mySQL 5.0. The structures are compatible with GiantDisc (same changes introduced there) - Code that selects images factored out into an image provider class (mg_image_provider.h,c) - Current image provider simplay displays all images in the directory of the current song - Images are now converted in the background so that music replay starts immediately - Implement new Service interface: service ReplayDirectoryImages displays all images in directory passed via service request (char* as Data parameter to service request) - Added a patch for the image plugin (against 0.2.3) that uses muggle for displaying selected images while listening to music -- adapt SQL tables for use with mySQL 5.0. The structures are compatible with GiantDisc (same changes introduced there) - Fix for incremental search entered again +- Setup is now more verbose. NOTE: the enumeration for background mode may have changed! - Several minor fixes @@ -231,14 +231,16 @@ If a track has no ID3 tags, the following defaults will be applied: \section covers COVERS -muggle can display cover images. This is how it tries to find them: -1. if the database field album.coverimg contains something: This is - displayed. If the image file does not exist, show an error. -2. else: take the track filename and replace its extension by .jpg - if this file exists, display it -3. else try the file "cover.jpg" in the current directory. If it - does not exist, try parent directory. Repeat until the TLD is - reached. +muggle can display cover images. Currently, muggle simply displays all +images which reside in the same directory as the current file. + +#1. if the database field album.coverimg contains something: This is +# displayed. If the image file does not exist, show an error. +#2. else: take the track filename and replace its extension by .jpg +# if this file exists, display it +#3. else try the file "cover.jpg" in the current directory. If it +# does not exist, try parent directory. Repeat until the TLD is +# reached. So if you want a default background for all tracks you should put it into TLD/cover.jpg. It is strongly recommended to define such a default @@ -11,6 +11,7 @@ \subsection bugs Bugs and testing needed - Cover images from id3 tags + - When no tags in file can be found and no \subsection urgentosd OSD-related Issues - Move items within playlists 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 @@ -175,3 +175,45 @@ notempty(const char *s) else return strlen(s); } + +bool samedir( const char *d1, const char *d2 ) +{ + bool result; + + if( !strcmp( d1, d2 ) ) + { + result = true; + } + else + { + // check for trailing slash + int l1 = strlen( d1 ); + int l2 = strlen( d2 ); + + if( l1 == l2 + 1 ) + { + if( !strncmp( d1, d2, l2 ) && d1[l1-1] == '/' ) + { + result = true; + } + else + { + result = false; + } + } + else + { + if( l2 == l1 + 1 ) + { + if( !strncmp( d1, d2, l1 ) && d2[l2-1] == '/' ) + { + result = true; + } + else + { + result = false; + } + } + } + } +} @@ -100,4 +100,7 @@ string ltos (long l); char *extension (const char *filename); bool notempty(const char *s); + +bool samedir(const char *s1, const char *s2); + #endif /* _MUGGLE_TOOLS_H */ diff --git a/vdr_player.c b/vdr_player.c index b2b828f..eb3750d 100644 --- a/vdr_player.c +++ b/vdr_player.c @@ -496,7 +496,7 @@ mgPCMPlayer::Action (void) TransferImageTFT( m_current_image ); // check for background display of image - if( the_setup.BackgrMode == 2 ) + if( the_setup.BackgrMode == 1 ) { if( m_current_image.empty() ) { diff --git a/vdr_setup.c b/vdr_setup.c index 3712c8b..98b3e86 100644 --- a/vdr_setup.c +++ b/vdr_setup.c @@ -71,7 +71,6 @@ mgMenuSetup::mgMenuSetup () Add (new cMenuEditBoolItem (tr ("Use DVB still picture"), &the_setup.UseDeviceStillPicture, tr("yes"), tr("no") ) ); - // Synchronization Add (new |
