Skip to content

Commit

Permalink
Merge branch 'master' into rtp
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kristjansson committed Feb 16, 2012
2 parents 02768bd + 2a74313 commit 3c4daaf
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 71 deletions.
6 changes: 3 additions & 3 deletions mythtv/bindings/perl/IO/Socket/INET/MythTV.pm
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
#
# A MythTV Socket class that extends IO::Socket::INET to include some
# A MythTV Socket class that extends IO::Socket::INET6 to include some
# MythTV-specific data queries
#
# @url $URL$
Expand All @@ -11,9 +11,9 @@
#

package IO::Socket::INET::MythTV;
use base 'IO::Socket::INET';
use base 'IO::Socket::INET6';

# Basically, just inherit the constructor from IO::Socket::INET
# Basically, just inherit the constructor from IO::Socket::INET6
sub new {
my $class = shift;
return $class->SUPER::new(@_);
Expand Down
3 changes: 3 additions & 0 deletions mythtv/configure
Expand Up @@ -4300,12 +4300,15 @@ if enabled bindings_perl; then
check_pl_lib "Sys::Hostname" || disable_bindings_perl "Sys::Hostname"
# Modules not distributed in Perl core
check_pl_lib DBI || disable_bindings_perl DBI
check_pl_lib "DBD::mysql" || disable_bindings_perl "DBD::mysql"
check_pl_lib "HTTP::Request" || disable_bindings_perl "HTTP::Request"
check_pl_lib "LWP::UserAgent" || disable_bindings_perl "LWP::UserAgent"
check_pl_lib "Net::UPnP::QueryResponse" ||
disable_bindings_perl "Net::UPnP::QueryResponse"
check_pl_lib "Net::UPnP::ControlPoint" ||
disable_bindings_perl "Net::UPnP::ControlPoint"
check_pl_lib "IO::Socket::INET6" ||
disable_bindings_perl "IO::Socket::INET6"
fi

# Check for php dependencies
Expand Down
45 changes: 42 additions & 3 deletions mythtv/libs/libmyth/programinfo.cpp
Expand Up @@ -1528,6 +1528,9 @@ void ProgramInfo::ToMap(InfoMap &progMap,

progMap["recstatus"] = ::toString(GetRecordingStatus(),
GetRecordingRuleType());
progMap["recstatuslong"] = ::toDescription(GetRecordingStatus(),
GetRecordingRuleType(),
GetRecordingStartTime());

if (IsRepeat())
{
Expand Down Expand Up @@ -1578,6 +1581,42 @@ void ProgramInfo::ToMap(InfoMap &progMap,
progMap["originalairdate"] = MythDateToString(originalAirDate, kDateFull);
progMap["shortoriginalairdate"] = MythDateToString(originalAirDate, kDateShort);
}

// 'mediatype' for a statetype, so untranslated
// 'mediatypestring' for textarea, so translated
// TODO Move to a dedicated ToState() method?
QString mediaType;
QString mediaTypeString;
switch (GetProgramInfoType())
{
case kProgramInfoTypeVideoFile :
mediaType = "video";
mediaTypeString = QObject::tr("Video");
break;
case kProgramInfoTypeVideoDVD :
mediaType = "dvd";
mediaTypeString = QObject::tr("DVD");
break;
case kProgramInfoTypeVideoStreamingHTML :
mediaType = "httpstream";
mediaTypeString = QObject::tr("HTTP Streaming");
break;
case kProgramInfoTypeVideoStreamingRTSP :
mediaType = "rtspstream";
mediaTypeString = QObject::tr("RTSP Streaming");
break;
case kProgramInfoTypeVideoBD :
mediaType = "bluraydisc";
mediaTypeString = QObject::tr("Blu-Ray Disc");
break;
case kProgramInfoTypeRecording : // Fall through
default :
mediaType = "recording";
mediaTypeString = QObject::tr("Recording",
"Recorded file, object not action");
}
progMap["mediatype"] = mediaType;
progMap["mediatypestring"] = mediaTypeString;
}

/// \brief Returns length of program/recording in seconds.
Expand Down Expand Up @@ -1951,7 +1990,7 @@ bool ProgramInfo::IsSameTimeslot(const ProgramInfo& other) const
return false;
if (startts == other.startts &&
(chanid == other.chanid ||
(!chansign.isEmpty() &&
(!chansign.isEmpty() &&
chansign.compare(other.chansign, Qt::CaseInsensitive) == 0)))
return true;

Expand All @@ -1969,7 +2008,7 @@ bool ProgramInfo::IsSameProgramTimeslot(const ProgramInfo &other) const
if (title.compare(other.title, Qt::CaseInsensitive) != 0)
return false;
if ((chanid == other.chanid ||
(!chansign.isEmpty() &&
(!chansign.isEmpty() &&
chansign.compare(other.chansign, Qt::CaseInsensitive) == 0)) &&
startts < other.endts &&
endts > other.startts)
Expand Down Expand Up @@ -2003,7 +2042,7 @@ void ProgramInfo::CheckProgramIDAuthorities(void)
}

int numAuths = authMap.count();
LOG(VB_GENERAL, LOG_INFO,
LOG(VB_GENERAL, LOG_INFO,
QString("Found %1 distinct programid authorities").arg(numAuths));

usingProgIDAuth = (numAuths > 1);
Expand Down
6 changes: 5 additions & 1 deletion mythtv/libs/libmyth/programtypes.cpp
Expand Up @@ -215,8 +215,12 @@ QString toString(RecStatusType recstatus, RecordingType rectype)
}

/// \brief Converts "recstatus" into a long human readable description.
QString toDescription(RecStatusType recstatus, const QDateTime &recstartts)
QString toDescription(RecStatusType recstatus, RecordingType rectype,
const QDateTime &recstartts)
{
if (rectype == kNotRecording)
return QObject::tr("This showing is not scheduled to record");

QString message;
QDateTime now = QDateTime::currentDateTime();

Expand Down
7 changes: 4 additions & 3 deletions mythtv/libs/libmyth/programtypes.h
Expand Up @@ -99,7 +99,7 @@ typedef enum SkipTypes {
* are just too many false positives from non-commercial cut scenes. */
COMM_DETECT_2_ALL = (COMM_DETECT_2_LOGO | COMM_DETECT_2_BLANK),

COMM_DETECT_PREPOSTROLL = 0x00000200,
COMM_DETECT_PREPOSTROLL = 0x00000200,
COMM_DETECT_PREPOSTROLL_ALL = (COMM_DETECT_PREPOSTROLL
| COMM_DETECT_BLANKS
| COMM_DETECT_SCENE)
Expand Down Expand Up @@ -144,7 +144,7 @@ typedef enum FlagMask {
} ProgramFlag;

typedef enum ProgramInfoType {
kProgramInfoTypeRecording = 0,
kProgramInfoTypeRecording = 0,
kProgramInfoTypeVideoFile,
kProgramInfoTypeVideoDVD,
kProgramInfoTypeVideoStreamingHTML,
Expand Down Expand Up @@ -227,7 +227,8 @@ typedef enum RecStatusTypes {
MPUBLIC QString toUIState(RecStatusType);
MPUBLIC QString toString(RecStatusType, uint id);
MPUBLIC QString toString(RecStatusType, RecordingType);
MPUBLIC QString toDescription(RecStatusType, const QDateTime &recstartts);
MPUBLIC QString toDescription(RecStatusType, RecordingType,
const QDateTime &recstartts);

typedef enum AvailableStatusTypes {
asAvailable = 0,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/compat.h
Expand Up @@ -350,7 +350,7 @@ static inline struct tm *localtime_r(const time_t *timep, struct tm *result)
#endif

#include <stdio.h> /* for FILENAME_MAX */
#if defined(USING_MINGW) && defined(FILENAME_MAX)
#if defined(USING_MINGW) && defined(FILENAME_MAX) && !defined( _MSC_VER )
#include <errno.h>
#include <dirent.h>
#include <string.h>
Expand Down
58 changes: 44 additions & 14 deletions mythtv/libs/libmythbase/mythcorecontext.cpp
Expand Up @@ -714,7 +714,8 @@ void MythCoreContext::ConfigureHostAddress(void)
.arg(it->toString()));
d->m_IPv6.append(*it);
}
LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping link-local "
else
LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping link-local "
"address during IPv6 autoselection: %1")
.arg(it->toString()));
}
Expand Down Expand Up @@ -964,30 +965,59 @@ double MythCoreContext::GetFloatSettingOnHost(const QString &key,
return d->m_database->GetFloatSettingOnHost(key, host, defaultval);
}

#if 0
QString MythCoreContext::GetMasterServerIP(void)
{
QString saddr = GetSetting("MasterServerIP");
QHostAddress addr(saddr);

if (!d->m_IPv6.empty() &&
(addr.protocol() == QAbstractSocket::IPv6Protocol))
// we have IPv6 addresses, assume we can connect to them
return saddr;
else if (!d->m_IPv4.empty() &&
(addr.protocol() == QAbstractSocket::IPv4Protocol))
// we have IPv4 addresses, assume we can connect to them
return saddr;
else
return GetBackendServerIP(GetMasterHostName());
}
#endif

QString MythCoreContext::GetBackendServerIP(void)
{
return GetBackendServerIP(d->m_localHostname);
}

QString MythCoreContext::GetBackendServerIP(const QString &host)
{
QString addr4, addr6;
#if !defined(QT_NO_IPV6)
// prefer IPv6 address if optional
if (!d->m_IPv6.empty())
{
if (!d->m_IPv6.isEmpty())
// we have IPv6 addresses, assume we can connect to them
QString address = GetSettingOnHost("BackendServerIP6", host, "");
if (!address.isEmpty())
return address;
}
addr6 = GetSettingOnHost("BackendServerIP6", host, "");
#endif
// fall back to IPv4 address
QString address = GetSettingOnHost("BackendServerIP", host, "");
if (!address.isEmpty())
return address;
if (!d->m_IPv4.isEmpty())
addr4 = GetSettingOnHost("BackendServerIP", host, "");

if (addr6.isEmpty())
{
if (addr4.isEmpty())
{
LOG(VB_GENERAL, LOG_ERR, "No address defined for host: "+host);
return "";
}

LOG(VB_GENERAL, LOG_WARNING, "No address defined for host: "+host);
return "";
// IPv6 is empty, so return this regardless
return addr4;
}
else if ((QHostAddress(addr6) == QHostAddress::LocalHostIPv6) &&
!addr4.isEmpty() &&
(QHostAddress(addr4) != QHostAddress::LocalHost))
// IPv6 set to localhost, but IPv4 address if network accessible
return addr4;
else
return addr6;
}

void MythCoreContext::SetSetting(const QString &key, const QString &newValue)
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythmetadata/metadatafactory.cpp
Expand Up @@ -630,7 +630,8 @@ LookupType GuessLookupType(ProgramInfo *pginfo)
// subtitle, it's *probably* a movie. If it's some
// weird combination of both, we've got to try everything.
RecordingRule *rule = new RecordingRule();
rule->LoadByProgram(pginfo);
rule->m_recordID = pginfo->GetRecordingRuleID();
rule->Load();
int ruleepisode = rule->m_episode;
delete rule;

Expand Down
23 changes: 17 additions & 6 deletions mythtv/libs/libmythtv/deletemap.cpp
Expand Up @@ -549,13 +549,18 @@ bool DeleteMap::IsTemporaryMark(uint64_t frame) const
}

/**
* \brief Returns the next or previous mark. If these do not exist, returns
* either zero (the first frame) or total (the last frame).
* \brief Returns the next or previous mark. If these do not exist,
* returns either zero (the first frame) or total (the last
* frame). If hasMark is non-NULL, it is set to true if the
* next/previous mark exists, and false otherwise.
*/
uint64_t DeleteMap::GetNearestMark(
uint64_t frame, uint64_t total, bool right) const
uint64_t frame, uint64_t total, bool right,
bool *hasMark) const
{
uint64_t result;
if (hasMark)
*hasMark = true;
frm_dir_map_t::const_iterator it = m_deleteMap.begin();
if (right)
{
Expand All @@ -574,6 +579,8 @@ uint64_t DeleteMap::GetNearestMark(
result = it.key();
}
}
if (hasMark)
*hasMark = false;
return result;
}

Expand Down Expand Up @@ -740,6 +747,7 @@ void DeleteMap::SaveMap(uint64_t total, bool isAutoSave)
void DeleteMap::TrackerReset(uint64_t frame, uint64_t total)
{
m_nextCutStart = 0;
m_nextCutStartIsValid = false;
if (IsEmpty())
return;

Expand All @@ -748,16 +756,19 @@ void DeleteMap::TrackerReset(uint64_t frame, uint64_t total)
{
if (cutpoint.value() == MARK_CUT_START)
{
m_nextCutStartIsValid = true;
m_nextCutStart = cutpoint.key();
}
else
{
++cutpoint;
m_nextCutStart = cutpoint != m_deleteMap.end() ? cutpoint.key() : total;
m_nextCutStartIsValid = (cutpoint != m_deleteMap.end());
m_nextCutStart = m_nextCutStartIsValid ? cutpoint.key() : total;
}
}
else
m_nextCutStart = GetNearestMark(frame, total, !IsInDelete(frame));
m_nextCutStart = GetNearestMark(frame, total, !IsInDelete(frame),
&m_nextCutStartIsValid);
LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Tracker next CUT_START: %1")
.arg(m_nextCutStart));
}
Expand All @@ -768,7 +779,7 @@ void DeleteMap::TrackerReset(uint64_t frame, uint64_t total)
*/
bool DeleteMap::TrackerWantsToJump(uint64_t frame, uint64_t total, uint64_t &to)
{
if (IsEmpty() || frame < m_nextCutStart)
if (IsEmpty() || !m_nextCutStartIsValid || frame < m_nextCutStart)
return false;

to = GetNearestMark(m_nextCutStart, total, true);
Expand Down
8 changes: 6 additions & 2 deletions mythtv/libs/libmythtv/deletemap.h
Expand Up @@ -19,7 +19,9 @@ typedef struct DeleteMapUndoEntry
class MTV_PUBLIC DeleteMap
{
public:
DeleteMap(): m_editing(false), m_nextCutStart(0), m_changed(true),
DeleteMap(): m_editing(false),
m_nextCutStartIsValid(false),
m_nextCutStart(0), m_changed(true),
m_seekamountpos(4), m_seekamount(30),
m_ctx(0), m_undoStackPointer(-1) { Push(""); }

Expand Down Expand Up @@ -56,7 +58,8 @@ class MTV_PUBLIC DeleteMap
void Move(uint64_t frame, uint64_t to, uint64_t total);

bool IsInDelete(uint64_t frame) const;
uint64_t GetNearestMark(uint64_t frame, uint64_t total, bool right) const;
uint64_t GetNearestMark(uint64_t frame, uint64_t total, bool right,
bool *hasMark = 0) const;
bool IsTemporaryMark(uint64_t frame) const;
bool HasTemporaryMark(void) const;
uint64_t GetLastFrame(uint64_t total) const;
Expand All @@ -79,6 +82,7 @@ class MTV_PUBLIC DeleteMap
void Push(QString undoMessage);

bool m_editing;
bool m_nextCutStartIsValid;
uint64_t m_nextCutStart;
frm_dir_map_t m_deleteMap;
QString m_seekText;
Expand Down
6 changes: 6 additions & 0 deletions mythtv/libs/libmythtv/osd.cpp
Expand Up @@ -463,6 +463,12 @@ void OSD::SetText(const QString &window, QHash<QString,QString> &map,
if (state)
state->DisplayState(map["nightmode"]);
}
if (map.contains("mediatype"))
{
MythUIStateType *state = dynamic_cast<MythUIStateType *> (win->GetChild("mediatype"));
if (state)
state->DisplayState(map["mediatype"]);
}

MythUIProgressBar *bar =
dynamic_cast<MythUIProgressBar *>(win->GetChild("elapsedpercent"));
Expand Down
11 changes: 11 additions & 0 deletions mythtv/libs/libmythtv/recordingrule.cpp
Expand Up @@ -488,6 +488,17 @@ void RecordingRule::ToMap(InfoMap &infoMap) const
infoMap["searchtype"] = SearchTypeToString(m_searchType);
if (m_searchType != kNoSearch)
infoMap["searchforwhat"] = m_description;


if (m_nextRecording.isValid())
infoMap["nextrecording"] = MythDateTimeToString(m_nextRecording,
kDateFull | kAddYear);
if (m_lastRecorded.isValid())
infoMap["lastrecorded"] = MythDateTimeToString(m_lastRecorded,
kDateFull | kAddYear);
if (m_lastDeleted.isValid())
infoMap["lastdeleted"] = MythDateTimeToString(m_lastDeleted,
kDateFull | kAddYear);
}

void RecordingRule::UseTempTable(bool usetemp, QString table)
Expand Down

0 comments on commit 3c4daaf

Please sign in to comment.