Changeset 8f1ab5426 in mythtv


Ignore:
Timestamp:
Jul 5, 2017, 8:59:37 PM (7 years ago)
Author:
Bill Meek <bmeek@…>
Branches:
devel/2020-player, devel/ffmpeg-resync, fixes/29, fixes/30, fixes/31, github-templates, master
Children:
0b7e144d87, 7388b5a60
Parents:
606192062
Message:

Services API: Log more Guide/GetChannelIcon? errors

The primary fix is for folks that create a link between
~mythtv/.mythtv/channels and ~/.mythtv/channels, but
forget to make their channels directory writable by
the user running the backend. The link solution (rather
than running mythtv-setup as user mythtv) appears in
the Wiki and the Forum. When the new copy of the image
is attempted, e.g using Height=57, it failed.

Log and tell the user if the ChanId? doesn't exist or is
marked invisible.

If the image can't be scaled, log the error. Happens now
when lyngsat returns text files rather than images.

Use upnp filtering to see the new logs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mythtv/programs/mythbackend/services/guide.cpp

    r606192062 r8f1ab5426  
    374374
    375375    if (sFileName.isEmpty())
    376         return QFileInfo();
     376    {
     377        LOG(VB_UPNP, LOG_ERR,
     378            QString("GetImageFile - ChanId %1 doesn't exist or isn't visible")
     379                    .arg(nChanId));
     380        return QFileInfo();
     381    }
    377382
    378383    // ------------------------------------------------------------------
     
    425430    // ----------------------------------------------------------------------
    426431
     432    QString sChannelsDirectory = QFileInfo( sNewFileName ).absolutePath();
     433
     434    if (!QFileInfo( sChannelsDirectory ).isWritable())
     435    {
     436        LOG(VB_UPNP, LOG_ERR, QString("GetImageFile - no write access to: %1")
     437            .arg( sChannelsDirectory ));
     438        return QFileInfo();
     439    }
     440
    427441    float fAspect = 0.0;
    428442
     
    430444
    431445    if (!pImage)
    432         return QFileInfo();
     446    {
     447        LOG(VB_UPNP, LOG_ERR, QString("GetImageFile - can't create image: %1")
     448            .arg( sFullFileName ));
     449        return QFileInfo();
     450    }
    433451
    434452    if (fAspect <= 0)
     
    437455    if (fAspect == 0)
    438456    {
     457        LOG(VB_UPNP, LOG_ERR, QString("GetImageFile - zero aspect"));
    439458        delete pImage;
    440459        return QFileInfo();
     
    450469                                Qt::SmoothTransformation);
    451470
    452     img.save( sNewFileName, "PNG" );
     471    if (img.isNull())
     472    {
     473        LOG(VB_UPNP, LOG_ERR, QString("SaveImageFile - unable to scale. "
     474            "See if %1 is really an image.").arg( sFullFileName ));
     475        delete pImage;
     476        return QFileInfo();
     477    }
     478
     479    if (!img.save( sNewFileName, "PNG" ))
     480    {
     481        LOG(VB_UPNP, LOG_ERR, QString("SaveImageFile - failed, %1")
     482            .arg( sNewFileName ));
     483        delete pImage;
     484        return QFileInfo();
     485    }
    453486
    454487    delete pImage;
Note: See TracChangeset for help on using the changeset viewer.