api_importer.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <bfc/dispatch.h>
  3. #include <api/service/services.h>
  4. // {A32C39BC-CDF7-4c9b-9EA2-9DF7E0D651D2}
  5. static const GUID iTunesImporterGUID =
  6. { 0xa32c39bc, 0xcdf7, 0x4c9b, { 0x9e, 0xa2, 0x9d, 0xf7, 0xe0, 0xd6, 0x51, 0xd2 } };
  7. class api_itunes_importer : public Dispatchable
  8. {
  9. protected:
  10. api_itunes_importer() {}
  11. ~api_itunes_importer() {}
  12. public:
  13. static FOURCC getServiceType() { return WaSvc::UNIQUE; }
  14. static const char *getServiceName() { return "iTunes Importer Service"; }
  15. static GUID getServiceGuid() { return iTunesImporterGUID; }
  16. bool iTunesExists();
  17. int ImportFromFile(HWND parent, const wchar_t *library_file);
  18. int ImportFromiTunes(HWND parent);
  19. int ImportPlaylistsFromiTunes(HWND parent);
  20. enum
  21. {
  22. API_ITUNES_IMPORTER_ITUNESEXISTS = 0,
  23. API_ITUNES_IMPORTER_IMPORTFROMFILE = 1,
  24. API_ITUNES_IMPORTER_IMPORTFROMITUNES = 2,
  25. API_ITUNES_IMPORTER_IMPORTPLAYLISTSFROMITUNES = 3,
  26. };
  27. };
  28. inline bool api_itunes_importer::iTunesExists()
  29. {
  30. return _call(API_ITUNES_IMPORTER_ITUNESEXISTS, (bool)false);
  31. }
  32. inline int api_itunes_importer::ImportFromFile(HWND parent, const wchar_t *library_file)
  33. {
  34. return _call(API_ITUNES_IMPORTER_IMPORTFROMFILE, (int)DISPATCH_FAILURE, parent, library_file);
  35. }
  36. inline int api_itunes_importer::ImportFromiTunes(HWND parent)
  37. {
  38. return _call(API_ITUNES_IMPORTER_IMPORTFROMITUNES, (int)DISPATCH_FAILURE, parent);
  39. }
  40. inline int api_itunes_importer::ImportPlaylistsFromiTunes(HWND parent)
  41. {
  42. return _call(API_ITUNES_IMPORTER_IMPORTPLAYLISTSFROMITUNES, (int)DISPATCH_FAILURE, parent);
  43. }