1
0

AlbumID.cpp 881 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "playlist.h"
  2. #include "main.h"
  3. #include "api__ml_plg.h"
  4. #include "../../General/gen_ml/ml.h"
  5. #include <atlbase.h>
  6. #include "IDScanner.h"
  7. IConnectionPoint *GetConnectionPoint(IUnknown *punk, REFIID riid)
  8. {
  9. if (!punk)
  10. return 0;
  11. IConnectionPointContainer *pcpc;
  12. IConnectionPoint *pcp = 0;
  13. HRESULT hr = punk->QueryInterface(IID_IConnectionPointContainer, (void **) & pcpc);
  14. if (SUCCEEDED(hr))
  15. {
  16. pcpc->FindConnectionPoint(riid, &pcp);
  17. pcpc->Release();
  18. }
  19. return pcp;
  20. }
  21. bool IDScanner::SetupMusicID()
  22. {
  23. if (!SetupPlaylistSDK())
  24. return false;
  25. if (musicID)
  26. return true;
  27. musicID = AGAVE_API_GRACENOTE->GetMusicID();
  28. if (musicID)
  29. {
  30. IConnectionPoint *icp = GetConnectionPoint(musicID, DIID__ICDDBMusicIDManagerEvents);
  31. if (icp)
  32. {
  33. icp->Advise(static_cast<IDispatch *>(this), &m_dwCookie);
  34. icp->Release();
  35. }
  36. return true;
  37. }
  38. return false;
  39. }