Example #1
0
void Interface_GUIControlButton::SetLabel(void* kodiBase, void* handle, const char *label)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlButton::%s - invalid data", __FUNCTION__);
    return;
  }

  if (handle)
    static_cast<CGUIButtonControl *>(handle)->SetLabel(label);
  else
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlButton::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
}
Example #2
0
bool Interface_GUIDialogKeyboard::show_and_verify_new_password_with_head(void* kodiBase, char** password_out, const char* heading,
                                                                         bool allowEmpty, unsigned int auto_close_ms)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogKeyboard::%s - invalid data", __FUNCTION__);
    return false;
  }

  if (!password_out || !heading)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogKeyboard::%s - invalid handler data (password_out='%p', heading='%p') on addon '%s'",
                          __FUNCTION__, password_out, heading, addon->ID().c_str());
    return false;
  }

  std::string str;
  bool bRet = CGUIKeyboardFactory::ShowAndVerifyNewPassword(str, heading, allowEmpty, auto_close_ms);
  if (bRet)
    *password_out = strdup(str.c_str());
  return bRet;
}
Example #3
0
bool Interface_GUIDialogKeyboard::show_and_get_filter(void* kodiBase, const char* text_in, char** text_out, bool searching, unsigned int auto_close_ms)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogKeyboard::%s - invalid data", __FUNCTION__);
    return false;
  }

  if (!text_in || !text_out)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogKeyboard::%s - invalid handler data (text_in='%p', text_out='%p') on addon '%s'",
                          __FUNCTION__, text_in, text_out, addon->ID().c_str());
    return false;
  }


  std::string str = text_in;
  bool bRet = CGUIKeyboardFactory::ShowAndGetFilter(str, searching, auto_close_ms);
  if (bRet)
    *text_out = strdup(str.c_str());
  return bRet;
}
Example #4
0
int Interface_GUIWindow::get_focus_id(void* kodiBase, void* handle)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle);
  if (!addon || !pAddonWindow)
  {
    CLog::Log(
        LOGERROR,
        "Interface_GUIWindow::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
        __FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
    return -1;
  }

  Interface_GUIGeneral::lock();
  int control_id = pAddonWindow->GetFocusedControlID();
  Interface_GUIGeneral::unlock();

  if (control_id == -1)
    CLog::Log(LOGERROR, "Interface_GUIWindow - %s: %s - No control in this window has focus",
              __FUNCTION__, addon->Name().c_str());

  return control_id;
}
Example #5
0
bool CAddonDll::get_setting_int(void* kodiBase, const char* id, int* value)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (addon == nullptr || id == nullptr || value == nullptr)
  {
    CLog::Log(LOGERROR, "kodi::General::%s - invalid data (addon='%p', id='%p', value='%p')",
                                        __FUNCTION__, kodiBase, static_cast<const void*>(id), static_cast<void*>(value));

    return false;
  }

  if (!addon->ReloadSettings())
  {
    CLog::Log(LOGERROR, "kodi::General::%s - could't get settings for add-on '%s'", __FUNCTION__, addon->Name().c_str());
    return false;
  }

  auto setting = addon->GetSettings()->GetSetting(id);
  if (setting == nullptr)
  {
    CLog::Log(LOGERROR, "kodi::General::%s - can't find setting '%s' in '%s'", __FUNCTION__, id, addon->Name().c_str());
    return false;
  }

  if (setting->GetType() != SettingType::Integer && setting->GetType() != SettingType::Number)
  {
    CLog::Log(LOGERROR, "kodi::General::%s - setting '%s' is not a integer in '%s'", __FUNCTION__, id, addon->Name().c_str());
    return false;
  }

  if (setting->GetType() == SettingType::Integer)
    *value = std::static_pointer_cast<CSettingInt>(setting)->GetValue();
  else
    *value = static_cast<int>(std::static_pointer_cast<CSettingNumber>(setting)->GetValue());
  return true;
}
Example #6
0
bool CAddonDll::set_setting_string(void* kodiBase, const char* id, const char* value)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (addon == nullptr || id == nullptr || value == nullptr)
  {
    CLog::Log(LOGERROR, "kodi::General::%s - invalid data (addon='%p', id='%p', value='%p')",
                                        __FUNCTION__, kodiBase, static_cast<const void*>(id), static_cast<const void*>(value));

    return false;
  }

  if (addon->UpdateSettingInActiveDialog(id, value))
    return true;

  if (!addon->UpdateSettingString(id, value))
  {
    CLog::Log(LOGERROR, "kodi::General::%s - invalid setting type", __FUNCTION__);
    return false;
  }

  addon->SaveSettings();

  return true;
}
Example #7
0
//@{
bool Interface_GUIWindow::set_focus_id(void* kodiBase, void* handle, int control_id)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle);
  if (!addon || !pAddonWindow)
  {
    CLog::Log(LOGERROR, "Interface_GUIWindow::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
                          __FUNCTION__, addon, pAddonWindow, addon ? addon->ID().c_str() : "unknown");
    return false;
  }

  if (!pAddonWindow->GetControl(control_id))
  {
    CLog::Log(LOGERROR, "Interface_GUIWindow - %s: %s - Control does not exist in window", __FUNCTION__, addon->Name().c_str());
    return false;
  }

  Interface_GUIGeneral::lock();
  CGUIMessage msg(GUI_MSG_SETFOCUS, pAddonWindow->m_windowId, control_id);
  pAddonWindow->OnMessage(msg);
  Interface_GUIGeneral::unlock();

  return true;
}
Example #8
0
bool Interface_GUIDialogKeyboard::show_and_get_input_with_head(void* kodiBase, const char* text_in, char** text_out,
                                                               const char* heading, bool allow_empty_result,
                                                               bool hidden_input, unsigned int auto_close_ms)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogKeyboard::%s - invalid data", __FUNCTION__);
    return false;
  }

  if (!text_in || !text_out || !heading)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogKeyboard::%s - invalid handler data (text_in='%p', text_out='%p', heading='%p') on addon '%s'",
                          __FUNCTION__, text_in, text_out, heading, addon->ID().c_str());
    return false;
  }

  std::string str = text_in;
  bool bRet = CGUIKeyboardFactory::ShowAndGetInput(str, CVariant{heading}, allow_empty_result, hidden_input, auto_close_ms);
  if (bRet)
    *text_out = strdup(str.c_str());
  return bRet;
}
Example #9
0
char* Interface_General::get_temp_path(void* kodiBase)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (addon == nullptr)
  {
    CLog::Log(LOGERROR, "Interface_General::%s - called with empty kodi instance pointer", __FUNCTION__);
    return nullptr;
  }

  const std::string tempPath = URIUtils::AddFileToFolder(CServiceBroker::GetBinaryAddonManager().GetTempAddonBasePath(), addon->ID());
  if (!XFILE::CDirectory::Exists(tempPath))
    XFILE::CDirectory::Create(tempPath);

  return strdup(CSpecialProtocol::TranslatePath(tempPath).c_str());
}
Example #10
0
bool Interface_GUIDialogNumeric::show_and_get_seconds(void* kodiBase, const char* time_in, char** time_out, const char *heading)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogNumeric::%s - invalid data", __FUNCTION__);
    return false;
  }

  if (!time_in || !time_out || !heading)
  {
    CLog::Log(LOGERROR,
              "Interface_GUIDialogNumeric::%s - invalid handler data (time_in='%p', time_out='%p', "
              "heading='%p') on addon '%s'",
              __FUNCTION__, time_in, static_cast<void*>(time_out), heading, addon->ID().c_str());
    return false;
  }

  std::string str = time_in;
  bool bRet = CGUIDialogNumeric::ShowAndGetSeconds(str, heading);
  if (bRet)
    *time_out = strdup(str.c_str());
  return bRet;
}
Example #11
0
bool Interface_GUIWindow::show(void* kodiBase, void* handle)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIAddonWindow* pAddonWindow = static_cast<CGUIAddonWindow*>(handle);
  if (!addon || !pAddonWindow)
  {
    CLog::Log(LOGERROR, "Interface_GUIWindow::%s - invalid handler data (handle='%p') on addon '%s'",
                          __FUNCTION__, handle, addon ? addon->ID().c_str() : "unknown");
    return false;
  }

  if (pAddonWindow->m_oldWindowId != pAddonWindow->m_windowId && 
      pAddonWindow->m_windowId != g_windowManager.GetActiveWindow())
    pAddonWindow->m_oldWindowId = g_windowManager.GetActiveWindow();

  Interface_GUIGeneral::lock();
  if (pAddonWindow->IsDialog())
    dynamic_cast<CGUIAddonWindowDialog*>(pAddonWindow)->Show();
  else
    g_windowManager.ActivateWindow(pAddonWindow->GetID());
  Interface_GUIGeneral::unlock();

  return true;
}
Example #12
0
bool Interface_GUIDialogKeyboard::show_and_get_new_password(void* kodiBase, const char* password_in, char** password_out, unsigned int auto_close_ms)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogKeyboard::%s - invalid data", __FUNCTION__);
    return false;
  }

  if (!password_in || !password_out)
  {
    CLog::Log(LOGERROR,
              "Interface_GUIDialogKeyboard::%s - invalid handler data (password_in='%p', "
              "password_out='%p') on addon '%s'",
              __FUNCTION__, password_in, static_cast<void*>(password_out), addon->ID().c_str());
    return false;
  }

  std::string str = password_in;
  bool bRet = CGUIKeyboardFactory::ShowAndGetNewPassword(str, auto_close_ms);
  if (bRet)
    *password_out = strdup(str.c_str());
  return bRet;
}
Example #13
0
void Interface_GUIDialogProgress::set_line(void* kodiBase, void* handle, unsigned int line, const char* text)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle || !text)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid handler data (handle='%p', text='%p') on addon '%s'", __FUNCTION__, handle, text, addon->ID().c_str());
    return;
  }

  static_cast<CGUIDialogProgress*>(handle)->SetLine(line, text);
}
Example #14
0
void Interface_GUIDialogProgress::open(void* kodiBase, void* handle)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid handler data (handle='%p') on addon '%s'", __FUNCTION__, handle, addon->ID().c_str());
    return;
  }

  static_cast<CGUIDialogProgress*>(handle)->Open();
}
Example #15
0
void Interface_GUIDialogProgress::set_heading(void* kodiBase, void* handle, const char* heading)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle || !heading)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid handler data (handle='%p', heading='%p') on addon '%s'", __FUNCTION__, handle, heading, addon->ID().c_str());
    return;
  }

  static_cast<CGUIDialogProgress*>(handle)->SetHeading(heading);
}
Example #16
0
float Interface_GUIControlSlider::GetFloatValue(void* kodiBase, void* handle)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid data", __FUNCTION__);
    return 0.0f;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return 0.0f;
  }

  return static_cast<CGUISliderControl*>(handle)->GetFloatValue();
}
Example #17
0
void Interface_GUIControlSlider::SetEnabled(void* kodiBase, void* handle, bool enabled)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return;
  }

  static_cast<CGUISliderControl*>(handle)->SetEnabled(enabled);
}
Example #18
0
void* Interface_GUIDialogProgress::new_dialog(void* kodiBase)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid data", __FUNCTION__);
    return nullptr;
  }

  CGUIDialogProgress *dialog = g_windowManager.GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS);
  if (!dialog)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogProgress::%s - invalid handler data (dialog='%p') on addon '%s'", __FUNCTION__, dialog, addon->ID().c_str());
    return nullptr;
  }

  return dialog;
}
void Interface_GUIControlSettingsSlider::SetIntRange(void* kodiBase, void* handle, int start, int end)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return;
  }

  CGUISettingsSliderControl* pControl = static_cast<CGUISettingsSliderControl*>(handle);
  pControl->SetType(SLIDER_CONTROL_TYPE_INT);
  pControl->SetRange(start, end);
}
Example #20
0
void Interface_GUIControlSlider::SetFloatValue(void* kodiBase, void* handle, float value)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return;
  }

  CGUISliderControl* pControl = static_cast<CGUISliderControl *>(handle);
  pControl->SetType(SLIDER_CONTROL_TYPE_FLOAT);
  pControl->SetFloatValue(value);
}
Example #21
0
void Interface_GUIControlSlider::GetDescription(void* kodiBase, void* handle, char &label, unsigned int &maxStringSize)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return;
  }

  std::string text = static_cast<CGUISliderControl*>(handle)->GetDescription();
  strncpy(&label, text.c_str(), maxStringSize);
  maxStringSize = text.length();
}
Example #22
0
void Interface_GUIControlSlider::Reset(void* kodiBase, void* handle)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return;
  }

  CGUISliderControl* pControl = static_cast<CGUISliderControl*>(handle);

  CGUIMessage msg(GUI_MSG_LABEL_RESET, pControl->GetParentID(), pControl->GetID());
  g_windowManager.SendThreadMessage(msg, pControl->GetParentID());
}
Example #23
0
void Interface_GUIControlButton::GetLabel(void* kodiBase, void* handle, char &label, unsigned int &iMaxStringSize)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlButton::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlButton::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return;
  }

  CGUIButtonControl* pButton = static_cast<CGUIButtonControl *>(handle);
  std::string text = pButton->GetLabel();
  strncpy(&label, text.c_str(), iMaxStringSize);
  iMaxStringSize = text.length();
}
void Interface_GUIControlSettingsSlider::SetText(void* kodiBase, void* handle, const char *text)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid data", __FUNCTION__);
    return;
  }

  if (!handle || !text)
  {
    CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
    return;
  }

  CGUISettingsSliderControl* pControl = static_cast<CGUISettingsSliderControl*>(handle);

  // create message
  CGUIMessage msg(GUI_MSG_LABEL_SET, pControl->GetParentID(), pControl->GetID());
  msg.SetLabel(text);

  // send message
  g_windowManager.SendThreadMessage(msg, pControl->GetParentID());
}
Example #25
0
//@{
void* Interface_GUIWindow::create(void* kodiBase, const char* xml_filename,
                                  const char* default_skin, bool as_dialog, bool is_media)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon || !xml_filename || !default_skin)
  {
    CLog::Log(LOGERROR, "Interface_GUIWindow::%s - invalid handler data (xml_filename='%p', default_skin='%p') on addon '%s'",
                          __FUNCTION__, xml_filename, default_skin, addon ? addon->ID().c_str() : "unknown");
    return nullptr;
  }

  if (as_dialog && is_media)
  {
    CLog::Log(LOGWARNING, "Interface_GUIWindow::%s: %s/%s - addon tries to create dialog as media window who not allowed, contact Developer '%s' of this addon",
                __FUNCTION__, CAddonInfo::TranslateType(addon->Type()).c_str(), addon->Name().c_str(), addon->Author().c_str());
  }

  RESOLUTION_INFO res;
  std::string strSkinPath = g_SkinInfo->GetSkinPath(xml_filename, &res);

  if (!XFILE::CFile::Exists(strSkinPath))
  {
    std::string str("none");
    ADDON::CAddonInfo addonInfo(str, ADDON::ADDON_SKIN);

    // Check for the matching folder for the skin in the fallback skins folder
    std::string fallbackPath = URIUtils::AddFileToFolder(addon->Path(), "resources", "skins");
    std::string basePath = URIUtils::AddFileToFolder(fallbackPath, g_SkinInfo->ID());

    strSkinPath = g_SkinInfo->GetSkinPath(xml_filename, &res, basePath);

    // Check for the matching folder for the skin in the fallback skins folder (if it exists)
    if (XFILE::CFile::Exists(basePath))
    {
      addonInfo.SetPath(basePath);
      ADDON::CSkinInfo skinInfo(addonInfo, res);
      skinInfo.Start();
      strSkinPath = skinInfo.GetSkinPath(xml_filename, &res);
    }

    if (!XFILE::CFile::Exists(strSkinPath))
    {
      // Finally fallback to the DefaultSkin as it didn't exist in either the Kodi Skin folder or the fallback skin folder
      addonInfo.SetPath(URIUtils::AddFileToFolder(fallbackPath, default_skin));
      ADDON::CSkinInfo skinInfo(addonInfo, res);

      skinInfo.Start();
      strSkinPath = skinInfo.GetSkinPath(xml_filename, &res);
      if (!XFILE::CFile::Exists(strSkinPath))
      {
        CLog::Log(LOGERROR, "Interface_GUIWindow::%s: %s/%s - XML File '%s' for Window is missing, contact Developer '%s' of this addon",
                    __FUNCTION__, CAddonInfo::TranslateType(addon->Type()).c_str(), addon->Name().c_str(), strSkinPath.c_str(), addon->Author().c_str());
        return nullptr;
      }
    }
  }

  int id = GetNextAvailableWindowId();
  if (id < 0)
    return nullptr;

  CGUIWindow *window;
  if (!as_dialog)
    window = new CGUIAddonWindow(id, strSkinPath, addon, is_media);
  else
    window = new CGUIAddonWindowDialog(id, strSkinPath, addon);

  Interface_GUIGeneral::lock();
  g_windowManager.Add(window);
  Interface_GUIGeneral::unlock();

  if (!dynamic_cast<CGUIWindow*>(g_windowManager.GetWindow(id)))
  {
    CLog::Log(LOGERROR, "Interface_GUIWindow::%s - Requested window id '%i' does not exist for addon '%s'",
                          __FUNCTION__, id, addon->ID().c_str());
    delete window;
    return nullptr;
  }
  window->SetCoordsRes(res);
  return window;
}
Example #26
0
char* Interface_General::get_addon_info(void* kodiBase, const char* id)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (addon == nullptr || id == nullptr)
  {
    CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', id='%p')", __FUNCTION__, addon, id);
    return nullptr;
  }

  std::string str;
  if (strcmpi(id, "author") == 0)
    str = addon->Author();
  else if (strcmpi(id, "changelog") == 0)
    str = addon->ChangeLog();
  else if (strcmpi(id, "description") == 0)
    str = addon->Description();
  else if (strcmpi(id, "disclaimer") == 0)
    str = addon->Disclaimer();
  else if (strcmpi(id, "fanart") == 0)
    str = addon->FanArt();
  else if (strcmpi(id, "icon") == 0)
    str = addon->Icon();
  else if (strcmpi(id, "id") == 0)
    str = addon->ID();
  else if (strcmpi(id, "name") == 0)
    str = addon->Name();
  else if (strcmpi(id, "path") == 0)
    str = addon->Path();
  else if (strcmpi(id, "profile") == 0)
    str = addon->Profile();
  else if (strcmpi(id, "summary") == 0)
    str = addon->Summary();
  else if (strcmpi(id, "type") == 0)
    str = ADDON::CAddonInfo::TranslateType(addon->Type());
  else if (strcmpi(id, "version") == 0)
    str = addon->Version().asString();
  else
  {
    CLog::Log(LOGERROR, "Interface_General::%s -  add-on '%s' requests invalid id '%s'",
                          __FUNCTION__, addon->Name().c_str(), id);
    return nullptr;
  }

  char* buffer = strdup(str.c_str());
  return buffer;
}