Ticket #3579: findfirstnodeimage.4.diff

File findfirstnodeimage.4.diff, 2.4 KB (added by robert.mcnamara@…, 15 years ago)

Fix issue if no metadata was found in the folder.

  • mythvideo/mythvideo/videodlg.cpp

     
    23312331                fList = vidDir.entryList();
    23322332            }
    23332333
     2334            // Take the Coverfile for the first valid node in the dir, if it exists.
     2335            if (icon_file.isEmpty())
     2336            {
     2337                int list_count = node->childCount();
     2338                if (list_count > 0)
     2339                {
     2340                    for (int i = 0; i < list_count; i++)
     2341                    {
     2342                        MythGenericTree *subnode = node->getChildAt(i);
     2343                        if (subnode)
     2344                        {
     2345                            Metadata *metadata = GetMetadataPtrFromNode(subnode);
     2346                            if (metadata)
     2347                            {
     2348                                if (!metadata->GetHost().isEmpty() &&
     2349                                    !metadata->GetCoverFile().startsWith("/"))
     2350                                {
     2351                                    QString test_file = GenRemoteFileURL("Coverart",
     2352                                                metadata->GetHost(), metadata->GetCoverFile());
     2353                                    if (!test_file.endsWith("/") && !test_file.isEmpty() &&
     2354                                        !test_file.endsWith(VIDEO_COVERFILE_DEFAULT))
     2355                                    {
     2356                                        icon_file = test_file;
     2357                                        break;
     2358                                    }
     2359                                }
     2360                                else
     2361                                {
     2362                                    QString test_file = metadata->GetCoverFile();
     2363                                    if (!test_file.isEmpty() &&
     2364                                         test_file != VIDEO_COVERFILE_DEFAULT)
     2365                                    {
     2366                                        icon_file = test_file;
     2367                                        break;
     2368                                    }
     2369                                }
     2370                            }
     2371                        }
     2372                    }
     2373                }
     2374            }
     2375
    23342376            if (!fList.isEmpty())
    23352377            {
    23362378                if (host.isEmpty())