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