1 | diff --git a/mythtv/programs/mythbackend/services/guide.cpp b/mythtv/programs/mythbackend/services/guide.cpp |
---|
2 | index 9132243..fd214a8 100644 |
---|
3 | --- a/mythtv/programs/mythbackend/services/guide.cpp |
---|
4 | +++ b/mythtv/programs/mythbackend/services/guide.cpp |
---|
5 | @@ -33,6 +33,8 @@ |
---|
6 | #include "scheduler.h" |
---|
7 | #include "autoexpire.h" |
---|
8 | #include "channelutil.h" |
---|
9 | +#include "mythcorecontext.h" |
---|
10 | +#include "storagegroup.h" |
---|
11 | |
---|
12 | extern AutoExpire *expirer; |
---|
13 | extern Scheduler *sched; |
---|
14 | @@ -225,9 +227,34 @@ QFileInfo Guide::GetChannelIcon( int nChanId, |
---|
15 | // Get Icon file path |
---|
16 | |
---|
17 | QString sFileName = ChannelUtil::GetIcon( nChanId ); |
---|
18 | + QString sChannelIconsDir; |
---|
19 | + StorageGroup sg; |
---|
20 | |
---|
21 | - if (sFileName.isEmpty()) |
---|
22 | + if (sFileName.isEmpty() || !QFileInfo( sFileName ).isReadable() ) |
---|
23 | + { |
---|
24 | + LOG( VB_UPNP, LOG_DEBUG, QString( "chanid '%1' has no readable icon" ) |
---|
25 | + .arg( nChanId ) ); |
---|
26 | return QFileInfo(); |
---|
27 | + } |
---|
28 | + |
---|
29 | + if ( !sFileName.startsWith( "/" ) ) |
---|
30 | + { |
---|
31 | + |
---|
32 | + sg.Init( "ChannelIcons", gCoreContext->GetHostName(), false ); |
---|
33 | + |
---|
34 | + sChannelIconsDir = sg.GetFirstDir(); |
---|
35 | + |
---|
36 | + if ( sChannelIconsDir.isEmpty() ) |
---|
37 | + { |
---|
38 | + LOG( VB_UPNP, LOG_DEBUG, |
---|
39 | + QString( "No 'ChannelIcons' Storage Group (icon '%1')" ) |
---|
40 | + .arg( sFileName ) ); |
---|
41 | + return QFileInfo(); |
---|
42 | + } |
---|
43 | + |
---|
44 | + sFileName = QString( "%1/%2" ).arg(sChannelIconsDir).arg(sFileName); |
---|
45 | + |
---|
46 | + } |
---|
47 | |
---|
48 | if ((nWidth <= 0) && (nHeight <= 0)) |
---|
49 | { |
---|
50 | @@ -277,7 +304,12 @@ QFileInfo Guide::GetChannelIcon( int nChanId, |
---|
51 | QImage img = pImage->scaled( nWidth, nHeight, Qt::IgnoreAspectRatio, |
---|
52 | Qt::SmoothTransformation); |
---|
53 | |
---|
54 | - img.save( sNewFileName, "PNG" ); |
---|
55 | + if ( !img.save( sNewFileName, "PNG" ) ) |
---|
56 | + { |
---|
57 | + LOG( VB_UPNP, LOG_DEBUG, |
---|
58 | + QString( "Can't save channel icon: '%1'" ).arg( sNewFileName ) ); |
---|
59 | + return QFileInfo(); |
---|
60 | + } |
---|
61 | |
---|
62 | delete pImage; |
---|