Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rework the QUERY_RECORDINGS sort.

Modify QUERY_RECORDINGS to allow retrieving sorted or unsorted lists.
The argument may be one of Recording (for in-progress recordings only,
unsorted), or Unsorted, Ascending, or Descending (where the latter 3
request all recordings and specify sort order, based on starttime).
This allows code that needs to sort the recording list itself, like the
PlaybackBox code, to request and unsorted list, while still allowing
bindings and MythXML users to get sorted lists.

Change includes a binary version change, so plugin rebuild is required.
Also includes a protocol version change, so all clients--frontends,
backends, MythWeb--need updating.
  • Loading branch information...
commit e965e4bab1d37fd9fa94a569bfc90d50ce5bf9a5 1 parent e949f5f
@sphery sphery authored
View
4 mythtv/bindings/perl/MythTV.pm
@@ -106,8 +106,8 @@ package MythTV;
# Note: as of July 21, 2010, this is actually a string, to account for proto
# versions of the form "58a". This will get used if protocol versions are
# changed on a fixes branch ongoing.
- our $PROTO_VERSION = "64";
- our $PROTO_TOKEN = "8675309J";
+ our $PROTO_VERSION = "65";
+ our $PROTO_TOKEN = "D2BB94C2";
# currentDatabaseVersion is defined in libmythtv in
# mythtv/libs/libmythtv/dbcheck.cpp and should be the current MythTV core
View
4 mythtv/bindings/php/MythBackend.php
@@ -11,8 +11,8 @@ class MythBackend {
// MYTH_PROTO_VERSION is defined in libmyth in mythtv/libs/libmyth/mythcontext.h
// and should be the current MythTV protocol version.
- static $protocol_version = '64';
- static $protocol_token = '8675309J';
+ static $protocol_version = '65';
+ static $protocol_token = 'D2BB94C2';
// The character string used by the backend to separate records
static $backend_separator = '[]:[]';
View
2  mythtv/bindings/python/MythTV/methodheap.py
@@ -189,7 +189,7 @@ def getRecordings(self):
"""
Returns a list of all Program objects which have already recorded
"""
- return self._getSortedPrograms('QUERY_RECORDINGS Play')
+ return self._getSortedPrograms('QUERY_RECORDINGS Ascending')
def getExpiring(self):
"""
View
4 mythtv/bindings/python/MythTV/static.py
@@ -8,8 +8,8 @@
SCHEMA_VERSION = 1269
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
-PROTO_VERSION = '64'
-PROTO_TOKEN = '8675309J'
+PROTO_VERSION = '65'
+PROTO_TOKEN = 'D2BB94C2'
BACKEND_SEP = '[]:[]'
INSTALL_PREFIX = '/usr/local'
View
2  mythtv/contrib/maintenance/flush_deleted_recgroup.pl
@@ -70,7 +70,7 @@
my $myth = new MythTV();
# Load all of the recordings
- my %rows = $myth->backend_rows('QUERY_RECORDINGS Delete');
+ my %rows = $myth->backend_rows('QUERY_RECORDINGS Descending');
# Parse each recording, and delete anything in the "Deleted" recgroup
my $i = 0;
View
4 mythtv/contrib/user_jobs/mythlink.pl
@@ -318,7 +318,7 @@
}
else {
- %rows = $Myth->backend_rows('QUERY_RECORDINGS DELETE');
+ %rows = $Myth->backend_rows('QUERY_RECORDINGS Descending');
}
foreach my $row (@{$rows{'rows'}}) {
my $show = new MythTV::Recording(@$row);
@@ -390,7 +390,7 @@
sub do_rename {
$q = 'UPDATE recorded SET basename=? WHERE chanid=? AND starttime=FROM_UNIXTIME(?)';
$sh = $dbh->prepare($q);
- my %rows = $Myth->backend_rows('QUERY_RECORDINGS Delete');
+ my %rows = $Myth->backend_rows('QUERY_RECORDINGS Descending');
foreach my $row (@{$rows{'rows'}}) {
my $show = new MythTV::Recording(@$row);
# File doesn't exist locally
View
22 mythtv/libs/libmyth/programinfo.cpp
@@ -4277,13 +4277,28 @@ bool LoadFromOldRecorded(
return true;
}
+/** \fn ProgramInfo::LoadFromRecorded(void)
+ * \brief Load a ProgramList from the recorded table.
+ * \param destination ProgramList to fill
+ * \param possiblyInProgressRecordingsOnly return only in-progress
+ * recordings or empty list
+ * \param inUseMap in-use programs map
+ * \param isJobRunning job map
+ * \param recMap recording map
+ * \param sort sort order, negative for descending, 0 for
+ * unsorted, positive for ascending
+ * \return true if it succeeds, false if it fails.
+ * \sa QueryInUseMap(void)
+ * QueryJobsRunning(int)
+ * Scheduler::GetRecording()
+ */
bool LoadFromRecorded(
ProgramList &destination,
bool possiblyInProgressRecordingsOnly,
const QMap<QString,uint32_t> &inUseMap,
const QMap<QString,bool> &isJobRunning,
const QMap<QString, ProgramInfo*> &recMap,
- bool sortDescending)
+ int sort)
{
destination.clear();
@@ -4297,8 +4312,9 @@ bool LoadFromRecorded(
if (possiblyInProgressRecordingsOnly)
thequery += "WHERE r.endtime >= NOW() AND r.starttime <= NOW() ";
- thequery += "ORDER BY r.starttime ";
- if (sortDescending)
+ if (sort)
+ thequery += "ORDER BY r.starttime ";
+ if (sort < 0)
thequery += "DESC ";
MSqlQuery query(MSqlQuery::InitCon());
View
2  mythtv/libs/libmyth/programinfo.h
@@ -699,7 +699,7 @@ MPUBLIC bool LoadFromRecorded(
const QMap<QString,uint32_t> &inUseMap,
const QMap<QString,bool> &isJobRunning,
const QMap<QString, ProgramInfo*> &recMap,
- bool sortDescending = false);
+ int sort = 0);
template<typename TYPE>
bool LoadFromScheduler(
View
10 mythtv/libs/libmyth/remoteutil.cpp
@@ -12,13 +12,15 @@
#include "storagegroup.h"
#include "mythevent.h"
-vector<ProgramInfo *> *RemoteGetRecordedList(bool deltype)
+vector<ProgramInfo *> *RemoteGetRecordedList(int sort)
{
QString str = "QUERY_RECORDINGS ";
- if (deltype)
- str += "Delete";
+ if (sort < 0)
+ str += "Descending";
+ else if (sort > 0)
+ str += "Ascending";
else
- str += "Play";
+ str += "Unsorted";
QStringList strlist(str);
View
2  mythtv/libs/libmyth/remoteutil.h
@@ -30,7 +30,7 @@ class MPUBLIC FileSystemInfo
int weight;
};
-MPUBLIC vector<ProgramInfo *> *RemoteGetRecordedList(bool deltype);
+MPUBLIC vector<ProgramInfo *> *RemoteGetRecordedList(int sort);
MPUBLIC vector<FileSystemInfo> RemoteGetFreeSpace(void);
MPUBLIC bool RemoteGetLoad(float load[3]);
MPUBLIC bool RemoteGetUptime(time_t &uptime);
View
6 mythtv/libs/libmythbase/mythversion.h
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
-#define MYTH_BINARY_VERSION "0.25.20110305-1"
+#define MYTH_BINARY_VERSION "0.25.20110307-1"
/** \brief Increment this whenever the MythTV network protocol changes.
*
@@ -35,8 +35,8 @@
* mythtv/bindings/python/MythTV/static.py (version number)
* mythtv/bindings/python/MythTV/mythproto.py (layout)
*/
-#define MYTH_PROTO_VERSION "64"
-#define MYTH_PROTO_TOKEN "8675309J"
+#define MYTH_PROTO_VERSION "65"
+#define MYTH_PROTO_TOKEN "D2BB94C2"
MBASE_PUBLIC const char *GetMythSourceVersion();
View
2  mythtv/libs/libmythtv/tv_play.cpp
@@ -10582,7 +10582,7 @@ void TV::FillOSDMenuJumpRec(PlayerContext* ctx, const QString category,
QMutexLocker locker(&progListsLock);
progLists.clear();
- vector<ProgramInfo*> *infoList = RemoteGetRecordedList(false);
+ vector<ProgramInfo*> *infoList = RemoteGetRecordedList(0);
bool LiveTVInAllPrograms = gCoreContext->GetNumSetting("LiveTVInAllPrograms",0);
if (infoList)
{
View
13 mythtv/programs/mythbackend/mainserver.cpp
@@ -1540,7 +1540,8 @@ void MainServer::SendResponse(MythSocket *socket, QStringList &commands)
/**
* \addtogroup myth_network_protocol
* \par QUERY_RECORDINGS \e type
- * The \e type parameter can be either "Play", "Recording" or "Delete".
+ * The \e type parameter can be either "Recording", "Unsorted", "Ascending",
+ * or "Descending".
* Returns programinfo (title, subtitle, description, category, chanid,
* channum, callsign, channel.name, fileURL, \e et \e cetera)
*/
@@ -1557,10 +1558,18 @@ void MainServer::HandleQueryRecordings(QString type, PlaybackSock *pbs)
QMap<QString,bool> isJobRunning =
ProgramInfo::QueryJobsRunning(JOB_COMMFLAG);
+ int sort = 0;
+ // Allow "Play" and "Delete" for backwards compatibility with protocol
+ // version 56 and below.
+ if ((type == "Ascending") || (type == "Play"))
+ sort = 1;
+ else if ((type == "Descending") || (type == "Delete"))
+ sort = -1;
+
ProgramList destination;
LoadFromRecorded(
destination, (type == "Recording"),
- inUseMap, isJobRunning, recMap, (type == "Delete"));
+ inUseMap, isJobRunning, recMap, sort);
QMap<QString,ProgramInfo*>::iterator mit = recMap.begin();
for (; mit != recMap.end(); mit = recMap.erase(mit))
View
5 mythtv/programs/mythbackend/mythxml.cpp
@@ -1012,6 +1012,9 @@ void MythXML::GetAlbumArt( HTTPRequest *pRequest )
void MythXML::GetRecorded( HTTPRequest *pRequest )
{
bool bDescending = pRequest->m_mapParams[ "Descending" ].toInt();
+ int sort = 1;
+ if (bDescending)
+ sort = -1;
QMap<QString,ProgramInfo*> recMap;
if (sched)
@@ -1022,7 +1025,7 @@ void MythXML::GetRecorded( HTTPRequest *pRequest )
ProgramList progList;
LoadFromRecorded( progList, false,
- inUseMap, isJobRunning, recMap, bDescending );
+ inUseMap, isJobRunning, recMap, sort );
QMap<QString,ProgramInfo*>::iterator mit = recMap.begin();
for (; mit != recMap.end(); mit = recMap.erase(mit))
View
4 mythtv/programs/mythfrontend/programinfocache.cpp
@@ -73,9 +73,9 @@ void ProgramInfoCache::Load(const bool updateUI)
locker.unlock();
/**/
- // the param to RemoteGetRecordedList doesn't actually matter
+ // Get an unsorted list (sort = 0) from RemoteGetRecordedList
// we sort the list later anyway.
- vector<ProgramInfo*> *tmp = RemoteGetRecordedList(false);
+ vector<ProgramInfo*> *tmp = RemoteGetRecordedList(0);
/**/
locker.relock();
Please sign in to comment.
Something went wrong with that request. Please try again.