Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'fixes/0.25' of code.mythtv.org:mythtv into fixes/0.25

  • Loading branch information...
commit a4cdc9e01295991056cdc8c5411e70937b1a4842 2 parents 450ed91 + f0e2ad8
@wagnerrp wagnerrp authored
View
276 mythplugins/mythgame/mythgame/scripts/maws.pl
@@ -1,276 +0,0 @@
-#!/usr/bin/env perl
-# @(#)$Header: /home/mythtv/mythtvrep/scripts/maws.pl,v 1.9 2011/01/24 07:05:01 mythtv Exp $
-# Auric 2010/01/10 http://web.aanet.com.au/auric/
-#
-# MAWS metadata Grabber Script
-#
-################################################################################
-use strict;
-use warnings;
-use Getopt::Std;
-use LWP::Simple;
-use HTML::TreeBuilder;
-use HTML::Entities;
-use Data::Dumper;
-use Encode;
-
-#################################### Settings #################################
-my $info = 0; # print info/progress message: 0 - off, 1 - low ,2 - high
-my $infoop = 0; # info messages go to: 0 = stderr, filename = filename
-
-#################################### Globals ##################################
-my $site = 'MAWS';
-my $baseurl = 'http://maws.mameworld.info';
-my $searchurl = $baseurl . "/maws/srch.php?search_text=";
-my $header = '<?xml version="1.0" encoding="UTF-8"?>
-<metadata>';
-my $footer = '</metadata>';
-our ($opt_M, $opt_D, $opt_v);
-my @metaitems;
-my $version = '$Revision: 1.9 $'; $version =~ s/\D*([\d\.]+)\D*/$1/; # rcs tag populated
-my $command = "maws.pl"; my $commandthumbnail = "maws.png"; my $author = "Auric";
-#################################### Util Subs ############################################
-# If you copy this for another site, hopefully these won't need to changed
-
-sub printversion {
- #print '<?xml version="1.0" encoding="UTF-8"?>'."\n";
- print '<grabber>'."\n";
- print ' <name>'.$site.'</name>'."\n";
- print ' <command>'.$command.'</command>'."\n";
- print ' <author>'.$author.'</author>'."\n";
- print ' <thumbnail>'.$commandthumbnail.'</thumbnail>'."\n";
- print ' <type>games</type>'."\n";
- print ' <description>Search and Metadata downloads from the MAME MAWS db</description>'."\n";
- print ' <version>'.$version.'</version>'."\n";
- print '</grabber>'."\n";
-}
-
-sub cleanexit {
- my $esig = shift @_;
-
- fileno(FH) and close(FH);
- if ($esig =~ /\D/) {
- # called by signalhandler
- exit 1;
- } else {
- exit $esig;
- }
-}
-
-sub infomsg {
- my $level = shift @_;
- my $mesg = shift @_;
-
- ($info < $level) and return;
- $mesg = encode('utf8', $mesg);
- if ($infoop =~ /\D/) {
- open(FH, ">$infoop") unless fileno(FH);
- my $t = localtime();
- print FH "$t $level $mesg\n";
- } else {
- print STDERR "$mesg\n";
- }
-}
-
-sub cleantext {
- my $text = shift @_;
-
- ($text) or return;
- $text =~ s/\n/ /g;
- $text =~ s/^\s+|\s+$//g;
- $text = encode_entities($text);
- return $text;
-}
-
-sub printitems {
-
- foreach my $i (@metaitems) {
- my %item = %{$i};
- print " ".'<item>'."\n";
- print " ".'<title>'.$item{'title'}.'</title>'."\n";
- print " ".'<inetref>'.$item{'inetref'}.'</inetref>'."\n";
- print " ".'<description>'.$item{'description'}.'</description>'."\n";
- print " ".'<system>MAME</system>'."\n";
- print " ".'<categories>'."\n";
- print " ".'<category type="genre" name="'.$item{'genre'}.'"/>'."\n";
- print " ".'</categories>'."\n";
- print " ".'<studios>'."\n";
- print " ".'<studio name="'.$item{'studio'}.'"/>'."\n";
- print " ".'</studios>'."\n";
- print " ".'<year>'.$item{'year'}.'</year>'."\n";
- print " ".'<images>'."\n";
- print " ".'<image type="screenshot" thumb="'.$item{'screenshotthumb'}.'" url="'.$item{'screenshoturl'}.'"/>'."\n";
- print " ".'<image type="coverart" thumb="'.$item{'coverthumb'}.'" url="'.$item{'coverurl'}.'"/>'."\n";
- print " ".'</images>'."\n";
- print " ".'<popularity>'.$item{'popularity'}.'</popularity>'."\n";
- print " ".'</item>'."\n";
- }
-}
-
-#################################### Site Specific Subs ##########################
-sub search {
- my $searchstr = shift @_;
-
- my $content = get(${searchurl} . ${searchstr});
- unless ($content) {
- die "Could not retrieve ${searchurl}${searchstr}";
- }
- my $tree = HTML::TreeBuilder->new;
- eval { $tree->parse($content); };
- if ($@) {
- die "$searchurl parse failed, $@";
- }
- $tree->eof();
-
- my @trs = $tree->find_by_tag_name('tr');
- foreach my $tr (@trs) {
- my @as = $tr->find_by_tag_name('a');
- my $count = 0;
- foreach my $a (@as) {
- ($count++ < 2) && next;
- ($a->as_trimmed_text()) || last;
- $a->attr('href') =~ /romset/ || last;
- my $title = cleantext($a->as_trimmed_text());
- my $inetref = $a->attr('href');
- $inetref =~ s/\#.*$//;
- $inetref =~ s/^\/maws\///;
- $inetref = cleantext($baseurl . "/maws/" . $inetref);
- push(@metaitems, {
- 'title' => $title,
- 'inetref' => $inetref,
- 'description' => "",
- 'genre' => "",
- 'studio' => "",
- 'year' => "",
- 'coverthumb' => "",
- 'coverurl' => "",
- 'screenshotthumb' => "",
- 'screenshoturl' => "",
- 'popularity' => ""
- });
- last;
- }
- }
- return 0;
-}
-
-sub queryinetref {
- my $inetref = shift @_;
-
- my $content = get(${inetref});
- unless ($content) {
- die "Could not retrieve ${inetref}";
- }
- my $tree = HTML::TreeBuilder->new;
- eval { $tree->parse($content); };
- if ($@) {
- die "$inetref parse failed, $@";
- }
- $tree->eof();
-
- my $title = "";
- my $description = "";
- my $genre = "";
- my $studio = "";
- my $year = "";
- my $coverthumb = "";
- my $coverurl = "";
- my $screenshoturl = "";
- my $screenshotthumb = "";
- my $popularity = "";
- my @trs = $tree->find_by_tag_name('tr');
- foreach my $tr (@trs) {
- my @tds = $tr->find_by_tag_name('td');
- foreach my $td (@tds) {
- if ($td->as_trimmed_text() eq "title" ) {
- my $right = $td->right();
- ($right) and $title = cleantext($right->as_trimmed_text());
- } elsif ($td->as_trimmed_text() eq "manufacturer" ) {
- my $right = $td->right();
- ($right) and $studio = cleantext($right->as_trimmed_text());
- } elsif ($td->as_trimmed_text() eq "year" ) {
- my $right = $td->right();
- ($right) and $year = cleantext($right->as_trimmed_text());
- } elsif ($td->as_trimmed_text() eq "genre" ) {
- my $right = $td->right();
- ($right) and $genre = cleantext($right->as_trimmed_text());
- } elsif ($td->as_trimmed_text() eq "snapshots" ) {
- my $right = $td->right();
- my @as = $tree->find_by_tag_name('a');
- foreach my $a (@as) {
- if ((!$screenshoturl) && $a->as_trimmed_text() =~ /in game/) {
- if ($a->attr('onClick')) {
- $screenshoturl = $a->attr('onClick');
- $screenshoturl =~ s/.*\'(.*)\'.*/$1/;
- $screenshoturl =~ s/^\.\.//;
- $screenshoturl =~ s/^\///;
- $screenshoturl = cleantext($baseurl . "/" . $screenshoturl);
- # Making thumb same as they are small.
- #$screenshotthumb = $screenshoturl;
- }
- }
- if ($a->as_trimmed_text() =~ /flyer/) {
- $coverurl = cleantext($baseurl . $a->attr('href'));
- # Making thumb same as they are small.
- #$coverthumb = $coverurl;
- }
- }
- } elsif ($td->as_trimmed_text() eq "rating" ) {
- my $right = $td->right();
- my $d = $right->find_by_tag_name('div');
- if ($d->attr('title')) {
- $popularity = $d->attr('title');
- $popularity =~ s/(.*)%.*/$1/;
- $popularity = int(($popularity / 10) + 0.5);
- }
- }
- }
- }
- push(@metaitems, {
- 'title' => $title,
- 'inetref' => $inetref,
- 'description' => $description,
- 'genre' => $genre,
- 'studio' => $studio,
- 'year' => $year,
- 'coverthumb' => $coverthumb,
- 'coverurl' => $coverurl,
- 'screenshotthumb' => $screenshotthumb,
- 'screenshoturl' => $screenshoturl,
- 'popularity' => $popularity
- });
- return 0;
-}
-
-#################################### Main #####################################
-getopts('M:D:v');
-
-if ($opt_v) {
- printversion;
- cleanexit 0;
-}
-
-unless (($opt_M) || ($opt_D)){
- print "Error must have either -M search str or -D inetref\n";
- cleanexit 1;
-}
-
-$SIG{'INT'} = \&cleanexit;
-$SIG{'HUP'} = \&cleanexit;
-$SIG{'TERM'} = \&cleanexit;
-$SIG{'QUIT'} = \&cleanexit;
-
-print "$header\n";
-
-if ($opt_M) {
- search($opt_M);
- printitems();
-} elsif ($opt_D) {
- queryinetref($opt_D);
- printitems();
-}
-
-print "$footer\n";
-
-cleanexit 0;
-
View
3  mythplugins/mythweather/mythweather/weather.cpp
@@ -151,6 +151,7 @@ bool Weather::SetupScreens()
{
if (m_firstSetup)
{
+ m_firstSetup = false;
// If no screens exist, run the setup
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
@@ -167,8 +168,6 @@ bool Weather::SetupScreens()
{
delete ssetup;
}
-
- m_firstSetup = false;
}
else
{
View
19 mythplugins/mythweather/mythweather/weatherScreen.cpp
@@ -169,7 +169,7 @@ void WeatherScreen::prepareWidget(MythUIType *widget)
QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
{
- if (key == "relative_humidity")
+ if (key.startsWith("relative_humidity") || key.startsWith("pop"))
return value + " %";
if (key == "pressure")
@@ -178,22 +178,25 @@ QString WeatherScreen::formatDataItem(const QString &key, const QString &value)
if (key == "visibility")
return value + (m_units == ENG_UNITS ? " mi" : " km");
- if (key == "temp" || key == "appt" || key.contains("low",Qt::CaseInsensitive) ||
- key.contains("high",Qt::CaseInsensitive) ||
- key.contains("temp",Qt::CaseInsensitive))
+ if (key.startsWith("temp") ||
+ key.startsWith("appt") ||
+ key.startsWith("low") ||
+ key.startsWith("high"))
{
- if ( (value == "NA") || (value == "N/A") )
- return value;
+ if ((value == "NA") || (value == "N/A"))
+ return QString();
else
return value + getTemperatureUnit();
}
- if (key == "wind_gust" || key == "wind_spdgst" || key == "wind_speed")
+ if (key.startsWith("wind_gust") ||
+ key.startsWith("wind_spdgst") ||
+ key.startsWith("wind_speed"))
return value + (m_units == ENG_UNITS ? " mph" : " km/h");
/*The days of the week will be translated if the script sends elements from
the enum DaysOfWeek.*/
- if (key.startsWith("date-"))
+ if (key.startsWith("date"))
{
bool isNumber;
value.toInt( &isNumber);
View
27 mythplugins/mythweather/mythweather/weatherSetup.cpp
@@ -392,13 +392,6 @@ void ScreenSetup::loadData()
void ScreenSetup::saveData()
{
- if (m_activeList->GetCount() <= 0)
- {
- LOG(VB_GENERAL, LOG_ERR,
- "No Active Screens are defined. Nothing Saved.");
- return;
- }
-
// check if all active screens have sources/locations defined
QStringList notDefined;
@@ -1020,14 +1013,24 @@ void LocationDialog::doSearch()
}
}
- for (int i = 0; i < result_cache.keys().size(); ++i)
+ QMap<ScriptInfo *, QStringList>::iterator it;
+ for (it = result_cache.begin(); it != result_cache.end(); ++it)
{
- si = result_cache.keys()[i];
- QStringList results = result_cache[si];
+ si = it.key();
+ QStringList results = it.value();
QString name = si->name;
- for (int ii = 0; ii < results.size(); ++ii)
+ QStringList::iterator rit;
+ for (rit = results.begin(); rit != results.end(); ++rit)
{
- QStringList tmp = results[ii].split("::");
+ QStringList tmp = (*rit).split("::");
+ if (tmp.size() < 2)
+ {
+ LOG(VB_GENERAL, LOG_WARNING,
+ QString("Invalid line in Location Search reponse "
+ "from %1: %2")
+ .arg(name).arg(*rit));
+ continue;
+ }
QString resultstring = QString("%1 (%2)").arg(tmp[1]).arg(name);
MythUIButtonListItem *item =
new MythUIButtonListItem(m_locationList, resultstring);
View
2  mythtv/VERSION
@@ -1 +1 @@
-SOURCE_VERSION="v0.25.1"
+SOURCE_VERSION="v0.25.2"
View
4 mythtv/html/setup/wizard-network.qsp
@@ -13,6 +13,10 @@
<td id='BackendServerIP6_cell'>&nbsp;
<a href="javascript:showSettingHelp('BackendServerIP6')">[?]</a>
</td></tr>
+ <tr><th align=right><i18n>Use Link-Local</i18n>:</th>
+ <td id='AllowLinkLocal_cell'>&nbsp;
+ <a href="javascript:showSettingHelp('AllowLinkLocal')">[?]</a>
+ </td></tr>
<tr><th align=right><i18n>Security PIN</i18n>:</th>
<td><input id='SecurityPin' type='password' size=10>
<a href="javascript:showSettingHelp('SecurityPin')">[?]</a>
View
4 mythtv/libs/libmyth/programinfo.cpp
@@ -4180,7 +4180,9 @@ void ProgramInfo::MarkAsInUse(bool inuse, QString usedFor)
query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
query.bindValue(":RECUSAGE", inUseForWhat);
query.bindValue(":UPDATETIME", inUseTime);
- query.bindValue(":RECHOST", hostname);
+ query.bindValue(":RECHOST",
+ hostname.isEmpty() ? gCoreContext->GetHostName()
+ : hostname);
query.bindValue(":RECDIR", recDir);
if (!query.exec())
View
196 mythtv/libs/libmythbase/serverpool.cpp
@@ -20,6 +20,13 @@ static QList<QNetworkAddressEntry> naList_4;
static QList<QNetworkAddressEntry> naList_6;
static QReadWriteLock naLock;
+static QPair<QHostAddress, int> kLinkLocal =
+ QHostAddress::parseSubnet("169.254.0.0/16");
+#if !defined(QT_NO_IPV6)
+static QPair<QHostAddress, int> kLinkLocal6 =
+ QHostAddress::parseSubnet("fe80::/10");
+#endif
+
class PrivUdpSocket : public QUdpSocket
{
public:
@@ -38,7 +45,7 @@ class PrivUdpSocket : public QUdpSocket
{
#if !defined(QT_NO_IPV6)
if (addr.protocol() == QAbstractSocket::IPv6Protocol &&
- addr.isInSubnet(QHostAddress::parseSubnet("fe80::/10")) &&
+ addr.isInSubnet(kLinkLocal6) &&
host.ip().scopeId() != addr.scopeId())
{
return false;
@@ -92,6 +99,7 @@ void ServerPool::SelectDefaultListen(bool force)
QHostAddress config_v6(gCoreContext->GetSetting("BackendServerIP6"));
bool v6IsSet = config_v6.isNull() ? true : false;
#endif
+ bool allowLinkLocal = gCoreContext->GetNumSetting("AllowLinkLocal", true) > 0;
// loop through all available interfaces
QList<QNetworkInterface> IFs = QNetworkInterface::allInterfaces();
@@ -102,97 +110,147 @@ void ServerPool::SelectDefaultListen(bool force)
continue;
QList<QNetworkAddressEntry> IPs = qni->addressEntries();
- QList<QNetworkAddressEntry>::const_iterator qnai;
+ QList<QNetworkAddressEntry>::iterator qnai;
for (qnai = IPs.begin(); qnai != IPs.end(); ++qnai)
{
QHostAddress ip = qnai->ip();
- if (naList_4.contains(*qnai))
- // already defined, skip
- continue;
- else if (!config_v4.isNull() && (ip == config_v4))
+#if !defined(QT_NO_IPV6)
+ if (ip.protocol() == QAbstractSocket::IPv4Protocol)
{
- // IPv4 address is defined, add it
- LOG(VB_GENERAL, LOG_DEBUG,
+#endif
+ if (naList_4.contains(*qnai))
+ // already defined, skip
+ continue;
+
+ else if (!config_v4.isNull() && (ip == config_v4))
+ {
+ // IPv4 address is defined, add it
+ LOG(VB_GENERAL, LOG_DEBUG,
QString("Adding BackendServerIP to address list."));
- naList_4.append(*qnai);
- v4IsSet = true;
- }
- else if (ip == QHostAddress::LocalHost)
- {
- // always listen on LocalHost
- LOG(VB_GENERAL, LOG_DEBUG,
- QString("Adding IPv4 loopback to address list."));
- naList_4.append(*qnai);
- if (!v4IsSet && (config_v4 == ip))
+ naList_4.append(*qnai);
v4IsSet = true;
- }
- else if (config_v4.isNull() &&
- (ip.protocol() == QAbstractSocket::IPv4Protocol))
- {
- // IPv4 address is not defined, populate one
- // restrict autoconfiguration to RFC1918 private networks
- if (ip.isInSubnet(QHostAddress::parseSubnet("10.0.0.0/8")) ||
- ip.isInSubnet(QHostAddress::parseSubnet("172.16.0.0/12")) ||
- ip.isInSubnet(QHostAddress::parseSubnet("192.168.0.0/16")))
+
+ }
+
+ else if (ip == QHostAddress::LocalHost)
{
+ // always listen on LocalHost
LOG(VB_GENERAL, LOG_DEBUG,
- QString("Adding '%1' to address list.")
- .arg(ip.toString()));
+ QString("Adding IPv4 loopback to address list."));
+ naList_4.append(*qnai);
+ if (!v4IsSet && (config_v4 == ip))
+ v4IsSet = true;
+ }
+
+ else if (ip.isInSubnet(kLinkLocal) && allowLinkLocal)
+ {
+ // optionally listen on linklocal
+ // the next clause will enable it anyway if no IP address
+ // has been set
+ LOG(VB_GENERAL, LOG_DEBUG,
+ QString("Adding link-local '%1' to address list.")
+ .arg(PRETTYIP_(ip)));
naList_4.append(*qnai);
}
+
+ else if (config_v4.isNull())
+ {
+ // IPv4 address is not defined, populate one
+ // restrict autoconfiguration to RFC1918 private networks
+ static QPair<QHostAddress, int>
+ privNet1 = QHostAddress::parseSubnet("10.0.0.0/8"),
+ privNet2 = QHostAddress::parseSubnet("172.16.0.0/12"),
+ privNet3 = QHostAddress::parseSubnet("192.168.0.0/16");
+
+ if (ip.isInSubnet(privNet1) || ip.isInSubnet(privNet2) ||
+ ip.isInSubnet(privNet3))
+ {
+ LOG(VB_GENERAL, LOG_DEBUG,
+ QString("Adding '%1' to address list.")
+ .arg(PRETTYIP_(ip)));
+ naList_4.append(*qnai);
+ }
+ else if (ip.isInSubnet(kLinkLocal))
+ {
+ LOG(VB_GENERAL, LOG_DEBUG,
+ QString("Adding link-local '%1' to address list.")
+ .arg(PRETTYIP_(ip)));
+ naList_4.append(*qnai);
+ }
+ else
+ LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping "
+ "non-private address during IPv4 autoselection: %1")
+ .arg(PRETTYIP_(ip)));
+ }
+
else
- LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping non-private "
- "address during IPv4 autoselection: %1")
- .arg(ip.toString()));
- }
+ LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping address: %1")
+ .arg(PRETTYIP_(ip)));
+
#if !defined(QT_NO_IPV6)
- else if (naList_6.contains(*qnai))
- // already defined, skip
- continue;
- else if (!config_v6.isNull() && (ip == config_v6))
+ }
+ else
{
+ if (ip.isInSubnet(kLinkLocal6))
+ {
+ // set scope id for link local address
+ ip.setScopeId(qni->name());
+ qnai->setIp(ip);
+ }
+
+ if (naList_6.contains(*qnai))
+ // already defined, skip
+ continue;
+
+ else if ((!config_v6.isNull()) && (ip == config_v6))
+ {
// IPv6 address is defined, add it
- LOG(VB_GENERAL, LOG_DEBUG,
+ LOG(VB_GENERAL, LOG_DEBUG,
QString("Adding BackendServerIP6 to address list."));
- naList_6.append(*qnai);
- v6IsSet = true;
- }
- else if (ip == QHostAddress::LocalHostIPv6)
- {
- // always listen on LocalHost
- LOG(VB_GENERAL, LOG_DEBUG,
- QString("Adding IPv6 loopback to address list."));
- naList_6.append(*qnai);
- if (!v6IsSet && (config_v6 == ip))
+ naList_6.append(*qnai);
v6IsSet = true;
- }
- else if (config_v6.isNull() &&
- (ip.protocol() == QAbstractSocket::IPv6Protocol))
- {
- bool linklocal = false;
- if (ip.isInSubnet(QHostAddress::parseSubnet("fe80::/10")))
+ }
+
+ else if (ip == QHostAddress::LocalHostIPv6)
{
- // Link-local address, find its scope ID (interface name)
- QNetworkAddressEntry ae = *qnai;
- QHostAddress ha = ip;
- ha.setScopeId(qni->name());
- ae.setIp(ha);
- naList_6.append(ae);
- linklocal = true;
+ // always listen on LocalHost
+ LOG(VB_GENERAL, LOG_DEBUG,
+ QString("Adding IPv6 loopback to address list."));
+ naList_6.append(*qnai);
+ if (!v6IsSet && (config_v6 == ip))
+ v6IsSet = true;
}
- else
+
+ else if (ip.isInSubnet(kLinkLocal6) && allowLinkLocal)
+ {
+ // optionally listen on linklocal
+ // the next clause will enable it anyway if no IP address
+ // has been set
+ LOG(VB_GENERAL, LOG_DEBUG,
+ QString("Adding link-local '%1' to address list.")
+ .arg(ip.toString()));
+ naList_6.append(*qnai);
+ }
+
+ else if (config_v6.isNull())
{
+ if (ip.isInSubnet(kLinkLocal6))
+ LOG(VB_GENERAL, LOG_DEBUG,
+ QString("Adding link-local '%1' to address list.")
+ .arg(PRETTYIP_(ip)));
+ else
+ LOG(VB_GENERAL, LOG_DEBUG,
+ QString("Adding '%1' to address list.")
+ .arg(PRETTYIP_(ip)));
+
naList_6.append(*qnai);
}
- LOG(VB_GENERAL, LOG_DEBUG,
- QString("Adding%1 '%2' to address list.")
- .arg(linklocal ? " link-local" : "")
- .arg(PRETTYIP_(ip)));
+
+ else
+ LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping address: %1")
+ .arg(PRETTYIP_(ip)));
}
#endif
- else
- LOG(VB_GENERAL, LOG_DEBUG, QString("Skipping address: %1")
- .arg(PRETTYIP_(ip)));
}
}
View
17 mythtv/libs/libmythupnp/htmlserver.cpp
@@ -27,23 +27,18 @@ HtmlServerExtension::HtmlServerExtension( const QString sSharePath,
: HttpServerExtension( "Html" , sSharePath),
m_IndexFilename(sApplicationPrefix + "index")
{
- // Cache the absolute path for the share directory.
+ // Cache the canonical path for the share directory.
QDir dir( sSharePath + "/html" );
- dir.makeAbsolute();
-
- m_sAbsoluteSharePath = dir.absolutePath();
-
if (getenv("MYTHHTMLDIR"))
{
QString sTempSharePath = getenv("MYTHHTMLDIR");
if (!sTempSharePath.isEmpty())
- {
dir.setPath( sTempSharePath );
- m_sAbsoluteSharePath = dir.absolutePath();
- }
}
+
+ m_sSharePath = dir.canonicalPath();
}
/////////////////////////////////////////////////////////////////////////////
@@ -66,7 +61,7 @@ bool HtmlServerExtension::ProcessRequest( HTTPRequest *pRequest )
return( false );
bool bStorageGroupFile = false;
- QFileInfo oInfo( m_sAbsoluteSharePath + pRequest->m_sResourceUrl );
+ QFileInfo oInfo( m_sSharePath + pRequest->m_sResourceUrl );
if (oInfo.isDir())
{
@@ -92,8 +87,6 @@ bool HtmlServerExtension::ProcessRequest( HTTPRequest *pRequest )
if (bStorageGroupFile || oInfo.exists() == true )
{
- oInfo.makeAbsolute();
-
QString sResName = oInfo.canonicalFilePath();
// --------------------------------------------------------------
@@ -101,7 +94,7 @@ bool HtmlServerExtension::ProcessRequest( HTTPRequest *pRequest )
// --------------------------------------------------------------
if (( bStorageGroupFile ) ||
- (sResName.startsWith( m_sAbsoluteSharePath, Qt::CaseInsensitive )))
+ (sResName.startsWith( m_sSharePath, Qt::CaseInsensitive )))
{
if (oInfo.exists())
{
View
2  mythtv/libs/libmythupnp/htmlserver.h
@@ -28,7 +28,7 @@ class UPNP_PUBLIC HtmlServerExtension : public HttpServerExtension
{
private:
- QString m_sAbsoluteSharePath;
+ QString m_sSharePath;
ServerSideScripting m_Scripting;
QString m_IndexFilename;
View
73 mythtv/programs/mythbackend/scheduler.cpp
@@ -690,7 +690,10 @@ bool Scheduler::ChangeRecordingEnd(RecordingInfo *oldp, RecordingInfo *newp)
}
EncoderLink *tv = (*m_tvList)[oldp->GetCardID()];
- RecStatusType rs = tv->StartRecording(oldp);
+ RecordingInfo tempold(*oldp);
+ lockit.unlock();
+ RecStatusType rs = tv->StartRecording(&tempold);
+ lockit.relock();
if (rs != rsRecording)
{
LOG(VB_GENERAL, LOG_ERR,
@@ -817,8 +820,6 @@ void Scheduler::SlaveDisconnected(uint cardid)
void Scheduler::BuildWorkList(void)
{
- reclist_changed = false;
-
RecIter i = reclist.begin();
for (; i != reclist.end(); ++i)
{
@@ -1792,11 +1793,13 @@ void Scheduler::run(void)
QDateTime idleSince = QDateTime();
int maxSleep = 60000; // maximum sleep time in milliseconds
int schedRunTime = 30; // max scheduler run time in seconds
+ bool statuschanged = false;
while (doRun)
{
+ reclist_changed = false;
+
QDateTime curtime = QDateTime::currentDateTime();
- bool statuschanged = false;
int secs_to_next = (startIter != reclist.end()) ?
curtime.secsTo((*startIter)->GetRecordingStartTime()) : 60*60;
@@ -1905,6 +1908,12 @@ void Scheduler::run(void)
**it, statuschanged, prerollseconds, tuningTimeout);
}
+ // HandleRecording() and HandleTuning() temporarily unlocks
+ // schedLock. If anything changed, reclist iterators could be
+ // invalidated so start over.
+ if (reclist_changed)
+ continue;
+
/// Wake any slave backends that need waking
curtime = QDateTime::currentDateTime();
for (RecIter it = startIter; it != reclist.end(); ++it)
@@ -1930,6 +1939,8 @@ void Scheduler::run(void)
idleTimeoutSecs, idleWaitForRecordingTime,
statuschanged);
}
+
+ statuschanged = false;
}
RunEpilog();
@@ -1960,7 +1971,8 @@ int Scheduler::CalcTimeToNextHandleRecordingEvent(
int secs_to_next = curtime.secsTo((*i)->GetRecordingStartTime());
- if (!recPendingList[(*i)->MakeUniqueSchedulerKey()])
+ if ((*i)->GetRecordingStatus() == rsWillRecord &&
+ !recPendingList[(*i)->MakeUniqueSchedulerKey()])
secs_to_next -= 30;
if (secs_to_next < 0)
@@ -2283,7 +2295,7 @@ bool Scheduler::HandleRecording(
if (ri.GetRecordingStatus() == rsTuning)
{
HandleTuning(ri, statuschanged, tuningTimeout);
- return false;
+ return reclist_changed;
}
if (ri.GetRecordingStatus() != rsWillRecord)
@@ -2351,7 +2363,18 @@ bool Scheduler::HandleRecording(
return false;
}
- if ((prerollseconds > 0) && !IsBusyRecording(&ri))
+ // Use this temporary copy of ri when schedLock is not held. Be
+ // sure to update it as long as it is still needed whenever ri
+ // changes.
+ RecordingInfo tempri(ri);
+
+ schedLock.unlock();
+ bool isBusyRecording = IsBusyRecording(&tempri);
+ schedLock.lock();
+ if (reclist_changed)
+ return reclist_changed;
+
+ if (prerollseconds > 0 && !isBusyRecording)
{
// Will use pre-roll settings only if no other
// program is currently being recorded
@@ -2416,13 +2439,18 @@ bool Scheduler::HandleRecording(
recording_dir,
reclist);
ri.SetPathname(recording_dir);
+ tempri.SetPathname(recording_dir);
}
if (!recPendingList[schedid])
{
- nexttv->RecordPending(&ri, max(secsleft, 0),
+ schedLock.unlock();
+ nexttv->RecordPending(&tempri, max(secsleft, 0),
hasLaterList.contains(schedid));
recPendingList[schedid] = true;
+ schedLock.lock();
+ if (reclist_changed)
+ return reclist_changed;
}
if (secsleft > 0)
@@ -2432,6 +2460,7 @@ bool Scheduler::HandleRecording(
recstartts.setTime(
QTime(recstartts.time().hour(), recstartts.time().minute()));
ri.SetRecordingStartTime(recstartts);
+ tempri.SetRecordingStartTime(recstartts);
QString details = QString("%1: channel %2 on cardid %3, sourceid %4")
.arg(ri.toString(ProgramInfo::kTitleSubtitle))
@@ -2444,8 +2473,9 @@ bool Scheduler::HandleRecording(
{
if (ri.GetRecordingStatus() == rsWillRecord)
{
- recStatus = nexttv->StartRecording(&ri);
- ri.AddHistory(false);
+ schedLock.unlock();
+ recStatus = nexttv->StartRecording(&tempri);
+ schedLock.lock();
// activate auto expirer
if (m_expirer)
@@ -2456,7 +2486,7 @@ bool Scheduler::HandleRecording(
HandleRecordingStatusChange(ri, recStatus, details);
statuschanged = true;
- return false;
+ return reclist_changed;
}
void Scheduler::HandleRecordingStatusChange(
@@ -2467,15 +2497,13 @@ void Scheduler::HandleRecordingStatusChange(
ri.SetRecordingStatus(recStatus);
- if (rsTuning != recStatus)
- {
- bool doSchedAfterStart =
- ((rsRecording != recStatus) && (rsTuning != recStatus)) ||
- schedAfterStartMap[ri.GetRecordingRuleID()] ||
- (ri.GetParentRecordingRuleID() &&
- schedAfterStartMap[ri.GetParentRecordingRuleID()]);
- ri.AddHistory(doSchedAfterStart);
- }
+ bool doSchedAfterStart =
+ recStatus != rsTuning &&
+ (recStatus != rsRecording ||
+ schedAfterStartMap[ri.GetRecordingRuleID()] ||
+ (ri.GetParentRecordingRuleID() &&
+ schedAfterStartMap[ri.GetParentRecordingRuleID()]));
+ ri.AddHistory(doSchedAfterStart);
QString msg = (rsRecording == recStatus) ?
QString("Started recording") :
@@ -2516,7 +2544,12 @@ void Scheduler::HandleTuning(
}
else if (tuningTimeout > 0)
{
+ schedLock.unlock();
recStatus = (*tvit)->GetRecordingStatus();
+ schedLock.lock();
+ if (reclist_changed)
+ return;
+
if (rsTuning == recStatus)
{
// If tuning is still taking place this long after we
View
2  mythtv/programs/mythtranscode/transcode.cpp
@@ -143,7 +143,7 @@ class AudioReencodeBuffer : public AudioOutput
int bufsize = m_saveBuffer->m_buffer.size();
int part = min(len - index, m_audioFrameSize - bufsize);
total_frames += part / m_bytes_per_frame;
- timecode = total_frames * 1000 / m_eff_audiorate;
+ timecode += total_frames * 1000 / m_eff_audiorate;
// Store frames in buffer, basing frame count on number of
// bytes, which works only for uncompressed data.
m_saveBuffer->appendData(&buf[index], part,
Please sign in to comment.
Something went wrong with that request. Please try again.