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 using namespace std;
17 
18 #include "upnp.h"
19 #include "upnpcds.h"
20 #include "upnputil.h"
21 #include "mythlogging.h"
22 #include "mythversion.h"
23 
24 #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/\">"
25 #define DIDL_LITE_END "</DIDL-Lite>";
26 
28 //
30 
32 {
33  if (pObject)
34  {
35  pObject->IncrRef();
36  m_List.append( pObject );
37  }
38 }
39 
41 //
43 
45 {
46  for (auto *const object : qAsConst(objects))
47  {
48  object->IncrRef();
49  m_List.append( object );
50  }
51 }
52 
54 //
56 
58  bool ignoreChildren)
59 {
60  QString sXML;
61 
62  for (auto *item : qAsConst(m_List))
63  sXML += item->toXml(filter, ignoreChildren);
64 
65  return sXML;
66 }
67 
69 //
71 
72 UPnpCDS::UPnpCDS( UPnpDevice *pDevice, const QString &sSharePath )
73  : Eventing( "UPnpCDS", "CDS_Event", sSharePath )
74 {
76  m_root.m_sId = "0";
77  m_root.m_sParentId = "-1";
78  m_root.m_sTitle = "MythTV";
79  m_root.m_sClass = "object.container";
80  m_root.m_bRestricted = true;
81  m_root.m_bSearchable = true;
82 
83  AddVariable( new StateVariable< QString >( "TransferIDs" , true ) );
84  AddVariable( new StateVariable< QString >( "ContainerUpdateIDs", true ) );
85  AddVariable( new StateVariable< uint16_t >( "SystemUpdateID" , true ) );
86  AddVariable( new StateVariable< QString >( "ServiceResetToken" , true ) );
87 
88  SetValue< uint16_t >( "SystemUpdateID", 0 );
89  // ServiceResetToken must be unique (never repeat) and it must change when
90  // the backend restarts (all internal state is reset)
91  //
92  // The current date + time fits the criteria.
93  SetValue< QString >( "ServiceResetToken",
94  QDateTime::currentDateTimeUtc().toString(Qt::ISODate) );
95 
96  QString sUPnpDescPath = UPnp::GetConfiguration()->GetValue( "UPnP/DescXmlPath", sSharePath );
97 
98  m_sServiceDescFileName = sUPnpDescPath + "CDS_scpd.xml";
99  m_sControlUrl = "/CDS_Control";
100 
103 
104  // Add our Service Definition to the device.
105 
106  RegisterService( pDevice );
107 
108  // ContentDirectoryService uses a different schema definition for the FeatureList
109  // to the ConnectionManager, although they appear to be identical
111  "urn:schemas-upnp-org:av:avs" ));
112  m_features.AddAttribute(NameValue( "xmlns:xsi",
113  "http://www.w3.org/2001/XMLSchema-instance" ));
114  m_features.AddAttribute(NameValue( "xsi:schemaLocation",
115  "urn:schemas-upnp-org:av:avs "
116  "http://www.upnp.org/schemas/av/avs.xsd" ));
117 }
118 
120 //
122 
124 {
125  while (!m_extensions.isEmpty())
126  {
127  delete m_extensions.takeLast();
128  }
129 }
130 
132 //
134 
135 UPnpCDSMethod UPnpCDS::GetMethod( const QString &sURI )
136 {
137  if (sURI == "GetServDesc" ) return CDSM_GetServiceDescription;
138  if (sURI == "Browse" ) return CDSM_Browse ;
139  if (sURI == "Search" ) return CDSM_Search ;
140  if (sURI == "GetSearchCapabilities" ) return CDSM_GetSearchCapabilities;
141  if (sURI == "GetSortCapabilities" ) return CDSM_GetSortCapabilities ;
142  if (sURI == "GetSystemUpdateID" ) return CDSM_GetSystemUpdateID ;
143  if (sURI == "X_GetFeatureList" || // HACK: Samsung
144  sURI == "GetFeatureList" ) return CDSM_GetFeatureList ;
145  if (sURI == "GetServiceResetToken" ) return CDSM_GetServiceResetToken ;
146 
147  return( CDSM_Unknown );
148 }
149 
151 //
153 
155 {
156  if (sFlag == "BrowseMetadata" ) return( CDS_BrowseMetadata );
157  if (sFlag == "BrowseDirectChildren" ) return( CDS_BrowseDirectChildren );
158 
159  return( CDS_BrowseUnknown );
160 }
161 
163 //
165 
167 {
168  if (pExtension)
169  {
170  m_extensions.append( pExtension );
171 
172  CDSShortCutList shortcuts = pExtension->GetShortCuts();
173  CDSShortCutList::iterator it;
174  for (it = shortcuts.begin(); it != shortcuts.end(); ++it)
175  {
176  RegisterShortCut(it.key(), it.value());
177  }
178  }
179 }
180 
182 //
184 
186 {
187  if (pExtension)
188  {
189  m_extensions.removeAll(pExtension);
190  delete pExtension;
191  }
192 }
193 
195 //
197 
199  const QString& objectID)
200 {
201  m_pShortCuts->AddShortCut(type, objectID);
202 }
203 
205 //
207 
209 {
210  m_features.AddFeature(feature); // m_features takes ownership
211 }
212 
214 //
216 
218 {
220 }
221 
223 //
225 
227 {
228  if (pRequest)
229  {
230  if (Eventing::ProcessRequest( pRequest ))
231  return true;
232 
233  if ( pRequest->m_sBaseUrl != m_sControlUrl )
234  {
235 #if 0
236  LOG(VB_UPNP, LOG_DEBUG,
237  QString("UPnpCDS::ProcessRequest - BaseUrl (%1) not ours...")
238  .arg(pRequest->m_sBaseUrl));
239 #endif
240  return false;
241  }
242 
243  switch( GetMethod( pRequest->m_sMethod ) )
244  {
247  break;
248  case CDSM_Browse :
249  HandleBrowse( pRequest );
250  break;
251  case CDSM_Search :
252  HandleSearch( pRequest );
253  break;
255  HandleGetSearchCapabilities( pRequest );
256  break;
258  HandleGetSortCapabilities( pRequest );
259  break;
261  HandleGetSystemUpdateID( pRequest );
262  break;
263  case CDSM_GetFeatureList :
264  HandleGetFeatureList( pRequest );
265  break;
267  HandleGetServiceResetToken( pRequest );
268  break;
269  default:
271  break;
272  }
273 
274  return true;
275  }
276 
277  return false;
278 }
279 
281  // Windows Media Player version 12
282  { CDS_ClientWMP,
283  "User-Agent",
284  "Windows-Media-Player/" },
285  // Windows Media Player version < 12
286  { CDS_ClientWMP,
287  "User-Agent",
288  "Mozilla/4.0 (compatible; UPnP/1.0; Windows 9x" },
289  // XBMC
290  { CDS_ClientXBMC,
291  "User-Agent",
292  "Platinum/" },
293  // XBox 360
294  { CDS_ClientXBox,
295  "User-Agent",
296  "Xbox" },
297  // Sony Blu-ray players
299  "X-AV-Client-Info",
300  R"(cn="Sony Corporation"; mn="Blu-ray Disc Player")" },
301 };
303  sizeof(clientExceptions[0]);
304 
306  UPnpCDSRequest *pCDSRequest )
307 {
308  pCDSRequest->m_eClient = CDS_ClientDefault;
309  pCDSRequest->m_nClientVersion = 0;
310  bool found = false;
311 
312  // Do we know this client string?
313  for ( uint i = 0; !found && i < clientExceptionCount; i++ )
314  {
316 
317  QString sHeaderValue = pRequest->GetRequestHeader(except->sHeaderKey, "");
318  int idx = sHeaderValue.indexOf(except->sHeaderValue);
319  if (idx != -1)
320  {
321  pCDSRequest->m_eClient = except->nClientType;
322 
323  idx += except->sHeaderValue.length();
324 
325  // If we have a / at the end of the string then we
326  // increment the string to skip over it
327  if ( sHeaderValue[idx] == '/')
328  {
329  idx++;
330  }
331 
332  // Now find the version number
333  QString version = sHeaderValue.mid(idx).trimmed();
334  idx = version.indexOf( '.' );
335  if (idx != -1)
336  {
337  idx = version.indexOf( '.', idx + 1 );
338  }
339  if (idx != -1)
340  {
341  version = version.left( idx );
342  }
343  idx = version.indexOf( ' ' );
344  if (idx != -1)
345  {
346  version = version.left( idx );
347  }
348 
349  pCDSRequest->m_nClientVersion = version.toDouble();
350 
351  LOG(VB_UPNP, LOG_INFO,
352  QString("DetermineClient %1:%2 Identified as %3 version %4")
353  .arg(except->sHeaderKey) .arg(sHeaderValue)
354  .arg(pCDSRequest->m_eClient)
355  .arg(pCDSRequest->m_nClientVersion));
356  found = true;
357  }
358  }
359 }
360 
361 
363 //
365 
367 {
368  UPnpCDSExtensionResults *pResult = nullptr;
369  UPnpCDSRequest request;
370 
371  DetermineClient( pRequest, &request );
372  request.m_sObjectId = pRequest->m_mapParams[ "objectid" ];
373  request.m_sParentId = "0";
374  request.m_eBrowseFlag =
375  GetBrowseFlag( pRequest->m_mapParams[ "browseflag" ] );
376  request.m_sFilter = pRequest->m_mapParams[ "filter" ];
377  request.m_nStartingIndex = Max(pRequest->m_mapParams[ "startingindex" ].toUShort(),
378  uint16_t(0));
379  request.m_nRequestedCount =
380  pRequest->m_mapParams[ "requestedcount"].toUShort();
381  if (request.m_nRequestedCount == 0)
382  request.m_nRequestedCount = UINT16_MAX;
383  request.m_sSortCriteria = pRequest->m_mapParams[ "sortcriteria" ];
384 
385 
386  LOG(VB_UPNP, LOG_DEBUG, QString("UPnpCDS::ProcessRequest \n"
387  ": url = %1 \n"
388  ": Method = %2 \n"
389  ": ObjectId = %3 \n"
390  ": BrowseFlag = %4 \n"
391  ": Filter = %5 \n"
392  ": StartingIndex = %6 \n"
393  ": RequestedCount = %7 \n"
394  ": SortCriteria = %8 " )
395  .arg( pRequest->m_sBaseUrl )
396  .arg( pRequest->m_sMethod )
397  .arg( request.m_sObjectId )
398  .arg( request.m_eBrowseFlag )
399  .arg( request.m_sFilter )
400  .arg( request.m_nStartingIndex )
401  .arg( request.m_nRequestedCount)
402  .arg( request.m_sSortCriteria ));
403 
405  QString sErrorDesc = "";
406  uint16_t nNumberReturned = 0;
407  uint16_t nTotalMatches = 0;
408  uint16_t nUpdateID = 0;
409  QString sResultXML;
410  FilterMap filter = request.m_sFilter.split(',');
411 
412  LOG(VB_UPNP, LOG_INFO,
413  QString("UPnpCDS::HandleBrowse ObjectID=%1")
414  .arg(request.m_sObjectId));
415 
416  if (request.m_sObjectId == "0")
417  {
418  // ------------------------------------------------------------------
419  // This is for the root object... lets handle it.
420  // ------------------------------------------------------------------
421 
422  switch( request.m_eBrowseFlag )
423  {
424  case CDS_BrowseMetadata:
425  {
426  // -----------------------------------------------------------
427  // Return Root Object Only
428  // -----------------------------------------------------------
429 
430  eErrorCode = UPnPResult_Success;
431  nNumberReturned = 1;
432  nTotalMatches = 1;
433  nUpdateID = m_root.m_nUpdateId;
434 
435  m_root.SetChildCount( m_extensions.count() );
437 
438  sResultXML = m_root.toXml(filter);
439 
440  break;
441  }
442 
444  {
445  // Loop Through each extension and Build the Root Folders
446 
447  eErrorCode = UPnPResult_Success;
448  nTotalMatches = m_extensions.count();
449  nUpdateID = m_root.m_nUpdateId;
450 
451  if (request.m_nRequestedCount == 0)
452  request.m_nRequestedCount = nTotalMatches;
453 
454  uint16_t nStart = Max( request.m_nStartingIndex, uint16_t( 0 ));
455  uint16_t nCount = Min( nTotalMatches, request.m_nRequestedCount );
456 
457  DetermineClient( pRequest, &request );
458 
459  for (uint i = nStart;
460  (i < (uint)m_extensions.size()) &&
461  (nNumberReturned < nCount);
462  i++)
463  {
464  UPnpCDSExtension *pExtension = m_extensions[i];
465  CDSObject* pExtensionRoot = pExtension->GetRoot();
466  sResultXML += pExtensionRoot->toXml(filter, true); // Ignore Children
467  nNumberReturned ++;
468  }
469 
470  break;
471  }
472  default: break;
473  }
474  }
475  else
476  {
477  // ------------------------------------------------------------------
478  // Look for a CDS Extension that knows how to handle this ObjectID
479  // ------------------------------------------------------------------
480 
481  UPnpCDSExtensionList::iterator it = m_extensions.begin();
482  for (; (it != m_extensions.end()) && !pResult; ++it)
483  {
484  LOG(VB_UPNP, LOG_INFO,
485  QString("UPNP Browse : Searching for : %1 / ObjectID : %2")
486  .arg((*it)->m_sExtensionId).arg(request.m_sObjectId));
487 
488  pResult = (*it)->Browse(&request);
489  }
490 
491  if (pResult != nullptr)
492  {
493  eErrorCode = pResult->m_eErrorCode;
494  sErrorDesc = pResult->m_sErrorDesc;
495 
496  if (eErrorCode == UPnPResult_Success)
497  {
498  nNumberReturned = pResult->m_List.count();
499  nTotalMatches = pResult->m_nTotalMatches;
500  nUpdateID = pResult->m_nUpdateID;
501  if (request.m_eBrowseFlag == CDS_BrowseMetadata)
502  sResultXML = pResult->GetResultXML(filter, true); // Ignore children
503  else
504  sResultXML = pResult->GetResultXML(filter);
505  }
506 
507  delete pResult;
508  pResult = nullptr;
509  }
510  }
511 
512  // ----------------------------------------------------------------------
513  // Output Results of Browse Method
514  // ----------------------------------------------------------------------
515 
516  if (eErrorCode == UPnPResult_Success)
517  {
518  NameValues list;
519 
520  QString sResults = DIDL_LITE_BEGIN;
521  sResults += sResultXML;
522  sResults += DIDL_LITE_END;
523 
524  list.push_back(NameValue("Result", sResults));
525  list.push_back(NameValue("NumberReturned", nNumberReturned));
526  list.push_back(NameValue("TotalMatches", nTotalMatches));
527  list.push_back(NameValue("UpdateID", nUpdateID));
528 
529  pRequest->FormatActionResponse(list);
530  }
531  else
532  UPnp::FormatErrorResponse ( pRequest, eErrorCode, sErrorDesc );
533 
534 }
535 
537 //
539 
541 {
542  UPnpCDSExtensionResults *pResult = nullptr;
543  UPnpCDSRequest request;
544 
546  QString sErrorDesc = "";
547  uint16_t nNumberReturned = 0;
548  uint16_t nTotalMatches = 0;
549  uint16_t nUpdateID = 0;
550  QString sResultXML;
551 
552  DetermineClient( pRequest, &request );
553  request.m_sObjectId = pRequest->m_mapParams[ "objectid" ];
554  request.m_sContainerID = pRequest->m_mapParams[ "containerid" ];
555  request.m_sFilter = pRequest->m_mapParams[ "filter" ];
556  request.m_nStartingIndex =
557  pRequest->m_mapParams[ "startingindex" ].toLong();
558  request.m_nRequestedCount =
559  pRequest->m_mapParams[ "requestedcount"].toLong();
560  request.m_sSortCriteria = pRequest->m_mapParams[ "sortcriteria" ];
561  request.m_sSearchCriteria = pRequest->m_mapParams[ "searchcriteria"];
562 
563  LOG(VB_UPNP, LOG_INFO,
564  QString("UPnpCDS::HandleSearch ObjectID=%1, ContainerId=%2")
565  .arg(request.m_sObjectId) .arg(request.m_sContainerID));
566 
567  // ----------------------------------------------------------------------
568  // Break the SearchCriteria into it's parts
569  // -=>TODO: This DOES NOT handle ('s or other complex expressions
570  // ----------------------------------------------------------------------
571 
572  QRegularExpression re {"\\b(or|and)\\b", QRegularExpression::CaseInsensitiveOption};
573 
574 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
575  request.m_sSearchList = request.m_sSearchCriteria.split(
576  re, QString::SkipEmptyParts);
577 #else
578  request.m_sSearchList = request.m_sSearchCriteria.split(
579  re, Qt::SkipEmptyParts);
580 #endif
581  request.m_sSearchClass = "object"; // Default to all objects.
582 
583  // ----------------------------------------------------------------------
584  // -=>TODO: Need to process all expressions in searchCriteria... for now,
585  // Just focus on the "upnp:class derivedfrom" expression
586  // ----------------------------------------------------------------------
587 
588  for ( QStringList::Iterator it = request.m_sSearchList.begin();
589  it != request.m_sSearchList.end();
590  ++it )
591  {
592  if ((*it).contains("upnp:class derivedfrom", Qt::CaseInsensitive))
593  {
594 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
595  QStringList sParts = (*it).split(' ', QString::SkipEmptyParts);
596 #else
597  QStringList sParts = (*it).split(' ', Qt::SkipEmptyParts);
598 #endif
599 
600  if (sParts.count() > 2)
601  {
602  request.m_sSearchClass = sParts[2].trimmed();
603  request.m_sSearchClass.remove( '"' );
604 
605  break;
606  }
607  }
608  }
609 
610  // ----------------------------------------------------------------------
611 
612 
613  LOG(VB_UPNP, LOG_INFO, QString("UPnpCDS::ProcessRequest \n"
614  ": url = %1 \n"
615  ": Method = %2 \n"
616  ": ObjectId = %3 \n"
617  ": SearchCriteria = %4 \n"
618  ": Filter = %5 \n"
619  ": StartingIndex = %6 \n"
620  ": RequestedCount = %7 \n"
621  ": SortCriteria = %8 \n"
622  ": SearchClass = %9" )
623  .arg( pRequest->m_sBaseUrl )
624  .arg( pRequest->m_sMethod )
625  .arg( request.m_sObjectId )
626  .arg( request.m_sSearchCriteria)
627  .arg( request.m_sFilter )
628  .arg( request.m_nStartingIndex )
629  .arg( request.m_nRequestedCount)
630  .arg( request.m_sSortCriteria )
631  .arg( request.m_sSearchClass ));
632 
633 #if 0
634  bool bSearchDone = false;
635 #endif
636 
637  UPnpCDSExtensionList::iterator it = m_extensions.begin();
638  for (; (it != m_extensions.end()) && !pResult; ++it)
639  pResult = (*it)->Search(&request);
640 
641  if (pResult != nullptr)
642  {
643  eErrorCode = pResult->m_eErrorCode;
644  sErrorDesc = pResult->m_sErrorDesc;
645 
646  if (eErrorCode == UPnPResult_Success)
647  {
648  FilterMap filter = request.m_sFilter.split(',');
649  nNumberReturned = pResult->m_List.count();
650  nTotalMatches = pResult->m_nTotalMatches;
651  nUpdateID = pResult->m_nUpdateID;
652  sResultXML = pResult->GetResultXML(filter);
653 #if 0
654  bSearchDone = true;
655 #endif
656  }
657 
658  delete pResult;
659  pResult = nullptr;
660  }
661 
662 #if 0
663  nUpdateID = 0;
664  LOG(VB_UPNP, LOG_DEBUG, sResultXML);
665 #endif
666 
667  if (eErrorCode == UPnPResult_Success)
668  {
669  NameValues list;
670  QString sResults = DIDL_LITE_BEGIN;
671  sResults += sResultXML;
672  sResults += DIDL_LITE_END;
673 
674  list.push_back(NameValue("Result", sResults));
675  list.push_back(NameValue("NumberReturned", nNumberReturned));
676  list.push_back(NameValue("TotalMatches", nTotalMatches));
677  list.push_back(NameValue("UpdateID", nUpdateID));
678 
679  pRequest->FormatActionResponse(list);
680  }
681  else
682  UPnp::FormatErrorResponse( pRequest, eErrorCode, sErrorDesc );
683 }
684 
692 {
693  NameValues list;
694 
695  LOG(VB_UPNP, LOG_INFO,
696  QString("UPnpCDS::ProcessRequest : %1 : %2")
697  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
698 
699  // -=>TODO: Need to implement based on CDS Extension Capabilities
700 
701 // list.push_back(
702 // NameValue("SearchCaps",
703 // "dc:title,dc:creator,dc:date,upnp:class,res@size,"
704 // "res@protocolInfo","@refID"));
705  list.push_back(
706  NameValue("SearchCaps","")); // We don't support any searching
707 
708  pRequest->FormatActionResponse(list);
709 }
710 
718 {
719  NameValues list;
720 
721  LOG(VB_UPNP, LOG_INFO,
722  QString("UPnpCDS::ProcessRequest : %1 : %2")
723  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
724 
725  // -=>TODO: Need to implement based on CDS Extension Capabilities
726 
727 // list.push_back(
728 // NameValue("SortCaps",
729 // "dc:title,dc:creator,dc:date,upnp:class,res@size,"
730 // "res@protocolInfo,@refID"));
731  list.push_back(
732  NameValue("SortCaps","")); // We don't support any sorting
733 
734  pRequest->FormatActionResponse(list);
735 }
736 
738 //
740 
742 {
743  NameValues list;
744 
745  LOG(VB_UPNP, LOG_INFO,
746  QString("UPnpCDS::ProcessRequest : %1 : %2")
747  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
748 
749  auto nId = GetValue<uint16_t>("SystemUpdateID");
750 
751  list.push_back(NameValue("Id", nId));
752 
753  pRequest->FormatActionResponse(list);
754 }
755 
757 //
759 
761 {
762  NameValues list;
763  LOG(VB_UPNP, LOG_INFO,
764  QString("UPnpCDS::ProcessRequest : %1 : %2")
765  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
766 
767  QString sResults = m_features.toXML();
768 
769  list.push_back(NameValue("FeatureList", sResults));
770 
771  pRequest->FormatActionResponse(list);
772 }
773 
775 {
776  NameValues list;
777 
778  LOG(VB_UPNP, LOG_INFO,
779  QString("UPnpCDS::ProcessRequest : %1 : %2")
780  .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod));
781 
782  auto sToken = GetValue<QString>("ServiceResetToken");
783 
784  list.push_back(NameValue("ResetToken", sToken));
785 
786  pRequest->FormatActionResponse(list);
787 }
788 
791 //
792 // UPnpCDSExtension Implementation
793 //
796 
798 {
799  if (m_pRoot)
800  {
801  m_pRoot->DecrRef();
802  m_pRoot = nullptr;
803  }
804 }
805 
807 //
809 
811 {
812  if (!pRequest->m_sObjectId.startsWith(m_sExtensionId, Qt::CaseSensitive))
813  return false;
814 
815  LOG(VB_UPNP, LOG_INFO, QString("%1: Browse request is for us.").arg(m_sExtensionId));
816 
817  return true;
818 }
819 
821 //
823 
825 {
826  // -=>TODO: Need to add Filter & Sorting Support.
827 
828  if (!IsBrowseRequestForUs( pRequest ))
829  return( nullptr );
830 
831  // ----------------------------------------------------------------------
832  // Split the request ID into token key/value
833  //
834  // Music/Artist=123/Album=15
835  // Music/Genre=32/Artist=616/Album=13/Track=2632
836  // ----------------------------------------------------------------------
837  IDTokenMap tokens = TokenizeIDString(pRequest->m_sObjectId);
838  QString currentToken = GetCurrentToken(pRequest->m_sObjectId).first;
839 
840  LOG(VB_UPNP, LOG_DEBUG, QString("Browse (%1): Current Token '%2'")
841  .arg(m_sExtensionId).arg(currentToken));
842 
843  // ----------------------------------------------------------------------
844  // Process based on location in hierarchy
845  // ----------------------------------------------------------------------
846 
847  auto *pResults = new UPnpCDSExtensionResults();
848 
849  if (pResults != nullptr)
850  {
851  switch( pRequest->m_eBrowseFlag )
852  {
853  case CDS_BrowseMetadata:
854  {
855  if (pRequest->m_nRequestedCount == 0)
856  pRequest->m_nRequestedCount = 1; // This should be the case anyway, but enforce it just in case
857 
858  pRequest->m_sParentId = "0"; // Root
859 
860  // Create parent ID by stripping the last token from the object ID
861  if (pRequest->m_sObjectId.contains("/"))
862  pRequest->m_sParentId = pRequest->m_sObjectId.section("/", 0, -2);
863 
864  LOG(VB_UPNP, LOG_DEBUG, QString("UPnpCDS::Browse: BrowseMetadata (%1)").arg(pRequest->m_sObjectId));
865  if (LoadMetadata(pRequest, pResults, tokens, currentToken))
866  return pResults;
867  pResults->m_eErrorCode = UPnPResult_CDS_NoSuchObject;
868  break;
869  }
870 
872  {
873  pRequest->m_sParentId = pRequest->m_sObjectId;
874  LOG(VB_UPNP, LOG_DEBUG, QString("UPnpCDS::Browse: BrowseDirectChildren (%1)").arg(pRequest->m_sObjectId));
875  if (LoadChildren(pRequest, pResults, tokens, currentToken))
876  return pResults;
877  pResults->m_eErrorCode = UPnPResult_CDS_NoSuchObject;
878  break;
879  }
880 
881  default:
882  {
883  pResults->m_eErrorCode = UPnPResult_CDS_NoSuchObject;
884  pResults->m_sErrorDesc = "";
885  }
886  }
887 
888  }
889 
890  return( pResults );
891 }
892 
894 //
896 
898 {
899  return m_sClass.startsWith( pRequest->m_sSearchClass );
900 }
901 
903 //
905 
907 {
908  // -=>TODO: Need to add Filter & Sorting Support.
909  // -=>TODO: Need to add Sub-Folder/Category Support!!!!!
910 
911  QStringList sEmptyList;
912  LOG(VB_UPNP, LOG_INFO,
913  QString("UPnpCDSExtension::Search : m_sClass = %1 : "
914  "m_sSearchClass = %2")
915  .arg(m_sClass).arg(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).arg(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  .arg(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 IDToken(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).arg(value);
1080  return QString("%1/%2=%3").arg(requestId).arg(name).arg(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:163
UPnpCDSExtensionResults::GetResultXML
QString GetResultXML(FilterMap &filter, bool ignoreChildren=false)
Definition: upnpcds.cpp:57
UPnpCDS::m_sControlUrl
QString m_sControlUrl
Definition: upnpcds.h:291
UPnpCDS::m_root
CDSObject m_root
Definition: upnpcds.h:288
NameValue
Definition: upnputil.h:52
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:217
UPnpCDSExtension::CreateRoot
virtual void CreateRoot()
Definition: upnpcds.cpp:1083
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:797
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:129
UPnpCDS::HandleGetSortCapabilities
static void HandleGetSortCapabilities(HTTPRequest *pRequest)
Return the list of supported sorting fields.
Definition: upnpcds.cpp:717
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:540
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:741
UPnpCDSBrowseFlag
UPnpCDSBrowseFlag
Definition: upnpcds.h:46
UPnpCDSClientException::sHeaderKey
QString sHeaderKey
Definition: upnpcds.h:65
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:1058
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:897
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:141
UPnpCDS::~UPnpCDS
~UPnpCDS() override
Definition: upnpcds.cpp:123
upnpcds.h
HTTPRequest::GetRequestHeader
QString GetRequestHeader(const QString &sKey, QString sDefault)
Definition: httprequest.cpp:1158
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: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:1788
DIDL_LITE_END
#define DIDL_LITE_END
Definition: upnpcds.cpp:25
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:824
UPnpCDSRequest::m_sContainerID
QString m_sContainerID
Definition: upnpcds.h:77
UPnpCDSClientException::sHeaderValue
QString sHeaderValue
Definition: upnpcds.h:66
NameValues
Definition: upnputil.h:88
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:753
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:72
FilterMap
QMap< uint, int > FilterMap
Definition: ExternalSignalMonitor.h:13
upnp.h
UPnpCDS::DetermineClient
static void DetermineClient(HTTPRequest *pRequest, UPnpCDSRequest *pCDSRequest)
Definition: upnpcds.cpp:305
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
clientExceptionCount
static uint clientExceptionCount
Definition: upnpcds.cpp:302
UPnpCDSRequest::m_sSearchCriteria
QString m_sSearchCriteria
Definition: upnpcds.h:90
UPnpCDSExtension::m_sClass
QString m_sClass
Definition: upnpcds.h:208
UPnPShortcutFeature::MUSIC
@ MUSIC
Definition: upnpcds.h:151
UPnpCDS::HandleGetServiceResetToken
void HandleGetServiceResetToken(HTTPRequest *pRequest)
Definition: upnpcds.cpp:774
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:185
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:906
UPnpCDSExtensionResults::Add
void Add(CDSObject *pObject)
Definition: upnpcds.cpp:31
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:208
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
clientExceptions
static UPnpCDSClientException clientExceptions[]
Definition: upnpcds.cpp:280
CDSObjects
QList< CDSObject * > CDSObjects
Definition: upnpcdsobjects.h:96
UPnPShortcutFeature::AddShortCut
bool AddShortCut(ShortCutType type, const QString &objectID)
Definition: upnpcds.cpp:1125
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:366
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:226
DIDL_LITE_BEGIN
#define DIDL_LITE_BEGIN
Definition: upnpcds.cpp:24
uint
unsigned int uint
Definition: compat.h:140
UPnpCDS::GetBrowseFlag
static UPnpCDSBrowseFlag GetBrowseFlag(const QString &sFlag)
Definition: upnpcds.cpp:154
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:968
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:990
UPnpCDS::GetMethod
static UPnpCDSMethod GetMethod(const QString &sURI)
Definition: upnpcds.cpp:135
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:1091
Min
const T & Min(const T &x, const T &y)
Definition: upnputil.h:30
HTTPRequest::FormatFileResponse
void FormatFileResponse(const QString &sFileName)
Definition: httprequest.cpp:841
UPnpCDSClientException::nClientType
UPnpCDSClient nClientType
Definition: upnpcds.h:64
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:937
UPnPResult_CDS_NoSuchObject
@ UPnPResult_CDS_NoSuchObject
Definition: upnp.h:57
UPnpCDSClientException
Definition: upnpcds.h:63
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:691
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:1
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:1103
UPnpCDS::RegisterExtension
void RegisterExtension(UPnpCDSExtension *pExtension)
Definition: upnpcds.cpp:166
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: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: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:760
UPnpCDS::RegisterShortCut
void RegisterShortCut(UPnPShortcutFeature::ShortCutType type, const QString &objectID)
Definition: upnpcds.cpp:198
UPnpCDSExtension::IsBrowseRequestForUs
virtual bool IsBrowseRequestForUs(UPnpCDSRequest *pRequest)
Definition: upnpcds.cpp:810
UPnpCDSRequest::m_sSearchClass
QString m_sSearchClass
Definition: upnpcds.h:92
CDSM_GetFeatureList
@ CDSM_GetFeatureList
Definition: upnpcds.h:41