usbplaylist.cpp 873 B

123456789101112131415161718192021222324252627282930313233
  1. #include "./usbdevice.h"
  2. #include "./USBPlaylist.h"
  3. #include <shlwapi.h>
  4. #include <strsafe.h>
  5. // dtor
  6. // cleanup the memory allocated for the vector of songs
  7. USBPlaylist::~USBPlaylist()
  8. {
  9. }
  10. // this is the constructor that gets called
  11. USBPlaylist::USBPlaylist(USBDevice& d, LPCTSTR fileName, BOOL m)
  12. : device(d), master(m), dirty(false)
  13. {
  14. StringCbCopyW(filename, sizeof(filename), fileName);
  15. StringCbCopyW(playlistName, sizeof(playlistName), PathFindFileName(fileName));
  16. StringCbCopyW(playlistPath, sizeof(playlistName), fileName);
  17. PathRemoveFileSpec(playlistPath);
  18. }
  19. int USBPlaylist::OnFile(const wchar_t *filename, const wchar_t *title, int lengthInMS, ifc_plentryinfo *info)
  20. {
  21. if (NULL != filename)
  22. {
  23. UsbSong* song = NULL;
  24. song = device.findSongInMasterPlaylist(filename);
  25. songs.push_back(song);
  26. }
  27. return ifc_playlistloadercallback::LOAD_CONTINUE;
  28. }