MythTV  master
upnpcds.cpp
Go to the documentation of this file.
1 // Program Name: upnpcds.cpp
3 // Created : Oct. 24, 2005
4 //
5 // Purpose : uPnp Content Directory Service
6 //
7 // Copyright (c) 2005 David Blain <dblain@mythtv.org>
8 //
9 // Licensed under the GPL v2 or later, see COPYING for details
10 //
12 
13 #include <algorithm>
14 #include <cmath>
15 #include <cstdint>
16 
17 #include "upnp.h"
18 #include "upnpcds.h"
19 #include "upnputil.h"
20 #include "mythlogging.h"
21 #include "mythversion.h"
22 
23 #define DIDL_LITE_BEGIN "<DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\">"
24 #define DIDL_LITE_END "</DIDL-Lite>";
25 
27 //
29 
31 {
32  if (pObject)
33  {
34  pObject->IncrRef();
35  m_List.append( pObject );
36  }
37 }
38 
40 //
42 
44 {
45  for (auto *const object : qAsConst(objects))
46  {
47  object->IncrRef();
48  m_List.append( object );
49  }
50 }
51 
53 //
55 
57  bool ignoreChildren)
58 {
59  QString sXML;
60 
61  for (auto *item : qAsConst(m_List))
62  sXML += item->toXml(filter, ignoreChildren);
63 
64  return sXML;
65 }
66 
68 //
70 
71 UPnpCDS::UPnpCDS( UPnpDevice *pDevice, const QString &sSharePath )
72  : Eventing( "UPnpCDS", "CDS_Event", sSharePath )
73 {
75  m_root.m_sId = "0";
76  m_root.m_sParentId = "-1";
77  m_root.m_sTitle = "MythTV";
78  m_root.m_sClass = "object.container";
79  m_root.m_bRestricted = true;
80  m_root.m_bSearchable = true;
81 
82  AddVariable( new StateVariable< QString >( "TransferIDs" , true ) );
83  AddVariable( new StateVariable< QString >( "ContainerUpdateIDs", true ) );
84  AddVariable( new StateVariable< uint16_t >( "SystemUpdateID" , true ) );
85  AddVariable( new StateVariable< QString >( "ServiceResetToken" , true ) );
86 
87  SetValue< uint16_t >( "SystemUpdateID", 0 );
88  // ServiceResetToken must be unique (never repeat) and it must change when
89  // the backend restarts (all internal state is reset)
90  //
91  // The current date + time fits the criteria.
92  SetValue< QString >( "ServiceResetToken",
93  QDateTime::currentDateTimeUtc().toString(Qt::ISODate) );
94 
95  QString sUPnpDescPath = UPnp::GetConfiguration()->GetValue( "UPnP/DescXmlPath", sSharePath );
96 
97  m_sServiceDescFileName = sUPnpDescPath + "CDS_scpd.xml";
98  m_sControlUrl = "/CDS_Control";
99 
102 
103  // Add our Service Definition to the device.
104 
105  RegisterService( pDevice );
106 
107  // ContentDirectoryService uses a different schema definition for the FeatureList
108  // to the ConnectionManager, although they appear to be identical
110  "urn:schemas-upnp-org:av:avs" ));
111  m_features.AddAttribute(NameValue( "xmlns:xsi",
112  "http://www.w3.org/2001/XMLSchema-instance" ));
113  m_features.AddAttribute(NameValue( "xsi:schemaLocation",
114  "urn:schemas-upnp-org:av:avs "
115  "http://www.upnp.org/schemas/av/avs.xsd" ));
116 }
117 
119 //
121 
123 {
124  while (!m_extensions.isEmpty())
125  {
126  delete m_extensions.takeLast();
127  }
128 }
129 
131 //
133 
134 UPnpCDSMethod UPnpCDS::GetMethod( const QString &sURI )
135 {
136  if (sURI == "GetServDesc" ) return CDSM_GetServiceDescription;
137  if (sURI == "Browse" ) return CDSM_Browse ;
138  if (sURI == "Search" ) return CDSM_Search ;
139  if (sURI == "GetSearchCapabilities" ) return CDSM_GetSearchCapabilities;
140  if (sURI == "GetSortCapabilities" ) return CDSM_GetSortCapabilities ;
141  if (sURI == "GetSystemUpdateID" ) return CDSM_GetSystemUpdateID ;
142  if (sURI == "X_GetFeatureList" || // HACK: Samsung
143  sURI == "GetFeatureList" ) return CDSM_GetFeatureList ;
144  if (sURI == "GetServiceResetToken" ) return CDSM_GetServiceResetToken ;
145 
146  return( CDSM_Unknown );
147 }
148 
150 //
152 
154 {
155  if (sFlag == "BrowseMetadata" ) return( CDS_BrowseMetadata );
156  if (sFlag == "BrowseDirectChildren" ) return( CDS_BrowseDirectChildren );
157 
158  return( CDS_BrowseUnknown );
159 }
160 
162 //
164 
166 {
167  if (pExtension)
168  {
169  m_extensions.append( pExtension );
170 
171  CDSShortCutList shortcuts = pExtension->GetShortCuts();
172  CDSShortCutList::iterator it;
173  for (it = shortcuts.begin(); it != shortcuts.end(); ++it)
174  {
175  RegisterShortCut(it.key(), it.value());
176  }
177  }
178 }
179 
181 //
183 
185 {
186  if (pExtension)
187  {
188  m_extensions.removeAll(pExtension);
189  delete pExtension;
190  }
191 }
192 
194 //
196 
198  const QString& objectID)
199 {
200  m_pShortCuts->AddShortCut(type, objectID);
201 }
202 
204 //
206 
208 {
209  m_features.AddFeature(feature); // m_features takes ownership
210 }
211 
213 //
215 
217 {
219 }
220 
222 //
224 
226 {
227  if (pRequest)
228  {
229  if (Eventing::ProcessRequest( pRequest ))
230  return true;
231 
232  if ( pRequest->m_sBaseUrl != m_sControlUrl )
233  {
234 #if 0
235  LOG(VB_UPNP, LOG_DEBUG,
236  QString("UPnpCDS::ProcessRequest - BaseUrl (%1) not ours...")
237  .arg(pRequest->m_sBaseUrl));
238 #endif
239  return false;
240  }
241 
242  switch( GetMethod( pRequest->m_sMethod ) )
243  {
246  break;
247  case CDSM_Browse :
248  HandleBrowse( pRequest );
249  break;
250  case CDSM_Search :
251  HandleSearch( pRequest );
252  break;
254  HandleGetSearchCapabilities( pRequest );
255  break;
257  HandleGetSortCapabilities( pRequest );
258  break;
260  HandleGetSystemUpdateID( pRequest );
261  break;
262  case CDSM_GetFeatureList :
263  HandleGetFeatureList( pRequest );
264  break;
266  HandleGetServiceResetToken( pRequest );
267  break;
268  default:
270  break;
271  }
272 
273  return true;
274  }
275 
276  return false;
277 }
278 
279 static const std::array<const UPnpCDSClientException,5> clientExceptions {{
280  // Windows Media Player version 12
281  { CDS_ClientWMP,
282  "User-Agent",
283  "Windows-Media-Player/" },
284  // Windows Media Player version < 12
285  { CDS_ClientWMP,
286  "User-Agent",
287  "Mozilla/4.0 (compatible; UPnP/1.0; Windows 9x" },
288  // XBMC
289  { CDS_ClientXBMC,
290  "User-Agent",
291  "Platinum/" },
292  // XBox 360
293  { CDS_ClientXBox,
294  "User-Agent",
295  "Xbox" },
296  // Sony Blu-ray players
298  "X-AV-Client-Info",
299  R"(cn="Sony Corporation"; mn="Blu-ray Disc Player")" },
300 }};
301 
303  UPnpCDSRequest *pCDSRequest )
304 {
305  pCDSRequest->m_eClient = CDS_ClientDefault;
306  pCDSRequest->m_nClientVersion = 0;
307 
308  // Do we know this client string?
309  for ( const auto & except : clientExceptions )
310  {
311  QString sHeaderValue = pRequest->GetRequestHeader(except.sHeaderKey, "");
312  int idx = sHeaderValue.indexOf(except.sHeaderValue);
313  if (idx == -1)
314  continue;
315 
316  pCDSRequest->m_eClient = except.nClientType;
317 
318  idx += except.sHeaderValue.length();
319 
320  // If we have a / at the end of the string then we
321  // increment the string to skip over it
322  if ( sHeaderValue[idx] == '/')
323  {
324  idx++;
325  }
326 
327  // Now find the version number
328  QString version = sHeaderValue.mid(idx).trimmed();
329  idx = version.indexOf( '.' );
330  if (idx != -1)
331  {
332  idx = version.indexOf( '.', idx + 1 );
333  }
334  if (idx != -1)
335  {
336  version = version.left( idx );
337  }
338  idx = version.indexOf( ' ' );
339  if (idx != -1)
340  {
341  version = version.left( idx );
342  }
343 
344  pCDSRequest->m_nClientVersion = version.toDouble();
345 
346  LOG(VB_UPNP, LOG_INFO,
347  QString("DetermineClient %1:%2 Identified as %3 version %4")
348  .arg(except.sHeaderKey) .arg(sHeaderValue)
349  .arg(pCDSRequest->m_eClient)
350  .arg(pCDSRequest->m_nClientVersion));
351  break;
352  }
353 }
354 
355 
357 //
359 
361 {
362  UPnpCDSExtensionResults *pResult = nullptr;
363  UPnpCDSRequest request;
364 
365  DetermineClient( pRequest, &request );
366  request.m_sObjectId = pRequest->m_mapParams[ "objectid" ];
367  request.m_sParentId = "0";
368  request.m_eBrowseFlag =
369  GetBrowseFlag( pRequest->m_mapParams[ "browseflag" ] );
370  request.m_sFilter = pRequest->m_mapParams[ "filter" ];
371  request.m_nStartingIndex = Max(pRequest->m_mapParams[ "startingindex" ].toUShort(),
372  uint16_t(0));
373  request.m_nRequestedCount =
374  pRequest->m_mapParams[ "requestedcount"].toUShort();
375  if (request.m_nRequestedCount == 0)
376  request.m_nRequestedCount = UINT16_MAX;
377  request.m_sSortCriteria = pRequest->m_mapParams[ "sortcriteria" ];
378 
379 
380  LOG(VB_UPNP, LOG_DEBUG, QString("UPnpCDS::ProcessRequest \n"
381  ": url = %1 \n"
382  ": Method = %2 \n"
383  ": ObjectId = %3 \n"
384  ": BrowseFlag = %4 \n"
385  ": Filter = %5 \n"
386  ": StartingIndex = %6 \n"
387  ": RequestedCount = %7 \n"
388  ": SortCriteria = %8 " )
389  .arg( pRequest->m_sBaseUrl )
390  .arg( pRequest->m_sMethod )
391  .arg( request.m_sObjectId )
392  .arg( request.m_eBrowseFlag )
393  .arg( request.m_sFilter )
394  .arg( request.m_nStartingIndex )
395  .arg( request.m_nRequestedCount)
396  .arg( request.m_sSortCriteria ));
397 
399  QString sErrorDesc = "";
400  uint16_t nNumberReturned = 0;
401  uint16_t nTotalMatches = 0;
402  uint16_t nUpdateID = 0;
403  QString sResultXML;
404  FilterMap filter = request.m_sFilter.split(',');
405 
406  LOG(VB_UPNP, LOG_INFO,
407  QString("UPnpCDS::HandleBrowse ObjectID=%1")
408  .arg(request.m_sObjectId));
409 
410  if (request.m_sObjectId == "0")
411  {
412  // ------------------------------------------------------------------
413  // This is for the root object... lets handle it.
414  // ------------------------------------------------------------------
415 
416  switch( request.m_eBrowseFlag )
417  {
418  case CDS_BrowseMetadata:
419  {
420  // -----------------------------------------------------------
421  // Return Root Object Only
422  // -----------------------------------------------------------
423 
424  eErrorCode = UPnPResult_Success;
425  nNumberReturned = 1;
426  nTotalMatches = 1;
427  nUpdateID = m_root.m_nUpdateId;
428 
429  m_root.SetChildCount( m_extensions.count() );
431 
432  sResultXML = m_root.toXml(filter);
433 
434  break;
435  }
436 
438  {
439  // Loop Through each extension and Build the Root Folders
440 
441  eErrorCode = UPnPResult_Success;
442  nTotalMatches = m_extensions.count();
443  nUpdateID = m_root.m_nUpdateId;
444 
445  if (request.m_nRequestedCount == 0)
446  request.m_nRequestedCount = nTotalMatches;
447 
448  uint16_t nStart = Max( request.m_nStartingIndex, uint16_t( 0 ));
449  uint16_t nCount = Min( nTotalMatches, request.m_nRequestedCount );
450 
451  DetermineClient( pRequest, &request );
452 
453  for (uint i = nStart;
454  (i < (uint)m_extensions.size()) &&
455  (nNumberReturned < nCount);
456  i++)
457  {
458  UPnpCDSExtension *pExtension = m_extensions[i];
459  CDSObject* pExtensionRoot = pExtension->GetRoot();
460  sResultXML += pExtensionRoot->toXml(filter, true); // Ignore Children
461  nNumberReturned ++;
462  }
463 
464  break;
465  }
466  default: break;
467  }
468  }
469  else
470  {
471  // ------------------------------------------------------------------
472  // Look for a CDS Extension that knows how to handle this ObjectID
473  // ------------------------------------------------------------------
474 
475  UPnpCDSExtensionList::iterator it = m_extensions.begin();
476  for (; (it != m_extensions.end()) && !pResult; ++it)
477  {
478  LOG(VB_UPNP, LOG_INFO,
479  QString("UPNP Browse : Searching for : %1 / ObjectID : %2")
480  .arg((*it)->m_sExtensionId).arg(request.m_sObjectId));
481 
482  pResult = (*it)->Browse(&request);
483  }
484 
485  if (pResult != nullptr)
486  {
487  eErrorCode = pResult->m_eErrorCode;
488  sErrorDesc = pResult->m_sErrorDesc;
489 
490  if (eErrorCode == UPnPResult_Success)
491  {
492  nNumberReturned = pResult->m_List.count();
493  nTotalMatches = pResult->m_nTotalMatches;
494  nUpdateID = pResult->m_nUpdateID;
495  if (request.m_eBrowseFlag == CDS_BrowseMetadata)
496  sResultXML = pResult->GetResultXML(filter, true); // Ignore children
497  else
498  sResultXML = pResult->GetResultXML(filter);
499  }
500 
501  delete pResult;
502  pResult = nullptr;
503  }
504  }
505 
506  // ----------------------------------------------------------------------
507  // Output Results of Browse Method
508  // ----------------------------------------------------------------------
509 
510  if (eErrorCode == UPnPResult_Success)
511  {
512  NameValues list;
513 
514  QString sResults = DIDL_LITE_BEGIN;
515  sResults += sResultXML;
516  sResults += DIDL_LITE_END;
517 
518  list.push_back(NameValue("Result", sResults));
519  list.push_back(NameValue("NumberReturned", nNumberReturned));
520  list.push_back(NameValue("TotalMatches", nTotalMatches));
521  list.push_back(NameValue("UpdateID", nUpdateID));
522 
523  pRequest->FormatActionResponse(list);
524  }
525  else
526  UPnp::FormatErrorResponse ( pRequest, eErrorCode, sErrorDesc );
527 
528 }
529 
531 //
533 
535 {
536  UPnpCDSExtensionResults *pResult = nullptr;
537  UPnpCDSRequest request;
538 
540  QString sErrorDesc = "";
541  uint16_t nNumberReturned = 0;
542  uint16_t nTotalMatches = 0;
543  uint16_t nUpdateID = 0;
544  QString sResultXML;
545 
546  DetermineClient( pRequest, &request );
547  request.m_sObjectId = pRequest->m_mapParams[ "objectid" ];
548  request.m_sContainerID = pRequest->m_mapParams[ "containerid" ];
549  request.m_sFilter = pRequest->m_mapParams[ "filter" ];
550  request.m_nStartingIndex =
551  pRequest->m_mapParams[ "startingindex" ].toLong();
552  request.m_nRequestedCount =
553  pRequest->m_mapParams[ "requestedcount"].toLong();
554  request.m_sSortCriteria = pRequest->m_mapParams[ "sortcriteria" ];
555  request.m_sSearchCriteria = pRequest->m_mapParams[ "searchcriteria"];
556 
557  LOG(VB_UPNP, LOG_INFO,
558  QString("UPnpCDS::HandleSearch ObjectID=%1, ContainerId=%2")
559  .arg(request.m_sObjectId) .arg(request.m_sContainerID));
560 
561  // ----------------------------------------------------------------------
562  // Break the SearchCriteria into it's parts
563  // -=>TODO: This DOES NOT handle ('s or other complex expressions
564  // ----------------------------------------------------------------------
565 
566  QRegularExpression re {"\\b(or|and)\\b", QRegularExpression::CaseInsensitiveOption};
567 
568 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
569  request.m_sSearchList = request.m_sSearchCriteria.split(
570  re, QString::SkipEmptyParts);
571 #else
572  request.m_sSearchList = request.m_sSearchCriteria.split(
573  re, Qt::SkipEmptyParts);
574 #endif
575  request.m_sSearchClass = "object"; // Default to all objects.
576 
577  // ----------------------------------------------------------------------
578  // -=>TODO: Need to process all expressions in searchCriteria... for now,
579  // Just focus on the "upnp:class derivedfrom" expression
580  // ----------------------------------------------------------------------
581 
582  for ( QStringList::Iterator it = request.m_sSearchList.begin();
583  it != request.m_sSearchList.end();
584  ++it )
585  {
586  if ((*it).contains("upnp:class derivedfrom", Qt::CaseInsensitive))
587  {
588 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
589  QStringList sParts = (*it).split(' ', QString::SkipEmptyParts);
590 #else
591  QStringList sParts = (*it).split(' ', Qt::SkipEmptyParts);
592 #endif
593 
594  if (sParts.count() > 2)
595  {
596  request.m_sSearchClass = sParts[2].trimmed();
597  request.m_sSearchClass.remove( '"' );
598 
599  break;
600  }
601  }
602  }
603 
604  // ----------------------------------------------------------------------
605 
606 
607  LOG(VB_UPNP, LOG_INFO, QString("UPnpCDS::ProcessRequest \n"
608  ": url = %1 \n"
609  ": Method = %2 \n"
610  ": ObjectId = %3 \n"
611  ": SearchCriteria = %4 \n"
612  ": Filter = %5 \n"
613  ": StartingIndex = %6 \n"
614  ": RequestedCount = %7 \n"
615  ": SortCriteria = %8 \n"
616  ": SearchClass = %9" )
617  .arg( pRequest->m_sBaseUrl )
618  .arg( pRequest->m_sMethod )
619  .arg( request.m_sObjectId )
620  .arg( request.m_sSearchCriteria)
621  .arg( request.m_sFilter )
622  .arg( request.m_nStartingIndex )
623  .arg( request.m_nRequestedCount)
624  .arg( request.m_sSortCriteria )
625  .arg( request.m_sSearchClass ));
626 
627 #if 0
628  bool bSearchDone = false;
629 #endif
630 
631  UPnpCDSExtensionList::iterator it = m_extensions.begin();
632  for (; (it != m_extensions.end()) && !pResult; ++it)
633  pResult = (*it)->Search(&request);
634 
635  if (pResult != nullptr)
636  {
637  eErrorCode = pResult->m_eErrorCode;
638  sErrorDesc = pResult->m_sErrorDesc;
639 
640  if (eErrorCode == UPnPResult_Success)
641  {
642  FilterMap filter = request.m_sFilter.split(',');
643  nNumberReturned = pResult->m_List.count();
644  nTotalMatches = pResult->m_nTotalMatches;
645  nUpdateID = pResult->m_nUpdateID;
646  sResultXML = pResult->GetResultXML(filter);
647 #if 0
648  bSearchDone = true;
649 #endif
650  }
651 
652  delete pResult;
653  pResult = nullptr;
654  }
655 
656 #if 0
657  nUpdateID = 0;
658  LOG(VB_UPNP, LOG_DEBUG, sResultXML);
659 #endif
660 
661  if (eErrorCode == UPnPResult_Success)
662  {
663  NameValues list;
664  QString sResults = DIDL_LITE_BEGIN;
665  sResults += sResultXML;
666  sResults += DIDL_LITE_END;
667 
668  list.push_back(NameValue("Result", sResults));
669  list.push_back(NameValue("NumberReturned", nNumberReturned));
670  list.push_back(NameValue("TotalMatches", nTotalMatches));
671  list.push_back(NameValue("UpdateID", nUpdateID));
672 
673  pRequest->FormatActionResponse(list);
674  }
675  else
676  UPnp::FormatErrorResponse( pRequest, eErrorCode, sErrorDesc );
677 }
678 
686 {
687  NameValues list;
688 
689  LOG(VB_UPNP, LOG_INFO,
690  QString("UPnpCDS::ProcessRequest : %1 : %2")
691  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
692 
693  // -=>TODO: Need to implement based on CDS Extension Capabilities
694 
695 // list.push_back(
696 // NameValue("SearchCaps",
697 // "dc:title,dc:creator,dc:date,upnp:class,res@size,"
698 // "res@protocolInfo","@refID"));
699  list.push_back(
700  NameValue("SearchCaps","")); // We don't support any searching
701 
702  pRequest->FormatActionResponse(list);
703 }
704 
712 {
713  NameValues list;
714 
715  LOG(VB_UPNP, LOG_INFO,
716  QString("UPnpCDS::ProcessRequest : %1 : %2")
717  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
718 
719  // -=>TODO: Need to implement based on CDS Extension Capabilities
720 
721 // list.push_back(
722 // NameValue("SortCaps",
723 // "dc:title,dc:creator,dc:date,upnp:class,res@size,"
724 // "res@protocolInfo,@refID"));
725  list.push_back(
726  NameValue("SortCaps","")); // We don't support any sorting
727 
728  pRequest->FormatActionResponse(list);
729 }
730 
732 //
734 
736 {
737  NameValues list;
738 
739  LOG(VB_UPNP, LOG_INFO,
740  QString("UPnpCDS::ProcessRequest : %1 : %2")
741  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
742 
743  auto nId = GetValue<uint16_t>("SystemUpdateID");
744 
745  list.push_back(NameValue("Id", nId));
746 
747  pRequest->FormatActionResponse(list);
748 }
749 
751 //
753 
755 {
756  NameValues list;
757  LOG(VB_UPNP, LOG_INFO,
758  QString("UPnpCDS::ProcessRequest : %1 : %2")
759  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
760 
761  QString sResults = m_features.toXML();
762 
763  list.push_back(NameValue("FeatureList", sResults));
764 
765  pRequest->FormatActionResponse(list);
766 }
767 
769 {
770  NameValues list;
771 
772  LOG(VB_UPNP, LOG_INFO,
773  QString("UPnpCDS::ProcessRequest : %1 : %2")
774  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
775 
776  auto sToken = GetValue<QString>("ServiceResetToken");
777 
778  list.push_back(NameValue("ResetToken", sToken));
779 
780  pRequest->FormatActionResponse(list);
781 }
782 
785 //
786 // UPnpCDSExtension Implementation
787 //
790 
792 {
793  if (m_pRoot)
794  {
795  m_pRoot->DecrRef();
796  m_pRoot = nullptr;
797  }
798 }
799 
801 //
803 
805 {
806  if (!pRequest->m_sObjectId.startsWith(m_sExtensionId, Qt::CaseSensitive))
807  return false;
808 
809  LOG(VB_UPNP, LOG_INFO, QString("%1: Browse request is for us.").arg(m_sExtensionId));
810 
811  return true;
812 }
813 
815 //
817 
819 {
820  // -=>TODO: Need to add Filter & Sorting Support.
821 
822  if (!IsBrowseRequestForUs( pRequest ))
823  return( nullptr );
824 
825  // ----------------------------------------------------------------------
826  // Split the request ID into token key/value
827  //
828  // Music/Artist=123/Album=15
829  // Music/Genre=32/Artist=616/Album=13/Track=2632
830  // ----------------------------------------------------------------------
831  IDTokenMap tokens = TokenizeIDString(pRequest->m_sObjectId);
832  QString currentToken = GetCurrentToken(pRequest->m_sObjectId).first;
833 
834  LOG(VB_UPNP, LOG_DEBUG, QString("Browse (%1): Current Token '%2'")
835  .arg(m_sExtensionId).arg(currentToken));
836 
837  // ----------------------------------------------------------------------
838  // Process based on location in hierarchy
839  // ----------------------------------------------------------------------
840 
841  auto *pResults = new UPnpCDSExtensionResults();
842 
843  if (pResults != nullptr)
844  {
845  switch( pRequest->m_eBrowseFlag )
846  {
847  case CDS_BrowseMetadata:
848  {
849  if (pRequest->m_nRequestedCount == 0)
850  pRequest->m_nRequestedCount = 1; // This should be the case anyway, but enforce it just in case
851 
852  pRequest->m_sParentId = "0"; // Root
853 
854  // Create parent ID by stripping the last token from the object ID
855  if (pRequest->m_sObjectId.contains("/"))
856  pRequest->m_sParentId = pRequest->m_sObjectId.section("/", 0, -2);
857 
858  LOG(VB_UPNP, LOG_DEBUG, QString("UPnpCDS::Browse: BrowseMetadata (%1)").arg(pRequest->m_sObjectId));
859  if (LoadMetadata(pRequest, pResults, tokens, currentToken))
860  return pResults;
861  pResults->m_eErrorCode = UPnPResult_CDS_NoSuchObject;
862  break;
863  }
864 
866  {
867  pRequest->m_sParentId = pRequest->m_sObjectId;
868  LOG(VB_UPNP, LOG_DEBUG, QString("UPnpCDS::Browse: BrowseDirectChildren (%1)").arg(pRequest->m_sObjectId));
869  if (LoadChildren(pRequest, pResults, tokens, currentToken))
870  return pResults;
871  pResults->m_eErrorCode = UPnPResult_CDS_NoSuchObject;
872  break;
873  }
874 
875  default:
876  {
877  pResults->m_eErrorCode = UPnPResult_CDS_NoSuchObject;
878  pResults->m_sErrorDesc = "";
879  }
880  }
881 
882  }
883 
884  return( pResults );
885 }
886 
888 //
890 
892 {
893  return m_sClass.startsWith( pRequest->m_sSearchClass );
894 }
895 
897 //
899 
901 {
902  // -=>TODO: Need to add Filter & Sorting Support.
903  // -=>TODO: Need to add Sub-Folder/Category Support!!!!!
904 
905  QStringList sEmptyList;
906  LOG(VB_UPNP, LOG_INFO,
907  QString("UPnpCDSExtension::Search : m_sClass = %1 : "
908  "m_sSearchClass = %2")
909  .arg(m_sClass).arg(pRequest->m_sSearchClass));
910 
911  if ( !IsSearchRequestForUs( pRequest ))
912  {
913  LOG(VB_UPNP, LOG_INFO,
914  QString("UPnpCDSExtension::Search - Not For Us : "
915  "m_sClass = %1 : m_sSearchClass = %2")
916  .arg(m_sClass).arg(pRequest->m_sSearchClass));
917  return nullptr;
918  }
919 
920  auto *pResults = new UPnpCDSExtensionResults();
921 
922 // CreateItems( pRequest, pResults, 0, "", false );
923 
924  return pResults;
925 }
926 
928 //
930 
931 QString UPnpCDSExtension::RemoveToken( const QString &sToken,
932  const QString &sStr, int num )
933 {
934  QString sResult( "" );
935  int nPos = -1;
936 
937  for (int nIdx=0; nIdx < num; nIdx++)
938  {
939  if ((nPos = sStr.lastIndexOf( sToken, nPos )) == -1)
940  break;
941  }
942 
943  if (nPos > 0)
944  sResult = sStr.left( nPos );
945 
946  return sResult;
947 }
948 
963  UPnpCDSExtensionResults* /*pResults*/,
964  const IDTokenMap& /*tokens*/,
965  const QString& /*currentToken*/)
966 {
967  return false;
968 }
969 
970 
985  UPnpCDSExtensionResults* /*pResults*/,
986  const IDTokenMap& /*tokens*/,
987  const QString& /*currentToken*/)
988 {
989  return false;
990 }
991 
1007 {
1008  IDTokenMap tokenMap;
1009 
1010  QStringList tokens = Id.split('/');
1011 
1012  QStringList::iterator it;
1013  for (it = tokens.begin() + 1; it < tokens.end(); ++it) // Skip the 'root' token
1014  {
1015 
1016  QString key = (*it).section('=', 0, 0).toLower();
1017  QString value = (*it).section('=', 1, 1);
1018 
1019  tokenMap.insert(key, value);
1020  LOG(VB_UPNP, LOG_DEBUG, QString("Token Key: %1 Value: %2").arg(key)
1021  .arg(value));
1022  }
1023 
1024  return tokenMap;
1025 }
1026 
1027 
1043 {
1044  QStringList tokens = Id.split('/');
1045  QString current = tokens.last();
1046  QString key = current.section('=', 0, 0).toLower();
1047  QString value = current.section('=', 1, 1);
1048 
1049  return IDToken(key, value);
1050 }
1051 
1052 QString UPnpCDSExtension::CreateIDString(const QString &requestId,
1053  const QString &name,
1054  int value)
1055 {
1056  return CreateIDString(requestId, name, QString::number(value));
1057 }
1058 
1059 QString UPnpCDSExtension::CreateIDString(const QString &requestId,
1060  const QString &name,
1061  const QString &value)
1062 {
1063  IDToken currentToken = GetCurrentToken(requestId);
1064  QString currentName = currentToken.first;
1065  QString currentValue = currentToken.second;
1066 
1067  // For metadata requests the request ID will be the ID of the result, so
1068  // we don't need to do anything
1069  if (currentName == name.toLower() && !currentValue.isEmpty() &&
1070  currentValue == value.toLower())
1071  return requestId;
1072  if (currentName == name.toLower() && currentValue.isEmpty())
1073  return QString("%1=%2").arg(requestId).arg(value);
1074  return QString("%1/%2=%3").arg(requestId).arg(name).arg(value);
1075 }
1076 
1078 {
1079  LOG(VB_GENERAL, LOG_CRIT, "UPnpCDSExtension::CreateRoot() called on base class");
1081  m_sName,
1082  "0");
1083 }
1084 
1086 {
1087  if (!m_pRoot)
1088  CreateRoot();
1089 
1090  return m_pRoot;
1091 }
1092 
1094 //
1096 
1098 {
1099  QString xml;
1100 
1101  xml = "<shortcutlist>\r\n";
1102 
1103  QMap<ShortCutType, QString>::iterator it;
1104  for (it = m_shortcuts.begin(); it != m_shortcuts.end(); ++it)
1105  {
1106  ShortCutType type = it.key();
1107  QString objectID = *it;
1108  xml += "<shortcut>\r\n";
1109  xml += QString("<name>%1</name>\r\n").arg(TypeToName(type));
1110  xml += QString("<objectID>%1</objectID>\r\n").arg(HTTPRequest::Encode(objectID));
1111  xml += "</shortcut>\r\n";
1112  }
1113 
1114  xml += "</shortcutlist>\r\n";
1115 
1116  return xml;
1117 }
1118 
1120  const QString &objectID)
1121 {
1122  if (!m_shortcuts.contains(type))
1123  m_shortcuts.insert(type, objectID);
1124  else
1125  {
1126  LOG(VB_GENERAL, LOG_ERR, QString("UPnPCDSShortcuts::AddShortCut(): "
1127  "Attempted to register duplicate "
1128  "shortcut").arg(TypeToName(type)));
1129  }
1130 
1131  return false;
1132 }
1133 
1135 {
1136  QString str;
1137 
1138  switch (type)
1139  {
1140  case MUSIC :
1141  str = "MUSIC";
1142  break;
1143  case MUSIC_ALBUMS :
1144  str = "MUSIC_ALBUMS";
1145  break;
1146  case MUSIC_ARTISTS :
1147  str = "MUSIC_ARTISTS";
1148  break;
1149  case MUSIC_GENRES :
1150  str = "MUSIC_GENRES";
1151  break;
1152  case MUSIC_PLAYLISTS :
1153  str = "MUSIC_PLAYLISTS";
1154  break;
1155  case MUSIC_RECENTLY_ADDED :
1156  str = "MUSIC_RECENTLY_ADDED";
1157  break;
1158  case MUSIC_LAST_PLAYED :
1159  str = "MUSIC_LAST_PLAYED";
1160  break;
1161  case MUSIC_AUDIOBOOKS :
1162  str = "MUSIC_AUDIOBOOKS";
1163  break;
1164  case MUSIC_STATIONS :
1165  str = "MUSIC_STATIONS";
1166  break;
1167  case MUSIC_ALL :
1168  str = "MUSIC_ALL";
1169  break;
1170  case MUSIC_FOLDER_STRUCTURE :
1171  str = "MUSIC_FOLDER_STRUCTURE";
1172  break;
1173 
1174  case IMAGES :
1175  str = "IMAGES";
1176  break;
1177  case IMAGES_YEARS :
1178  str = "IMAGES_YEARS";
1179  break;
1180  case IMAGES_YEARS_MONTH :
1181  str = "IMAGES_YEARS_MONTH";
1182  break;
1183  case IMAGES_ALBUM :
1184  str = "IMAGES_ALBUM";
1185  break;
1186  case IMAGES_SLIDESHOWS :
1187  str = "IMAGES_SLIDESHOWS";
1188  break;
1189  case IMAGES_RECENTLY_ADDED :
1190  str = "IMAGES_RECENTLY_ADDED";
1191  break;
1192  case IMAGES_LAST_WATCHED :
1193  str = "IMAGES_LAST_WATCHED";
1194  break;
1195  case IMAGES_ALL :
1196  str = "IMAGES_ALL";
1197  break;
1199  str = "IMAGES_FOLDER_STRUCTURE";
1200  break;
1201 
1202  case VIDEOS :
1203  str = "VIDEOS";
1204  break;
1205  case VIDEOS_GENRES :
1206  str = "VIDEOS_GENRES";
1207  break;
1208  case VIDEOS_YEARS :
1209  str = "VIDEOS_YEARS";
1210  break;
1211  case VIDEOS_YEARS_MONTH :
1212  str = "VIDEOS_YEARS_MONTH";
1213  break;
1214  case VIDEOS_ALBUM :
1215  str = "VIDEOS_ALBUM";
1216  break;
1217  case VIDEOS_RECENTLY_ADDED :
1218  str = "VIDEOS_RECENTLY_ADDED";
1219  break;
1220  case VIDEOS_LAST_PLAYED :
1221  str = "VIDEOS_LAST_PLAYED";
1222  break;
1223  case VIDEOS_RECORDINGS :
1224  str = "VIDEOS_RECORDINGS";
1225  break;
1226  case VIDEOS_ALL :
1227  str = "VIDEOS_ALL";
1228  break;
1230  case FOLDER_STRUCTURE :
1231  str = "VIDEOS_FOLDER_STRUCTURE";
1232  break;
1233  }
1234 
1235  return str;
1236 }
1237 
1238 // vim:ts=4:sw=4:ai:et:si:sts=4
UPnPShortcutFeature::IMAGES
@ IMAGES
Definition: upnpcds.h:163
UPnpCDSExtensionResults::GetResultXML
QString GetResultXML(FilterMap &filter, bool ignoreChildren=false)
Definition: upnpcds.cpp:56
UPnpCDS::m_sControlUrl
QString m_sControlUrl
Definition: upnpcds.h:291
UPnpCDS::m_root
CDSObject m_root
Definition: upnpcds.h:288
NameValue
Definition: upnputil.h:53
UPnpCDSRequest::m_nRequestedCount
uint16_t m_nRequestedCount
Definition: upnpcds.h:80
HTTPRequest::m_sBaseUrl
QString m_sBaseUrl
Definition: httprequest.h:125
UPnpCDSRequest::m_sFilter
QString m_sFilter
Definition: upnpcds.h:78
UPnPShortcutFeature::VIDEOS_LAST_PLAYED
@ VIDEOS_LAST_PLAYED
Definition: upnpcds.h:179
UPnpCDS::m_features
UPnPFeatureList m_features
Definition: upnpcds.h:293
HTTPRequest
Definition: httprequest.h:108
UPnpCDS::GetBasePaths
QStringList GetBasePaths() override
Definition: upnpcds.cpp:216
UPnpCDSExtension::CreateRoot
virtual void CreateRoot()
Definition: upnpcds.cpp:1077
CDSShortCutList
QMap< UPnPShortcutFeature::ShortCutType, QString > CDSShortCutList
Definition: upnpcds.h:195
UPnpCDSExtension
Definition: upnpcds.h:203
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
UPnpCDSExtension::~UPnpCDSExtension
virtual ~UPnpCDSExtension()
Definition: upnpcds.cpp:791
CDSObject::m_sTitle
QString m_sTitle
Definition: upnpcdsobjects.h:194
UPnPShortcutFeature::MUSIC_STATIONS
@ MUSIC_STATIONS
Definition: upnpcds.h:159
Eventing::GetBasePaths
QStringList GetBasePaths() override
Definition: eventing.cpp:137
UPnpCDS::HandleGetSortCapabilities
static void HandleGetSortCapabilities(HTTPRequest *pRequest)
Return the list of supported sorting fields.
Definition: upnpcds.cpp:711
CDSObject
Definition: upnpcdsobjects.h:184
UPnPShortcutFeature::VIDEOS_ALBUM
@ VIDEOS_ALBUM
Definition: upnpcds.h:177
UPnPShortcutFeature
Standard UPnP Shortcut feature.
Definition: upnpcds.h:139
CDSObject::m_nUpdateId
short m_nUpdateId
Definition: upnpcdsobjects.h:186
UPnpCDS::HandleSearch
void HandleSearch(HTTPRequest *pRequest)
Definition: upnpcds.cpp:534
UPnPShortcutFeature::IMAGES_ALL
@ IMAGES_ALL
Definition: upnpcds.h:170
UPnpCDSRequest::m_sParentId
QString m_sParentId
Definition: upnpcds.h:85
CDS_ClientWMP
@ CDS_ClientWMP
Definition: upnpcds.h:55
CDSM_Browse
@ CDSM_Browse
Definition: upnpcds.h:36
HTTPRequest::m_sMethod
QString m_sMethod
Definition: httprequest.h:127
UPnpCDS::HandleGetSystemUpdateID
void HandleGetSystemUpdateID(HTTPRequest *pRequest)
Definition: upnpcds.cpp:735
UPnpCDSBrowseFlag
UPnpCDSBrowseFlag
Definition: upnpcds.h:46
UPnPShortcutFeature::IMAGES_SLIDESHOWS
@ IMAGES_SLIDESHOWS
Definition: upnpcds.h:167
UPnPShortcutFeature::VIDEOS_RECORDINGS
@ VIDEOS_RECORDINGS
Definition: upnpcds.h:180
UPnpCDSExtension::CreateIDString
static QString CreateIDString(const QString &RequestId, const QString &Name, int Value)
Definition: upnpcds.cpp:1052
arg
arg(title).arg(filename).arg(doDelete))
Eventing
Definition: eventing.h:254
StateVariable
Definition: eventing.h:118
UPnpCDSExtension::m_sName
QString m_sName
Definition: upnpcds.h:207
UPnpCDSRequest::m_nStartingIndex
uint16_t m_nStartingIndex
Definition: upnpcds.h:79
UPnPShortcutFeature::MUSIC_ALL
@ MUSIC_ALL
Definition: upnpcds.h:160
UPnPShortcutFeature::IMAGES_LAST_WATCHED
@ IMAGES_LAST_WATCHED
Definition: upnpcds.h:169
UPnpCDS::m_extensions
UPnpCDSExtensionList m_extensions
Definition: upnpcds.h:287
UPnpCDSExtension::IsSearchRequestForUs
virtual bool IsSearchRequestForUs(UPnpCDSRequest *pRequest)
Definition: upnpcds.cpp:891
UPnPFeatureList::AddFeature
void AddFeature(UPnPFeature *feature)
Definition: upnpserviceimpl.cpp:36
UPnpCDSRequest::m_eClient
UPnpCDSClient m_eClient
Definition: upnpcds.h:95
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
Eventing::ProcessRequest
bool ProcessRequest(HTTPRequest *pRequest) override
Definition: eventing.cpp:149
UPnpCDS::~UPnpCDS
~UPnpCDS() override
Definition: upnpcds.cpp:122
upnpcds.h
HTTPRequest::GetRequestHeader
QString GetRequestHeader(const QString &sKey, QString sDefault)
Definition: httprequest.cpp:1172
UPnpCDSExtension::TokenizeIDString
static IDTokenMap TokenizeIDString(const QString &Id)
Split the 'Id' String up into tokens for handling by each extension.
Definition: upnpcds.cpp:1006
CDSObject::SetChildContainerCount
void SetChildContainerCount(uint32_t nCount)
Allows the caller to set childContainerCount without having to load children.
Definition: upnpcdsobjects.cpp:255
UPnPShortcutFeature::VIDEOS_ALL
@ VIDEOS_ALL
Definition: upnpcds.h:181
UPnPShortcutFeature::MUSIC_AUDIOBOOKS
@ MUSIC_AUDIOBOOKS
Definition: upnpcds.h:158
CDS_ClientXBMC
@ CDS_ClientXBMC
Definition: upnpcds.h:56
UPnpCDSRequest::m_eBrowseFlag
UPnpCDSBrowseFlag m_eBrowseFlag
Definition: upnpcds.h:86
HTTPRequest::Encode
static QString Encode(const QString &sIn)
Definition: httprequest.cpp:1801
DIDL_LITE_END
#define DIDL_LITE_END
Definition: upnpcds.cpp:24
CDSObject::m_sParentId
QString m_sParentId
Definition: upnpcdsobjects.h:193
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
UPnpCDSRequest::m_nClientVersion
double m_nClientVersion
Definition: upnpcds.h:96
UPnp::FormatErrorResponse
static void FormatErrorResponse(HTTPRequest *pRequest, UPnPResultCode eCode, const QString &sMsg="")
Definition: upnp.cpp:280
mythversion.h
UPnpCDSExtension::Browse
virtual UPnpCDSExtensionResults * Browse(UPnpCDSRequest *pRequest)
Definition: upnpcds.cpp:818
UPnpCDSRequest::m_sContainerID
QString m_sContainerID
Definition: upnpcds.h:77
NameValues
Definition: upnputil.h:89
CDS_BrowseDirectChildren
@ CDS_BrowseDirectChildren
Definition: upnpcds.h:49
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:26
HTTPRequest::FormatActionResponse
void FormatActionResponse(Serializer *ser)
Definition: httprequest.cpp:767
UPnPShortcutFeature::VIDEOS_YEARS
@ VIDEOS_YEARS
Definition: upnpcds.h:175
UPnpServiceImpl::RegisterService
void RegisterService(UPnpDevice *device)
Creates a UPnpService and adds it to the UPnpDevice's list of services.
Definition: upnpserviceimpl.cpp:5
UPnpCDS::UPnpCDS
UPnpCDS(UPnpDevice *pDevice, const QString &sSharePath)
Definition: upnpcds.cpp:71
FilterMap
QMap< uint, int > FilterMap
Definition: ExternalSignalMonitor.h:13
upnp.h
UPnpCDS::DetermineClient
static void DetermineClient(HTTPRequest *pRequest, UPnpCDSRequest *pCDSRequest)
Definition: upnpcds.cpp:302
mythlogging.h
UPnPShortcutFeature::FOLDER_STRUCTURE
@ FOLDER_STRUCTURE
Definition: upnpcds.h:184
UPnPShortcutFeature::MUSIC_PLAYLISTS
@ MUSIC_PLAYLISTS
Definition: upnpcds.h:155
UPnPShortcutFeature::VIDEOS
@ VIDEOS
Definition: upnpcds.h:173
UPnpCDSRequest::m_sSearchCriteria
QString m_sSearchCriteria
Definition: upnpcds.h:90
UPnpCDSExtension::m_sClass
QString m_sClass
Definition: upnpcds.h:208
feature
static const std::array< featureStruct, 7 > feature
Definition: audiooutputsettings.cpp:433
UPnPShortcutFeature::MUSIC
@ MUSIC
Definition: upnpcds.h:151
clientExceptions
static const std::array< const UPnpCDSClientException, 5 > clientExceptions
Definition: upnpcds.cpp:279
UPnpCDS::HandleGetServiceResetToken
void HandleGetServiceResetToken(HTTPRequest *pRequest)
Definition: upnpcds.cpp:768
HTTPRequest::m_mapParams
QStringMap m_mapParams
Definition: httprequest.h:129
UPnpCDSExtensionResults::m_nTotalMatches
uint16_t m_nTotalMatches
Definition: upnpcds.h:113
UPnpCDS::UnregisterExtension
void UnregisterExtension(UPnpCDSExtension *pExtension)
Definition: upnpcds.cpp:184
UPnpCDS::m_sServiceDescFileName
QString m_sServiceDescFileName
Definition: upnpcds.h:290
UPnPShortcutFeature::VIDEOS_GENRES
@ VIDEOS_GENRES
Definition: upnpcds.h:174
UPnpCDSExtension::Search
virtual UPnpCDSExtensionResults * Search(UPnpCDSRequest *pRequest)
Definition: upnpcds.cpp:900
UPnpCDSExtensionResults::Add
void Add(CDSObject *pObject)
Definition: upnpcds.cpp:30
CDSM_Unknown
@ CDSM_Unknown
Definition: upnpcds.h:34
UPnPShortcutFeature::m_shortcuts
QMap< ShortCutType, QString > m_shortcuts
Definition: upnpcds.h:192
CDSM_GetSearchCapabilities
@ CDSM_GetSearchCapabilities
Definition: upnpcds.h:38
UPnPFeatureList::AddAttribute
void AddAttribute(const NameValue &attribute)
Definition: upnpserviceimpl.cpp:41
CDS_ClientXBox
@ CDS_ClientXBox
Definition: upnpcds.h:58
UPnpCDS::RegisterFeature
void RegisterFeature(UPnPFeature *feature)
Definition: upnpcds.cpp:207
UPnpCDSExtensionResults::m_eErrorCode
UPnPResultCode m_eErrorCode
Definition: upnpcds.h:110
CDSObject::m_bSearchable
bool m_bSearchable
Definition: upnpcdsobjects.h:197
CDSObject::m_bRestricted
bool m_bRestricted
Definition: upnpcdsobjects.h:196
UPnpCDSExtension::m_pRoot
CDSObject * m_pRoot
Definition: upnpcds.h:248
CDSObjects
QList< CDSObject * > CDSObjects
Definition: upnpcdsobjects.h:96
UPnPShortcutFeature::AddShortCut
bool AddShortCut(ShortCutType type, const QString &objectID)
Definition: upnpcds.cpp:1119
UPnpDevice
Definition: upnpdevice.h:100
UPnPShortcutFeature::IMAGES_ALBUM
@ IMAGES_ALBUM
Definition: upnpcds.h:166
UPnPShortcutFeature::IMAGES_FOLDER_STRUCTURE
@ IMAGES_FOLDER_STRUCTURE
Definition: upnpcds.h:171
UPnPShortcutFeature::MUSIC_RECENTLY_ADDED
@ MUSIC_RECENTLY_ADDED
Definition: upnpcds.h:156
CDSObject::SetChildCount
void SetChildCount(uint32_t nCount)
Allows the caller to set childCount without having to load children.
Definition: upnpcdsobjects.cpp:232
UPnpCDS::HandleBrowse
void HandleBrowse(HTTPRequest *pRequest)
Definition: upnpcds.cpp:360
CDS_BrowseMetadata
@ CDS_BrowseMetadata
Definition: upnpcds.h:48
CDSM_GetServiceDescription
@ CDSM_GetServiceDescription
Definition: upnpcds.h:35
UPnPShortcutFeature::IMAGES_YEARS
@ IMAGES_YEARS
Definition: upnpcds.h:164
UPnpCDS::ProcessRequest
bool ProcessRequest(HTTPRequest *pRequest) override
Definition: upnpcds.cpp:225
DIDL_LITE_BEGIN
#define DIDL_LITE_BEGIN
Definition: upnpcds.cpp:23
uint
unsigned int uint
Definition: compat.h:140
UPnpCDS::GetBrowseFlag
static UPnpCDSBrowseFlag GetBrowseFlag(const QString &sFlag)
Definition: upnpcds.cpp:153
UPnPShortcutFeature::VIDEOS_YEARS_MONTH
@ VIDEOS_YEARS_MONTH
Definition: upnpcds.h:176
UPnpCDSExtension::LoadMetadata
virtual bool LoadMetadata(const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, const IDTokenMap &tokens, const QString &currentToken)
Fetch just the metadata for the item identified in the request.
Definition: upnpcds.cpp:962
UPnPShortcutFeature::ShortCutType
ShortCutType
Allowed values for the Container Shortcut feature.
Definition: upnpcds.h:150
UPnPShortcutFeature::MUSIC_ALBUMS
@ MUSIC_ALBUMS
Definition: upnpcds.h:152
CDSObject::m_sId
QString m_sId
Definition: upnpcdsobjects.h:192
UPnpCDSRequest::m_sObjectId
QString m_sObjectId
Definition: upnpcds.h:75
CDS_BrowseUnknown
@ CDS_BrowseUnknown
Definition: upnpcds.h:47
UPnPResult_InvalidAction
@ UPnPResult_InvalidAction
Definition: upnp.h:40
CDS_ClientSonyDB
@ CDS_ClientSonyDB
Definition: upnpcds.h:59
UPnpCDSExtension::LoadChildren
virtual bool LoadChildren(const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, const IDTokenMap &tokens, const QString &currentToken)
Fetch the children of the container identified in the request.
Definition: upnpcds.cpp:984
UPnpCDS::GetMethod
static UPnpCDSMethod GetMethod(const QString &sURI)
Definition: upnpcds.cpp:134
CDSM_GetSystemUpdateID
@ CDSM_GetSystemUpdateID
Definition: upnpcds.h:40
UPnpCDSRequest::m_sSearchList
QStringList m_sSearchList
Definition: upnpcds.h:91
Max
const T & Max(const T &x, const T &y)
Definition: upnputil.h:35
UPnPShortcutFeature::MUSIC_LAST_PLAYED
@ MUSIC_LAST_PLAYED
Definition: upnpcds.h:157
CDS_ClientDefault
@ CDS_ClientDefault
Definition: upnpcds.h:54
UPnpCDSExtension::GetRoot
virtual CDSObject * GetRoot()
Definition: upnpcds.cpp:1085
Min
const T & Min(const T &x, const T &y)
Definition: upnputil.h:30
HTTPRequest::FormatFileResponse
void FormatFileResponse(const QString &sFileName)
Definition: httprequest.cpp:855
MythDate::ISODate
@ ISODate
Default UTC.
Definition: mythdate.h:14
IDTokenMap
QMap< QString, QString > IDTokenMap
Definition: upnpcds.h:199
UPnpCDSExtension::RemoveToken
static QString RemoveToken(const QString &sToken, const QString &sStr, int num)
Definition: upnpcds.cpp:931
UPnPResult_CDS_NoSuchObject
@ UPnPResult_CDS_NoSuchObject
Definition: upnp.h:57
CDSObject::CreateContainer
static CDSObject * CreateContainer(const QString &sId, const QString &sTitle, const QString &sParentId, CDSObject *pObject=nullptr)
Definition: upnpcdsobjects.cpp:468
CDSM_GetSortCapabilities
@ CDSM_GetSortCapabilities
Definition: upnpcds.h:39
CDSM_Search
@ CDSM_Search
Definition: upnpcds.h:37
UPnPShortcutFeature::MUSIC_ARTISTS
@ MUSIC_ARTISTS
Definition: upnpcds.h:153
Configuration::GetValue
virtual int GetValue(const QString &sSetting, int Default)=0
UPnpCDS::HandleGetSearchCapabilities
static void HandleGetSearchCapabilities(HTTPRequest *pRequest)
Return the list of supported search fields.
Definition: upnpcds.cpp:685
StateVariables::AddVariable
void AddVariable(StateVariableBase *pBase)
Definition: eventing.h:191
CDSObject::m_sClass
QString m_sClass
Definition: upnpcdsobjects.h:195
UPnp::GetConfiguration
static Configuration * GetConfiguration()
Definition: upnp.cpp:84
UPnpCDSExtensionResults::m_List
CDSObjects m_List
Definition: upnpcds.h:109
UPnPFeature
Definition: upnpserviceimpl.h:51
CDSObject::toXml
QString toXml(FilterMap &filter, bool ignoreChildren=false) const
Definition: upnpcdsobjects.cpp:264
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
IDToken
QPair< QString, QString > IDToken
Definition: upnpcds.h:200
OT_Container
@ OT_Container
Definition: upnpcdsobjects.h:35
UPnPFeatureList::toXML
QString toXML()
Definition: upnpserviceimpl.cpp:46
UPnPShortcutFeature::MUSIC_FOLDER_STRUCTURE
@ MUSIC_FOLDER_STRUCTURE
Definition: upnpcds.h:161
UPnPResult_Success
@ UPnPResult_Success
Definition: upnp.h:38
UPnpCDSExtensionResults
Definition: upnpcds.h:106
UPnPShortcutFeature::MUSIC_GENRES
@ MUSIC_GENRES
Definition: upnpcds.h:154
UPnpCDSMethod
UPnpCDSMethod
Definition: upnpcds.h:33
UPnPShortcutFeature::VIDEOS_FOLDER_STRUCTURE
@ VIDEOS_FOLDER_STRUCTURE
Definition: upnpcds.h:182
UPnPShortcutFeature::CreateXML
QString CreateXML() override
Definition: upnpcds.cpp:1097
UPnpCDS::RegisterExtension
void RegisterExtension(UPnpCDSExtension *pExtension)
Definition: upnpcds.cpp:165
UPnPShortcutFeature::IMAGES_YEARS_MONTH
@ IMAGES_YEARS_MONTH
Definition: upnpcds.h:165
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
UPnPShortcutFeature::TypeToName
static QString TypeToName(ShortCutType type)
Definition: upnpcds.cpp:1134
UPnpCDSExtension::GetCurrentToken
static IDToken GetCurrentToken(const QString &Id)
Split the 'Id' String up into tokens and return the last (current) token.
Definition: upnpcds.cpp:1042
upnputil.h
UPnpCDSExtension::GetShortCuts
virtual CDSShortCutList GetShortCuts()
Definition: upnpcds.h:270
CDSM_GetServiceResetToken
@ CDSM_GetServiceResetToken
Definition: upnpcds.h:42
UPnpCDSExtensionResults::m_nUpdateID
uint16_t m_nUpdateID
Definition: upnpcds.h:114
UPnpCDS::m_pShortCuts
UPnPShortcutFeature * m_pShortCuts
Definition: upnpcds.h:294
UPnpCDSRequest::m_sSortCriteria
QString m_sSortCriteria
Definition: upnpcds.h:81
nv_python_libs.bbciplayer.bbciplayer_api.version
string version
Definition: bbciplayer_api.py:81
UPnpCDSRequest
Definition: upnpcds.h:72
CDSObject::m_eType
ObjectTypes m_eType
Definition: upnpcdsobjects.h:188
UPnPShortcutFeature::VIDEOS_RECENTLY_ADDED
@ VIDEOS_RECENTLY_ADDED
Definition: upnpcds.h:178
UPnPShortcutFeature::IMAGES_RECENTLY_ADDED
@ IMAGES_RECENTLY_ADDED
Definition: upnpcds.h:168
UPnpCDSExtensionResults::m_sErrorDesc
QString m_sErrorDesc
Definition: upnpcds.h:111
UPnPResultCode
UPnPResultCode
Definition: upnp.h:37
UPnpCDSExtension::m_sExtensionId
QString m_sExtensionId
Definition: upnpcds.h:206
UPnpCDS::HandleGetFeatureList
void HandleGetFeatureList(HTTPRequest *pRequest)
Definition: upnpcds.cpp:754
UPnpCDS::RegisterShortCut
void RegisterShortCut(UPnPShortcutFeature::ShortCutType type, const QString &objectID)
Definition: upnpcds.cpp:197
UPnpCDSExtension::IsBrowseRequestForUs
virtual bool IsBrowseRequestForUs(UPnpCDSRequest *pRequest)
Definition: upnpcds.cpp:804
UPnpCDSRequest::m_sSearchClass
QString m_sSearchClass
Definition: upnpcds.h:92
CDSM_GetFeatureList
@ CDSM_GetFeatureList
Definition: upnpcds.h:41