summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b>2006-03-05 12:19:11 +0000
committerLarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b>2006-03-05 12:19:11 +0000
commit6d3a3d3d7c049445dad7cec59e2ed2e8615e16a9 (patch)
treed8c833589e7f8135aa4aa929ddcf36519f1d3bb0
parent76463b10b4aad8cef47828925bb1f6cee279ce33 (diff)
downloadvdr-plugin-muggle-6d3a3d3d7c049445dad7cec59e2ed2e8615e16a9.tar.gz
vdr-plugin-muggle-6d3a3d3d7c049445dad7cec59e2ed2e8615e16a9.tar.bz2
Rework broken integration with graphTFT, improve import of covers from a GD-compliant database
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@933 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r--HISTORY4
-rw-r--r--mg_image_provider.c126
-rw-r--r--vdr_player.c14
3 files changed, 91 insertions, 53 deletions
diff --git a/HISTORY b/HISTORY
index 9ad9c8e..48e4a96 100644
--- a/HISTORY
+++ b/HISTORY
@@ -282,4 +282,6 @@ XXXXXXXXXX: Version 0.0.8-ALPHA
- Corrected labeling of setup options
- Restored link to send cover images to graphtft
- Resolved a problem that prevented starting muggle when a channel with dolby digital is active
-- Improve compatibility with GD regarding cover image handling \ No newline at end of file
+- Improve compatibility with GD regarding cover image handling
+- Adapt image_convert.sh to newer versions of mjpegtools
+- Rework broken integration with graphTFT plugin for image display
diff --git a/mg_image_provider.c b/mg_image_provider.c
index 36ccc7f..3ca1dea 100644
--- a/mg_image_provider.c
+++ b/mg_image_provider.c
@@ -58,22 +58,24 @@ int picture_select( struct dirent const *entry )
}
}
-std::string mgImageProvider::getImagePath( string &source )
+string mgImageProvider::getImagePath( string &source )
{
- string fname;
+ string fname="";
+ source = "";
// check, how many images are converted at all
Lock();
if( m_image_index < m_converted_images.size() )
{
fname = m_converted_images[ m_image_index ];
- source = m_image_list[ m_image_index ];
- // wrap to beginning of list when all images are displayed
- m_image_index += 1;
- if( m_image_index >= m_converted_images.size() )
- {
- m_image_index = 0;
- }
+ }
+ source = m_image_list[ m_image_index ];
+
+ // wrap to beginning of list when all images are displayed
+ m_image_index += 1;
+ if( m_image_index >= m_converted_images.size() )
+ {
+ m_image_index = 0;
}
Unlock();
@@ -110,7 +112,7 @@ void mgImageProvider::deleteTemporaryImages()
for( vector<string>::iterator iter = m_image_list.begin(); iter != m_image_list.end(); iter ++ )
{
// remove( (*iter).c_str() );
- cout << "Removing " << *iter << endl;
+ // cout << "Removing " << *iter << endl;
}
m_delete_imgs_from_tag = false;
}
@@ -119,7 +121,7 @@ void mgImageProvider::deleteTemporaryImages()
for( vector<string>::iterator iter = m_converted_images.begin(); iter != m_converted_images.end(); iter ++ )
{
// remove( (*iter).c_str() );
- cout << "Removing " << *iter << endl;
+ // cout << "Removing " << *iter << endl;
}
m_converted_images.clear();
}
@@ -146,7 +148,6 @@ bool mgImageProvider::extractImagesFromDatabase( mgItemGd *item )
Thanks to viking (from vdrportal.de) for help with this
*/
string file = item->getImagePath();
-
if( file == "" )
{
return false;
@@ -172,37 +173,72 @@ bool mgImageProvider::extractImagesFromDatabase( mgItemGd *item )
while( (ftsent = fts_read(fts)) != NULL )
{
- mode_t mode = ftsent->fts_statp->st_mode;
- if( mode & S_IFDIR && ftsent->fts_info & FTS_D )
- {
- // a directory -- check whether name is [0-9][0-9] (GD Dir), skip otherwise
- if( !regexec( &path_rex, ftsent->fts_name, 0, NULL, 0 ) )
- {
- fts_set( fts, ftsent, FTS_SKIP );
- mgDebug(1,"Skipping directory %s",ftsent->fts_path);
- }
- }
- if( !( mode & S_IFREG ) )
+ switch( ftsent->fts_info )
{
- continue;
- }
- if( ftsent->fts_info & FTS_F )
- {
- // check against GD filename also
- if( !strcmp( ftsent->fts_name, file.c_str() ) )
- {
- if( access(ftsent->fts_path, R_OK) )
- {
- mgDebug( 1, "Ignoring unreadable file %s",
- ftsent->fts_path);
- continue;
- }
-
- m_image_list.push_back( string( ftsent->fts_path ) );
- mgDebug( 1, "Found image %s", ftsent->fts_path );
-
- result = true;
- }
+ case FTS_DC:
+ {
+ mgDebug( 1, "Image import: Ignoring directory %s, would cycle already seen %s",
+ ftsent->fts_path,ftsent->fts_cycle->fts_path );
+ } break;
+ case FTS_DNR:
+ {
+ mgDebug( 1, "Ignoring unreadable directory %s: error %d",
+ ftsent->fts_path,ftsent->fts_errno);
+ } break;
+ case FTS_DOT:
+ {
+ mgDebug( 1, "Ignoring dot file %s:",
+ ftsent->fts_path );
+ } break;
+ case FTS_SLNONE:
+ {
+ mgDebug(1,"Ignoring broken symbolic link %s",
+ ftsent->fts_path);
+ } break;
+ case FTS_NSOK: // should never happen because we do not do FTS_NOSTAT
+ case FTS_SL: // should never happen because we do FTS_LOGICAL
+ case FTS_ERR:
+ {
+ mgDebug( 1, "Ignoring %s: error %d",
+ ftsent->fts_path,ftsent->fts_errno );
+ } break;
+ case FTS_D:
+ {
+ if( !regexec( &path_rex, ftsent->fts_name, 0, NULL, 0 ) )
+ {
+ fts_set( fts, ftsent, FTS_SKIP );
+ mgDebug( 1, "Skipping directory %s", ftsent->fts_path );
+ }
+ } break;
+ case FTS_DP:
+ break;
+ case FTS_F:
+ {
+ if( !ftsent->fts_path )
+ {
+ mgDebug( 1, "internal error: fts_path is 0" );
+ }
+ else if( access( ftsent->fts_path, R_OK ) )
+ {
+ mgDebug( 1, "Ignoring unreadable file %s: %s",
+ ftsent->fts_path, strerror( errno ) );
+ }
+ else
+ {
+ m_image_list.push_back( string( ftsent->fts_path ) );
+ mgDebug( 1, "Found image %s", ftsent->fts_path );
+ }
+ } break;
+ case FTS_NS:
+ {
+ mgDebug( 1, "Ignoring unstatable file %s: error %d",
+ ftsent->fts_path,ftsent->fts_errno );
+ } break;
+ default:
+ {
+ mgDebug( 1, "Ignoring %s: unknown fts_info value %d",
+ ftsent->fts_path,ftsent->fts_info );
+ }
}
}
fts_close(fts);
@@ -303,10 +339,9 @@ void mgImageProvider::Action()
// assemble path from relative paths
string tmpFile = string( the_setup.ImageCacheDir ) + string( "/" ) + bname.substr( 0, dotpos ) + string( ".mpg" );
- // cout << "Converting " << filename << " to " << tmpFile << endl << flush;
char *tmp;
- asprintf( &tmp, "image_convert.sh \"%s\" \"%s\"", filename.c_str(), tmpFile.c_str() );
+ asprintf( &tmp, "/usr/local/bin/image_convert.sh \"%s\" \"%s\"", filename.c_str(), tmpFile.c_str() );
system( (const char*) tmp );
free(tmp);
@@ -337,7 +372,6 @@ void mgImageProvider::fillImageList( string dir )
{
string fname = dir + "/" + string( files[i]->d_name );
m_image_list.push_back( fname );
- // cout << "Added " << fname << endl;
free( files[i] );
}
free( files );
@@ -345,7 +379,7 @@ void mgImageProvider::fillImageList( string dir )
}
void mgImageProvider::writeImage( TagLib::ByteVector &image, int num, string &image_cache )
-{
+{
char* image_data = image.data();
int len = image.size();
diff --git a/vdr_player.c b/vdr_player.c
index 9444c71..e508fc3 100644
--- a/vdr_player.c
+++ b/vdr_player.c
@@ -1024,17 +1024,19 @@ void mgPCMPlayer::CheckImage()
m_current_image = m_img_provider->getImagePath( source );
// check for TFT display of image
- TransferImageTFT( source );
+ if( !source.empty() )
+ {
+ TransferImageTFT( source );
+ }
// check for background display of image
- if( the_setup.BackgrMode == 1 )
+ if( !m_current_image.empty() )
{
- if( !m_current_image.empty() )
+ if( the_setup.BackgrMode == 1 )
{
- cout << m_index << ": Showing image " << m_current_image << endl << flush;
ShowImage();
- m_lastshow = m_index;
}
+ m_lastshow = m_index;
}
}
}
@@ -1320,7 +1322,7 @@ mgPlayerControl::NewImagePlaylist( const char *directory )
{
if (player)
{
- cout << "Signaling new image playlist to player: " << directory << endl << flush;
+ // cout << "Signaling new image playlist to player: " << directory << endl << flush;
player->NewImagePlaylist (directory);
}
}