Skip to content

Commit

Permalink
Update namespace to Stalker
Browse files Browse the repository at this point in the history
  • Loading branch information
phunkyfish committed Jun 22, 2024
1 parent 9eb49c3 commit 037a49b
Show file tree
Hide file tree
Showing 20 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/AddonSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "kodi/General.h"

using namespace SC;
using namespace Stalker;

AddonSettings::AddonSettings()
{
Expand Down
4 changes: 2 additions & 2 deletions src/AddonSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "kodi/AddonBase.h"

namespace SC
namespace Stalker
{
/**
* Represents the current addon settings
Expand All @@ -36,4 +36,4 @@ class AddonSettings
void ReadSettings();
};

} // namespace SC
} // namespace Stalker
2 changes: 1 addition & 1 deletion src/CWatchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <kodi/General.h>
#include <thread>

using namespace SC;
using namespace Stalker;

CWatchdog::CWatchdog(uint32_t interval, SAPI* api, std::function<void(SError)> errorCallback)
: m_interval(interval), m_api(api), m_errorCallback(errorCallback)
Expand Down
4 changes: 2 additions & 2 deletions src/CWatchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <functional>
#include <thread>

namespace SC
namespace Stalker
{
class CWatchdog
{
Expand All @@ -35,4 +35,4 @@ class CWatchdog
bool m_threadActive = false;
std::thread m_thread;
};
} // namespace SC
} // namespace Stalker
2 changes: 1 addition & 1 deletion src/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <cmath>
#include <kodi/General.h>

using namespace SC;
using namespace Stalker;

SError ChannelManager::LoadChannels()
{
Expand Down
4 changes: 2 additions & 2 deletions src/ChannelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "SAPI.h"
#include "base/ChannelManager.h"

namespace SC
namespace Stalker
{
struct Channel : Base::Channel
{
Expand Down Expand Up @@ -69,4 +69,4 @@ class ChannelManager : public Base::ChannelManager<Channel>
SAPI* m_api = nullptr;
std::vector<ChannelGroup> m_channelGroups;
};
} // namespace SC
} // namespace Stalker
18 changes: 9 additions & 9 deletions src/GuideManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <kodi/General.h>
#include <thread>

using namespace SC;
using namespace Stalker;

GuideManager::~GuideManager()
{
Expand All @@ -27,7 +27,7 @@ SError GuideManager::LoadGuide(time_t start, time_t end)
{
kodi::Log(ADDON_LOG_DEBUG, "%s", __func__);

if (m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_XMLTV_ONLY)
if (m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_XMLTV_ONLY)
return SERROR_OK;

bool ret(false);
Expand Down Expand Up @@ -69,7 +69,7 @@ SError GuideManager::LoadXMLTV(HTTPSocket::Scope scope, const std::string& path)
{
kodi::Log(ADDON_LOG_DEBUG, "%s", __func__);

if (m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_PROVIDER_ONLY || path.empty())
if (m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_PROVIDER_ONLY || path.empty())
return SERROR_OK;

bool ret(false);
Expand Down Expand Up @@ -210,19 +210,19 @@ std::vector<Event> GuideManager::GetChannelEvents(Channel& channel, time_t start
std::vector<Event> events;
int addedEvents;

if (m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_PREFER_PROVIDER ||
m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_PROVIDER_ONLY)
if (m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_PREFER_PROVIDER ||
m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_PROVIDER_ONLY)
{
addedEvents = AddEvents(0, events, channel, start, end, epgTimeshiftSecs);
if (m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_PREFER_PROVIDER && !addedEvents)
if (m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_PREFER_PROVIDER && !addedEvents)
AddEvents(1, events, channel, start, end, epgTimeshiftSecs);
}

if (m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_PREFER_XMLTV ||
m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_XMLTV_ONLY)
if (m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_PREFER_XMLTV ||
m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_XMLTV_ONLY)
{
addedEvents = AddEvents(1, events, channel, start, end, epgTimeshiftSecs);
if (m_guidePreference == SC::InstanceSettings::GUIDE_PREFERENCE_PREFER_XMLTV && !addedEvents)
if (m_guidePreference == Stalker::InstanceSettings::GUIDE_PREFERENCE_PREFER_XMLTV && !addedEvents)
AddEvents(0, events, channel, start, end, epgTimeshiftSecs);
}

Expand Down
6 changes: 3 additions & 3 deletions src/GuideManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <kodi/addon-instance/pvr/EPG.h>
#include <memory>

namespace SC
namespace Stalker
{
struct Event : Base::Event
{
Expand Down Expand Up @@ -69,10 +69,10 @@ class GuideManager : public Base::GuideManager<Event>

SAPI* m_api = nullptr;
InstanceSettings::GuidePreference m_guidePreference =
(SC::InstanceSettings::GuidePreference)SC_SETTINGS_DEFAULT_GUIDE_PREFERENCE;
(Stalker::InstanceSettings::GuidePreference)SC_SETTINGS_DEFAULT_GUIDE_PREFERENCE;
bool m_useCache = SC_SETTINGS_DEFAULT_GUIDE_CACHE;
unsigned int m_expiry = SC_SETTINGS_DEFAULT_GUIDE_CACHE_HOURS * 3600;
std::shared_ptr<XMLTV> m_xmltv = std::make_shared<XMLTV>();
Json::Value m_epgData;
};
} // namespace SC
} // namespace Stalker
2 changes: 1 addition & 1 deletion src/InstanceSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "InstanceSettings.h"

using namespace SC;
using namespace Stalker;

InstanceSettings::InstanceSettings(kodi::addon::IAddonInstance& instance)
: m_instance(instance)
Expand Down
4 changes: 2 additions & 2 deletions src/InstanceSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define SC_SETTINGS_DEFAULT_DEVICE_ID2 ""
#define SC_SETTINGS_DEFAULT_SIGNATURE ""

namespace SC
namespace Stalker
{
class InstanceSettings
{
Expand Down Expand Up @@ -73,4 +73,4 @@ class InstanceSettings

kodi::addon::IAddonInstance& m_instance;
};
} // namespace SC
} // namespace Stalker
2 changes: 1 addition & 1 deletion src/SAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define SC_SAPI_AUTHORIZATION_FAILED "Authorization failed."

using namespace SC;
using namespace Stalker;

void SAPI::SetEndpoint(const std::string& endpoint)
{
Expand Down
4 changes: 2 additions & 2 deletions src/SAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <json/json.h>
#include <string>

namespace SC
namespace Stalker
{
class SAPI
{
Expand Down Expand Up @@ -65,4 +65,4 @@ class SAPI
std::string m_referer;
unsigned int m_timeout = 0;
};
} // namespace SC
} // namespace Stalker
2 changes: 1 addition & 1 deletion src/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <kodi/General.h>
#include <thread>

using namespace SC;
using namespace Stalker;

SessionManager::~SessionManager()
{
Expand Down
4 changes: 2 additions & 2 deletions src/SessionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <mutex>

namespace SC
namespace Stalker
{
class SessionManager
{
Expand Down Expand Up @@ -78,4 +78,4 @@ class SessionManager
bool m_threadActive = false;
std::thread m_thread;
};
} // namespace SC
} // namespace Stalker
2 changes: 1 addition & 1 deletion src/SettingsMigration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <utility>
#include <vector>

using namespace SC;
using namespace Stalker;

namespace
{
Expand Down
4 changes: 2 additions & 2 deletions src/SettingsMigration.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IAddonInstance;
}
} // namespace kodi

namespace SC
namespace Stalker
{
class SettingsMigration
{
Expand All @@ -40,4 +40,4 @@ class SettingsMigration
bool m_changed{false};
};

} // namespace SC
} // namespace Stalker
24 changes: 12 additions & 12 deletions src/StalkerInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define SERROR_MSG_AUTHORIZATION 30509
#define MSG_RE_AUTHENTICATED 30510

using namespace SC;
using namespace Stalker;

StalkerInstance::StalkerInstance(const kodi::addon::IInstanceInfo& instance) : kodi::addon::CInstancePVRClient(instance), Base::Cache()
{
Expand Down Expand Up @@ -373,7 +373,7 @@ PVR_ERROR StalkerInstance::GetEPGForChannel(int channelUid,
{
kodi::Log(ADDON_LOG_DEBUG, "%s", __func__);

SC::Channel* chan;
Stalker::Channel* chan;
time_t now;
SError ret;

Expand Down Expand Up @@ -409,11 +409,11 @@ PVR_ERROR StalkerInstance::GetEPGForChannel(int channelUid,
QueueErrorNotification(ret);
}

std::vector<SC::Event> events;
std::vector<Stalker::Event> events;

int epgTimeshiftSecs = static_cast<int>(settings->epgTimeshiftHours * 60 * 60);
events = m_guideManager->GetChannelEvents(*chan, start, end, epgTimeshiftSecs);
for (std::vector<SC::Event>::iterator event = events.begin(); event != events.end(); ++event)
for (std::vector<Stalker::Event>::iterator event = events.begin(); event != events.end(); ++event)
{
kodi::addon::PVREPGTag tag;

Expand Down Expand Up @@ -506,10 +506,10 @@ PVR_ERROR StalkerInstance::GetChannelGroups(bool radio, kodi::addon::PVRChannelG
return PVR_ERROR_SERVER_ERROR;
}

std::vector<SC::ChannelGroup> channelGroups;
std::vector<Stalker::ChannelGroup> channelGroups;

channelGroups = m_channelManager->GetChannelGroups();
for (std::vector<SC::ChannelGroup>::iterator group = channelGroups.begin();
for (std::vector<Stalker::ChannelGroup>::iterator group = channelGroups.begin();
group != channelGroups.end(); ++group)
{
// exclude group id '*' (all)
Expand All @@ -532,7 +532,7 @@ PVR_ERROR StalkerInstance::GetChannelGroupMembers(const kodi::addon::PVRChannelG
{
kodi::Log(ADDON_LOG_DEBUG, "%s", __func__);

SC::ChannelGroup* channelGroup;
Stalker::ChannelGroup* channelGroup;

channelGroup = m_channelManager->GetChannelGroup(group.GetGroupName());
if (channelGroup == nullptr)
Expand All @@ -541,10 +541,10 @@ PVR_ERROR StalkerInstance::GetChannelGroupMembers(const kodi::addon::PVRChannelG
return PVR_ERROR_SERVER_ERROR;
}

std::vector<SC::Channel> channels;
std::vector<Stalker::Channel> channels;

channels = m_channelManager->GetChannels();
for (std::vector<SC::Channel>::iterator channel = channels.begin(); channel != channels.end();
for (std::vector<Stalker::Channel>::iterator channel = channels.begin(); channel != channels.end();
++channel)
{
if (channel->tvGenreId.compare(channelGroup->id))
Expand Down Expand Up @@ -587,10 +587,10 @@ PVR_ERROR StalkerInstance::GetChannels(bool radio, kodi::addon::PVRChannelsResul
return PVR_ERROR_SERVER_ERROR;
}

std::vector<SC::Channel> channels;
std::vector<Stalker::Channel> channels;

channels = m_channelManager->GetChannels();
for (std::vector<SC::Channel>::iterator channel = channels.begin(); channel != channels.end();
for (std::vector<Stalker::Channel>::iterator channel = channels.begin(); channel != channels.end();
++channel)
{
kodi::addon::PVRChannel tag;
Expand Down Expand Up @@ -631,7 +631,7 @@ std::string StalkerInstance::GetChannelStreamURL(const kodi::addon::PVRChannel&
if (!IsAuthenticated())
return streamUrl;

SC::Channel* chan;
Stalker::Channel* chan;
std::string cmd;
size_t pos;

Expand Down
12 changes: 6 additions & 6 deletions src/StalkerInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <thread>
#include <vector>

namespace SC
namespace Stalker
{

class ATTR_DLL_LOCAL StalkerInstance : public kodi::addon::CInstancePVRClient,
Expand Down Expand Up @@ -66,7 +66,7 @@ class ATTR_DLL_LOCAL StalkerInstance : public kodi::addon::CInstancePVRClient,
const kodi::addon::PVRChannel& channel,
std::vector<kodi::addon::PVRStreamProperty>& properties) override;

std::shared_ptr<SC::InstanceSettings> settings;
std::shared_ptr<Stalker::InstanceSettings> settings;

protected:
bool LoadCache();
Expand All @@ -91,10 +91,10 @@ class ATTR_DLL_LOCAL StalkerInstance : public kodi::addon::CInstancePVRClient,
bool m_epgThreadActive = false;
std::thread m_epgThread;
mutable std::mutex m_epgMutex;
SC::SAPI* m_api = new SC::SAPI;
SC::SessionManager* m_sessionManager = new SC::SessionManager;
SC::ChannelManager* m_channelManager = new SC::ChannelManager;
SC::GuideManager* m_guideManager = new SC::GuideManager;
Stalker::SAPI* m_api = new Stalker::SAPI;
Stalker::SessionManager* m_sessionManager = new Stalker::SessionManager;
Stalker::ChannelManager* m_channelManager = new Stalker::ChannelManager;
Stalker::GuideManager* m_guideManager = new Stalker::GuideManager;
};

} // SC
6 changes: 3 additions & 3 deletions src/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "StalkerInstance.h"
#include "SettingsMigration.h"

using namespace SC;
using namespace Stalker;

ADDON_STATUS CStalkerAddon::Create()
{
Expand All @@ -28,15 +28,15 @@ ADDON_STATUS CStalkerAddon::CreateInstance(const kodi::addon::IInstanceInfo& ins
{
kodi::Log(ADDON_LOG_DEBUG, "creating Stalker Portal PVR addon");

m_stalker = new SC::StalkerInstance(instance);
m_stalker = new Stalker::StalkerInstance(instance);
ADDON_STATUS status = m_stalker->Initialize();

// Try to migrate settings from a pre-multi-instance setup
if (SettingsMigration::MigrateSettings(*m_stalker))
{
// Initial client operated on old/incomplete settings
delete m_stalker;
m_stalker = new SC::StalkerInstance(instance);
m_stalker = new Stalker::StalkerInstance(instance);
}

hdl = m_stalker;
Expand Down
Loading

0 comments on commit 037a49b

Please sign in to comment.