summaryrefslogtreecommitdiffstats
path: root/xbmc/pvr/PVRStreamProperties.cpp
blob: 272b33aa2506e810199c542a6925e4fa865a2431 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 *  Copyright (C) 2012-2019 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "PVRStreamProperties.h"

#include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_general.h"
#include "utils/StringUtils.h"

#include <algorithm>

using namespace PVR;

std::string CPVRStreamProperties::GetStreamURL() const
{
  const auto it = std::find_if(cbegin(), cend(), [](const auto& prop) {
    return prop.first == PVR_STREAM_PROPERTY_STREAMURL;
  });
  return it != cend() ? (*it).second : std::string();
}

std::string CPVRStreamProperties::GetStreamMimeType() const
{
  const auto it = std::find_if(cbegin(), cend(), [](const auto& prop) {
    return prop.first == PVR_STREAM_PROPERTY_MIMETYPE;
  });
  return it != cend() ? (*it).second : std::string();
}

bool CPVRStreamProperties::EPGPlaybackAsLive() const
{
  const auto it = std::find_if(cbegin(), cend(), [](const auto& prop) {
    return prop.first == PVR_STREAM_PROPERTY_EPGPLAYBACKASLIVE;
  });
  return it != cend() ? StringUtils::EqualsNoCase((*it).second, "true") : false;
}