Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'pr398'. closes #398
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Jan 12, 2015
2 parents a223ae3 + 01f3c8d commit 8642ea0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions addons/pvr.dvblink/addon/changelog.txt
@@ -1,5 +1,6 @@
[B]Version 1.9.13[/B]
Added: getBackendHostname function
Fixed: no timers are added from EPG of DVBLink TV Adviser product

[B]Version 1.9.12[/B]
Added: Grouping recordings by series
Expand Down
33 changes: 28 additions & 5 deletions addons/pvr.dvblink/src/DVBLinkClient.cpp
Expand Up @@ -269,7 +269,7 @@ PVR_ERROR DVBLinkClient::GetTimers(ADDON_HANDLE handle)

xbmcTimer.bIsRepeating = rec->GetProgram().IsRepeatRecord;

PVR_STR2INT(xbmcTimer.iEpgUid, rec->GetProgram().GetID().c_str());
xbmcTimer.iEpgUid = rec->GetProgram().GetStartTime();

xbmcTimer.startTime =rec->GetProgram().GetStartTime();
xbmcTimer.endTime = rec->GetProgram().GetStartTime() + rec->GetProgram().GetDuration();
Expand All @@ -296,6 +296,23 @@ PVR_ERROR DVBLinkClient::GetTimers(ADDON_HANDLE handle)
return result;
}

bool DVBLinkClient::get_dvblink_program_id(std::string& channelId, int start_time, std::string& dvblink_program_id)
{
bool ret_val = false;

EpgSearchResult epgSearchResult;
if (DoEPGSearch(epgSearchResult, channelId, start_time, start_time))
{
if (epgSearchResult.size() > 0 && epgSearchResult.at(0)->GetEpgData().size() > 0)
{
dvblink_program_id = epgSearchResult.at(0)->GetEpgData().at(0)->GetID();
ret_val = true;
}
}

return ret_val;
}

static bool is_bit_set(int bit_num, unsigned char bit_field)
{
unsigned char mask = (0x01 << bit_num);
Expand Down Expand Up @@ -328,9 +345,15 @@ PVR_ERROR DVBLinkClient::AddTimer(const PVR_TIMER &timer)
}
}

char programId [128];
PVR_INT2STR(programId,timer.iEpgUid);
addScheduleRequest = new AddScheduleByEpgRequest(channelId, programId, record_series);
std::string dvblink_program_id;
if (get_dvblink_program_id(channelId, timer.iEpgUid, dvblink_program_id))
{
addScheduleRequest = new AddScheduleByEpgRequest(channelId, dvblink_program_id, record_series);
}
else
{
return PVR_ERROR_FAILED;
}
}
else
{
Expand Down Expand Up @@ -951,7 +974,7 @@ PVR_ERROR DVBLinkClient::GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL
EPG_TAG broadcast;
memset(&broadcast, 0, sizeof(EPG_TAG));

PVR_STR2INT(broadcast.iUniqueBroadcastId, p->GetID().c_str() );
broadcast.iUniqueBroadcastId = p->GetStartTime();
broadcast.strTitle = p->GetTitle().c_str();
broadcast.iChannelNumber = channel.iChannelNumber;
broadcast.startTime = p->GetStartTime();
Expand Down
1 change: 1 addition & 0 deletions addons/pvr.dvblink/src/DVBLinkClient.h
Expand Up @@ -84,6 +84,7 @@ class DVBLinkClient : public PLATFORM::CThread
int GetInternalUniqueIdFromChannelId(const std::string& channelId);
virtual void * Process(void);
bool build_recording_series_map(std::map<std::string, std::string>& rec_id_to_series_name);
bool get_dvblink_program_id(std::string& channelId, int start_time, std::string& dvblink_program_id);

std::string make_timer_hash(const std::string& timer_id, const std::string& schedule_id);
bool parse_timer_hash(const char* timer_hash, std::string& timer_id, std::string& schedule_id);
Expand Down

0 comments on commit 8642ea0

Please sign in to comment.