Skip to content

Commit

Permalink
Expand Player class for game metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
NikosSiak committed Nov 6, 2021
1 parent 1db07cd commit 4690416
Show file tree
Hide file tree
Showing 10 changed files with 461 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xbmc/games/tags/GameInfoTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void CGameInfoTag::Reset()
m_strFormat.clear();
m_strCartridgeType.clear();
m_strGameClient.clear();
m_strCaption.clear();
}

CGameInfoTag& CGameInfoTag::operator=(const CGameInfoTag& tag)
Expand All @@ -52,6 +53,7 @@ CGameInfoTag& CGameInfoTag::operator=(const CGameInfoTag& tag)
m_strFormat = tag.m_strFormat;
m_strCartridgeType = tag.m_strCartridgeType;
m_strGameClient = tag.m_strGameClient;
m_strCaption = tag.m_strCaption;
}
return *this;
}
Expand Down Expand Up @@ -91,6 +93,8 @@ bool CGameInfoTag::operator==(const CGameInfoTag& tag) const
return false;
if (m_strGameClient != tag.m_strGameClient)
return false;
if (m_strCaption != tag.m_strCaption)
return false;
}
}
return true;
Expand All @@ -114,6 +118,7 @@ void CGameInfoTag::Archive(CArchive& ar)
ar << m_strFormat;
ar << m_strCartridgeType;
ar << m_strGameClient;
ar << m_strCaption;
}
else
{
Expand All @@ -131,6 +136,7 @@ void CGameInfoTag::Archive(CArchive& ar)
ar >> m_strFormat;
ar >> m_strCartridgeType;
ar >> m_strGameClient;
ar >> m_strCaption;
}
}

Expand All @@ -150,6 +156,7 @@ void CGameInfoTag::Serialize(CVariant& value) const
value["format"] = m_strFormat;
value["cartridgetype"] = m_strCartridgeType;
value["gameclient"] = m_strGameClient;
value["caption"] = m_strCaption;
}

void CGameInfoTag::ToSortable(SortItem& sortable, Field field) const
Expand Down
5 changes: 5 additions & 0 deletions xbmc/games/tags/GameInfoTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class CGameInfoTag : public IArchivable, public ISerializable, public ISortable
const std::string& GetGameClient() const { return m_strGameClient; }
void SetGameClient(const std::string& strGameClient) { m_strGameClient = strGameClient; }

// Caption
const std::string& GetCaption() const { return m_strCaption; }
void SetCaption(const std::string& strCaption) { m_strCaption = strCaption; }

void Archive(CArchive& ar) override;
void Serialize(CVariant& value) const override;
void ToSortable(SortItem& sortable, Field field) const override;
Expand All @@ -107,6 +111,7 @@ class CGameInfoTag : public IArchivable, public ISerializable, public ISortable
std::string m_strFormat;
std::string m_strCartridgeType;
std::string m_strGameClient;
std::string m_strCaption;
};
} // namespace GAME
} // namespace KODI
2 changes: 2 additions & 0 deletions xbmc/interfaces/legacy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(SOURCES AddonCallback.cpp
Dialog.cpp
DrmCryptoSession.cpp
File.cpp
InfoTagGame.cpp
InfoTagMusic.cpp
InfoTagRadioRDS.cpp
InfoTagVideo.cpp
Expand Down Expand Up @@ -42,6 +43,7 @@ set(HEADERS Addon.h
DrmCryptoSession.h
Exception.h
File.h
InfoTagGame.h
InfoTagMusic.h
InfoTagRadioRDS.h
InfoTagVideo.h
Expand Down
104 changes: 104 additions & 0 deletions xbmc/interfaces/legacy/InfoTagGame.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright (C) 2020 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 "InfoTagGame.h"

#include "ServiceBroker.h"
#include "settings/AdvancedSettings.h"
#include "settings/SettingsComponent.h"
#include "utils/StringUtils.h"

using namespace XBMCAddon;
using namespace xbmc;

InfoTagGame::InfoTagGame()
{
infoTag = new KODI::GAME::CGameInfoTag();
}

InfoTagGame::InfoTagGame(const KODI::GAME::CGameInfoTag& tag)
{
infoTag = new KODI::GAME::CGameInfoTag(tag);
}

InfoTagGame::~InfoTagGame()
{
delete infoTag;
}

String InfoTagGame::getFile()
{
return infoTag->GetURL();
}

String InfoTagGame::getTitle()
{
return infoTag->GetTitle();
}

String InfoTagGame::getPlatform()
{
return infoTag->GetPlatform();
}

String InfoTagGame::getGenres()
{
return StringUtils::Join(
infoTag->GetGenres(),
CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_gameItemSeparator);
}

String InfoTagGame::getDeveloper()
{
return infoTag->GetDeveloper();
}

String InfoTagGame::getOverview()
{
return infoTag->GetOverview();
}

int InfoTagGame::getYear()
{
return infoTag->GetYear();
}

String InfoTagGame::getID()
{
return infoTag->GetID();
}

String InfoTagGame::getRegion()
{
return infoTag->GetRegion();
}

String InfoTagGame::getPublisher()
{
return infoTag->GetPublisher();
}

String InfoTagGame::getFormat()
{
return infoTag->GetFormat();
}

String InfoTagGame::getCartridgeType()
{
return infoTag->GetCartridgeType();
}

String InfoTagGame::getGameClient()
{
return infoTag->GetGameClient();
}

String InfoTagGame::getCaption()
{
return infoTag->GetCaption();
}
Loading

0 comments on commit 4690416

Please sign in to comment.