Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. #include <iostream>
  2. #include "lib_playlist.h"
  3.  
  4. #include <string>
  5. #include <regex>
  6.  
  7. int main() {
  8. Player player;
  9.  
  10. auto mishmash = player.createPlaylist("mishmash");
  11. auto armstrong = player.createPlaylist("armstrong");
  12. auto armstrong2 = player.createPlaylist("armstrong");
  13. auto armstrong3 = player.createPlaylist("armstrong");
  14. auto whatAWonderfulWorld = player.openFile(File("audio|artist:Louis Armstrong|title:What a Wonderful World|"
  15. "I see trees of green, red roses too..."));
  16. auto helloDolly = player.openFile(File("audio|artist:Louis Armstrong|title:Hello, Dolly!|"
  17. "Hello, Dolly! This is Louis, Dolly"));
  18. armstrong->add(whatAWonderfulWorld);
  19. armstrong->add(helloDolly);
  20. auto direstraits = player.openFile(File("audio|artist:Dire Straits|title:Money for Nothing|"
  21. "Now look at them yo-yo's that's the way you do it..."));
  22. auto cabaret = player.openFile(File("video|title:Cabaret|year:1972|Qvfcynlvat Pnonerg"));
  23.  
  24. armstrong->add(armstrong2);
  25. mishmash->add(armstrong2);
  26. mishmash->add(cabaret);
  27. mishmash->add(armstrong);
  28. mishmash->add(direstraits, 1);
  29. mishmash->add(direstraits);
  30. armstrong2->add(armstrong3);
  31. std::cout << "=== Playing 'mishmash' (default sequence mode)" << std::endl;
  32. mishmash->play();
  33.  
  34. std::cout << "=== Playing 'mishmash' (shuffle mode, seed 0 for std::default_random_engine)" << std::endl;
  35. mishmash->setMode(createShuffleMode(0));
  36. mishmash->play();
  37.  
  38. std::cout << "=== Playing 'mishmash' (removed cabaret and last direstraits, odd-even mode)" << std::endl;
  39. mishmash->remove(0);
  40. mishmash->remove();
  41. mishmash->setMode(createOddEvenMode());
  42. mishmash->play();
  43.  
  44. std::cout << "=== Playing 'mishmash' (sequence mode, 'armstrong' odd-even mode)" << std::endl;
  45. armstrong->setMode(createOddEvenMode());
  46. mishmash->setMode(createSequenceMode());
  47. mishmash->play();
  48.  
  49. try {
  50. auto unsupported = player.openFile(File("mp3|artist:Unsupported|title:Unsupported|Content"));
  51. } catch (PlayerException const& e) {
  52. std::cout << e.what() << std::endl;
  53. }
  54.  
  55. try {
  56. auto corrupted = player.openFile(File("Corrupt"));
  57. } catch (PlayerException const& e) {
  58. std::cout << e.what() << std::endl;
  59. }
  60.  
  61. try {
  62. auto corrupted = player.openFile(File("audio|artist:Louis Armstrong|title:Hello, Dolly!|%#!@*&"));
  63. } catch (PlayerException const& e) {
  64. std::cout << e.what() << std::endl;
  65. }
  66.  
  67. try {
  68. armstrong3->add(mishmash);
  69. } catch (PlayerException const& e) {
  70. std::cout << e.what() << std::endl;
  71. }
  72.  
  73. return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement