| 460 | | info->filename = host.isEmpty() ? filename |
| 461 | | : generate_file_url("Videos", host, filename); |
| | 460 | |
| | 461 | // try to find the file locally |
| | 462 | if (host.isEmpty()) |
| | 463 | { |
| | 464 | // must be already be a local filename? |
| | 465 | info->filename = filename; |
| | 466 | } |
| | 467 | else |
| | 468 | { |
| | 469 | // if the file is on this host then we should be able to find it locally |
| | 470 | if (host == gCoreContext->GetHostName()) |
| | 471 | { |
| | 472 | StorageGroup videoGroup("Videos", gCoreContext->GetHostName(), false); |
| | 473 | info->filename = videoGroup.FindFile(filename); |
| | 474 | |
| | 475 | // sanity check the file exists |
| | 476 | if (!QFile::exists(info->filename)) |
| | 477 | { |
| | 478 | LOG(VB_GENERAL, LOG_ERR, |
| | 479 | QString("VideoSelector: Failed to find local file '%1'").arg(info->filename)); |
| | 480 | info->filename.clear(); |
| | 481 | } |
| | 482 | } |
| | 483 | |
| | 484 | if (info->filename.isEmpty()) |
| | 485 | { |
| | 486 | // file must not be local or doesn't exist |
| | 487 | info->filename = generate_file_url("Videos", host, filename); |
| | 488 | } |
| | 489 | } |
| | 490 | |
| | 491 | LOG(VB_GENERAL, LOG_INFO, |
| | 492 | QString("VideoSelector: found file '%1'").arg(info->filename)); |
| | 493 | |