ElementFactoryTest.php 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <?php
  2. namespace Muzich\CoreBundle\Tests\Searcher;
  3. use Muzich\CoreBundle\lib\UnitTest;
  4. use Muzich\CoreBundle\Entity\Element;
  5. use Muzich\CoreBundle\Managers\ElementManager;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. class ElementFactoryTest extends UnitTest
  8. {
  9. /**
  10. * Test du fonctionnement du l'usine
  11. * C'est plus un test fusible car il ne test que la méthode proceedFill.
  12. *
  13. */
  14. public function testEngine()
  15. {
  16. $r = $this->getDoctrine();
  17. $bux = $r->getRepository('MuzichCoreBundle:User')
  18. ->findOneByUsername('bux')
  19. ;
  20. $hardtek = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek');
  21. $tribe = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe');
  22. $youtube_width = '590';
  23. $youtube_height = '300';
  24. $element = new Element();
  25. $element->setName('Mon bel element');
  26. $element->setTags(json_encode(array($hardtek->getId(), $tribe->getId())));
  27. $element->setUrl('http://www.youtube.com/watch?v=WC8qb_of04E');
  28. $factory = new ElementManager($element, $r->getEntityManager(), $this->_container);
  29. $factory->proceedFill($bux);
  30. $url = 'http://www.youtube.com/embed/WC8qb_of04E';
  31. $this->assertEquals($element->getName(), 'Mon bel element');
  32. $this->assertEquals($element->getUrl(), 'http://www.youtube.com/watch?v=WC8qb_of04E');
  33. $this->assertEquals($element->getTags(), array($hardtek, $tribe));
  34. $this->assertEquals($element->getEmbed(),
  35. '<iframe width="'.$youtube_width.'" height="'.$youtube_height.'" src="'.$url.'" '
  36. .'frameborder="0" allowfullscreen></iframe>'
  37. );
  38. }
  39. /**
  40. * Test des création de code embed
  41. */
  42. public function testEmbedsEngine()
  43. {
  44. $r = $this->getDoctrine();
  45. $bux = $r->getRepository('MuzichCoreBundle:User')
  46. ->findOneByUsername('bux')
  47. ;
  48. $hardtek = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek');
  49. $tribe = $r->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe');
  50. /*
  51. * - youtube.com && youtu.be
  52. */
  53. $this->proceed_elementAndFill(
  54. $bux,
  55. 'dfd4z5d3s45sgf45645',
  56. 'http://www.youtube.com/watch?v=Itfg7UpkcSs&feature=g-vrec&context=G2e61726RVAAAAAAAAAg',
  57. array($hardtek->getId(), $tribe->getId()),
  58. '<iframe width="'.$this->getParam('youtube_player_width').'" '
  59. .'height="'.$this->getParam('youtube_player_height').'" '
  60. .'src="http://www.youtube.com/embed/Itfg7UpkcSs" '
  61. .'frameborder="0" allowfullscreen></iframe>'
  62. );
  63. $this->proceed_elementAndFill(
  64. $bux,
  65. 'dfd4z5d3s45sgf45645',
  66. 'http://www.youtube.com/watch?feature=player_detailpage&v=Itfg7UpkcSs#t=3s',
  67. array($hardtek->getId(), $tribe->getId()),
  68. '<iframe width="'.$this->getParam('youtube_player_width').'" '
  69. .'height="'.$this->getParam('youtube_player_height').'" '
  70. .'src="http://www.youtube.com/embed/Itfg7UpkcSs" '
  71. .'frameborder="0" allowfullscreen></iframe>'
  72. );
  73. $this->proceed_elementAndFill(
  74. $bux,
  75. 'dfd4z5d3s45sgf45645',
  76. 'http://youtu.be/Itfg7UpkcSs',
  77. array($hardtek->getId(), $tribe->getId()),
  78. '<iframe width="'.$this->getParam('youtube_player_width').'" '
  79. .'height="'.$this->getParam('youtube_player_height').'" '
  80. .'src="http://www.youtube.com/embed/Itfg7UpkcSs" '
  81. .'frameborder="0" allowfullscreen></iframe>'
  82. );
  83. $this->proceed_elementAndFill(
  84. $bux,
  85. 'dfd4z5d3s45sgf45645',
  86. 'http://www.youtube.com/watch?v=Itfg7UpkcSs',
  87. array($hardtek->getId(), $tribe->getId()),
  88. '<iframe width="'.$this->getParam('youtube_player_width').'" '
  89. .'height="'.$this->getParam('youtube_player_height').'" '
  90. .'src="http://www.youtube.com/embed/Itfg7UpkcSs" '
  91. .'frameborder="0" allowfullscreen></iframe>'
  92. );
  93. /*
  94. * - dailymotion.com
  95. */
  96. $this->proceed_elementAndFill(
  97. $bux,
  98. 'fzgrj79ukl46ye4rgz6a',
  99. 'http://www.dailymotion.com/video/xafj1q_black-bomb-a-tales-from-the-old-sch_music',
  100. array($hardtek->getId(), $tribe->getId()),
  101. '<iframe frameborder="0" width="'.$this->getParam('dailymotion_player_width').'" '
  102. .'height="'.$this->getParam('dailymotion_player_height').'" '
  103. .'src="http://www.dailymotion.com/embed/video/xafj1q?autoPlay=1"></iframe>'
  104. );
  105. /*
  106. * - soundcloud.com
  107. */
  108. $url_id = 'http://soundcloud.com/matas/sets/library-project';
  109. $embed_id = md5($url_id);
  110. $this->proceed_elementAndFill(
  111. $bux,
  112. 'faez7tf8re9h4gf5j64dssz',
  113. 'http://soundcloud.com/matas/sets/library-project',
  114. array($hardtek->getId(), $tribe->getId()),
  115. '<object height="'.$this->getParam('soundcloud_player_height').'" width="100%" id="embed_'.$embed_id.'" '
  116. .'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
  117. <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;'
  118. .'enable_api=true&amp;object_id=embed_'.$embed_id.'"></param>
  119. <param name="allowscriptaccess" value="always"></param>
  120. <embed allowscriptaccess="always" height="'.$this->getParam('soundcloud_player_height').'" '
  121. .'src="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;enable_api=true'
  122. .'&amp;object_id=embed_'.$embed_id.'" type="application/x-shockwave-flash" '
  123. .'width="100%" name="embed_'.$embed_id.'"></embed>
  124. </object>'
  125. );
  126. $url_id = 'http://soundcloud.com/matas/above-hyperion-redux';
  127. $embed_id = md5($url_id);
  128. $this->proceed_elementAndFill(
  129. $bux,
  130. 'faez7tf8re9h4gf5j64dssz',
  131. 'http://soundcloud.com/matas/above-hyperion-redux',
  132. array($hardtek->getId(), $tribe->getId()),
  133. '<object height="'.$this->getParam('soundcloud_player_height').'" width="100%" id="embed_'.$embed_id.'" '
  134. .'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
  135. <param name="movie" value="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;'
  136. .'enable_api=true&amp;object_id=embed_'.$embed_id.'"></param>
  137. <param name="allowscriptaccess" value="always"></param>
  138. <embed allowscriptaccess="always" height="'.$this->getParam('soundcloud_player_height').'" '
  139. .'src="http://player.soundcloud.com/player.swf?url='.$url_id.'&amp;enable_api=true'
  140. .'&amp;object_id=embed_'.$embed_id.'" type="application/x-shockwave-flash" '
  141. .'width="100%" name="embed_'.$embed_id.'"></embed>
  142. </object>'
  143. );
  144. $this->proceed_elementAndFill(
  145. $bux,
  146. 'faez7tf8re9h4gf5j64dssz',
  147. 'http://soundcloud.com/tracks/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D=',
  148. array($hardtek->getId(), $tribe->getId()),
  149. null
  150. );
  151. $this->proceed_elementAndFill(
  152. $bux,
  153. 'faez7tf8re9h4gf5j64dssz',
  154. 'http://soundcloud.com/people/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D=',
  155. array($hardtek->getId(), $tribe->getId()),
  156. null
  157. );
  158. $this->proceed_elementAndFill(
  159. $bux,
  160. 'faez7tf8re9h4gf5j64dssz',
  161. 'http://soundcloud.com/groups/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D=',
  162. array($hardtek->getId(), $tribe->getId()),
  163. null
  164. );
  165. /*
  166. * - jamendo.com
  167. */
  168. $this->proceed_elementAndFill(
  169. $bux,
  170. 'gthyk456+liszz',
  171. 'http://www.jamendo.com/fr/album/30661',
  172. array($hardtek->getId(), $tribe->getId()),
  173. '<object width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
  174. .' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" align="middle">
  175. <param name="allowScriptAccess" value="always" />
  176. <param name="wmode" value="transparent" />
  177. <param name="movie" value="http://widgets.jamendo.com/fr/album/?album_id=30661&playertype=2008" />
  178. <param name="quality" value="high" />
  179. <param name="bgcolor" value="#FFFFFF" />
  180. <embed src="http://widgets.jamendo.com/fr/album/?album_id=30661&playertype=2008" quality="high" wmode="transparent" bgcolor="#FFFFFF"'
  181. .' width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" align="middle" allowScriptAccess="always"'
  182. .' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
  183. &nbsp;
  184. </embed>
  185. &nbsp;
  186. </object>'
  187. );
  188. $this->proceed_elementAndFill(
  189. $bux,
  190. 'gthyk456+liszz',
  191. 'http://www.jamendo.com/fr/track/207079',
  192. array($hardtek->getId(), $tribe->getId()),
  193. '<object width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
  194. .' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" align="middle">
  195. <param name="allowScriptAccess" value="always" />
  196. <param name="wmode" value="transparent" />
  197. <param name="movie" value="http://widgets.jamendo.com/fr/track/?track_id=207079&playertype=2008" />
  198. <param name="quality" value="high" />
  199. <param name="bgcolor" value="#FFFFFF" />
  200. <embed src="http://widgets.jamendo.com/fr/track/?track_id=207079&playertype=2008" quality="high" wmode="transparent" bgcolor="#FFFFFF"'
  201. .' width="'.$this->getParam('jamendo_player_width').'" height="'.$this->getParam('jamendo_player_height').'" align="middle" allowScriptAccess="always"'
  202. .' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
  203. &nbsp;
  204. </embed>
  205. &nbsp;
  206. </object>'
  207. );
  208. $this->proceed_elementAndFill(
  209. $bux,
  210. 'gthyk456+liszz',
  211. 'http://www.jamendo.com/fr/search/all/psytrance',
  212. array($hardtek->getId(), $tribe->getId()),
  213. null
  214. );
  215. $this->proceed_elementAndFill(
  216. $bux,
  217. 'gthyk456+liszz',
  218. 'http://www.jamendo.com/fr/artist/DJ_BETO',
  219. array($hardtek->getId(), $tribe->getId()),
  220. null
  221. );
  222. /*/*
  223. * - deezer.com
  224. */
  225. $this->proceed_elementAndFill(
  226. $bux,
  227. 'a9j4l56dsu8ra5gf647je',
  228. 'http://www.deezer.com/fr/music/pantera/far-beyond-driven-80398',
  229. array($hardtek->getId(), $tribe->getId()),
  230. '<iframe scrolling="no" frameborder="0" allowTransparency="true" '
  231. .'src="http://www.deezer.com/fr/plugins/player?autoplay=true&playlist=true'
  232. .'&width='.$this->getParam('deezer_player_width').'&height='
  233. .$this->getParam('deezer_player_height')
  234. .'&cover=true&type=album&id=80398&title=&app_id=undefined" '
  235. .'width="'.$this->getParam('deezer_player_width').'" height="'
  236. .$this->getParam('deezer_player_height')
  237. .'"></iframe>'
  238. );
  239. $this->proceed_elementAndFill(
  240. $bux,
  241. 'g4th4545ku6kti456e456z',
  242. 'http://www.deezer.com/fr/music/playlist/18701350',
  243. array($hardtek->getId(), $tribe->getId()),
  244. '<iframe scrolling="no" frameborder="0" allowTransparency="true" '
  245. .'src="http://www.deezer.com/fr/plugins/player?autoplay=true&playlist=true'
  246. .'&width='.$this->getParam('deezer_player_width').'&height='
  247. .$this->getParam('deezer_player_height')
  248. .'&cover=true&type=playlist&id=18701350&title=&app_id=undefined" '
  249. .'width="'.$this->getParam('deezer_player_width').'" height="'
  250. .$this->getParam('deezer_player_height')
  251. .'"></iframe>'
  252. );
  253. $this->proceed_elementAndFill(
  254. $bux,
  255. 'poil de carotte',
  256. 'http://www.mixcloud.com/nevrakse_ISM/nevrakse-tranceplantation/',
  257. array($hardtek->getId(), $tribe->getId()),
  258. null,
  259. 'src="//www.mixcloud.com/widget/iframe/?feed=http%3A%2F%2Fwww.mixcloud.com%2Fnevrakse_ISM%2Fnevrakse-tranceplantation'
  260. );
  261. }
  262. public function testDataApiengine()
  263. {
  264. $r = $this->getDoctrine();
  265. $bux = $r->getRepository('MuzichCoreBundle:User')
  266. ->findOneByUsername('bux')
  267. ;
  268. /*
  269. * - youtube.com && youtu.be
  270. */
  271. $this->assertEquals(array(
  272. 'data_ref_id' => 'Itfg7UpkcSs',
  273. 'data_title' => 'DIDIER SUPER SUR FRANCE O : UN PETIT MALENTENDU ?',
  274. 'data_type' => 'other'
  275. ),$this->proceed_element_datas_api(
  276. $bux,
  277. 'http://www.youtube.com/watch?v=Itfg7UpkcSs&feature=g-vrec&context=G2e61726RVAAAAAAAAAg'
  278. ));
  279. $this->assertEquals(array(
  280. 'data_ref_id' => 'Itfg7UpkcSs',
  281. 'data_title' => 'DIDIER SUPER SUR FRANCE O : UN PETIT MALENTENDU ?',
  282. 'data_type' => 'other'
  283. ),$this->proceed_element_datas_api(
  284. $bux,
  285. 'http://www.youtube.com/watch?feature=player_detailpage&v=Itfg7UpkcSs#t=3s'
  286. ));
  287. $this->assertEquals(array(
  288. 'data_ref_id' => 'Itfg7UpkcSs',
  289. 'data_title' => 'DIDIER SUPER SUR FRANCE O : UN PETIT MALENTENDU ?',
  290. 'data_type' => 'other'
  291. ),$this->proceed_element_datas_api(
  292. $bux,
  293. 'http://youtu.be/Itfg7UpkcSs'
  294. ));
  295. $this->assertEquals(array(
  296. 'data_ref_id' => 'Itfg7UpkcSs',
  297. 'data_title' => 'DIDIER SUPER SUR FRANCE O : UN PETIT MALENTENDU ?',
  298. 'data_type' => 'other'
  299. ),$this->proceed_element_datas_api(
  300. $bux,
  301. 'http://www.youtube.com/watch?v=Itfg7UpkcSs'
  302. ));
  303. /*
  304. * - dailymotion.com
  305. */
  306. // 'http://www.dailymotion.com/video/xafj1q_black-bomb-a-tales-from-the-old-sch_music'
  307. $this->assertEquals(array(
  308. 'data_ref_id' => 'xafj1q',
  309. 'data_thumb_url' => 'http://s1.dmcdn.net/kcSK/160x120-si6.jpg',
  310. 'data_type' => 'other',
  311. 'data_title' => 'Black Bomb A - Tales From The Old School',
  312. 'data_tags' => array(
  313. 0 => 'Metal'
  314. )
  315. ),$this->proceed_element_datas_api(
  316. $bux,
  317. 'http://www.dailymotion.com/video/xafj1q_black-bomb-a-tales-from-the-old-sch_music'
  318. ));
  319. // http://www.dailymotion.com/video/x4om5b_punish-yourself-gimme-cocaine-live_music?search_algo=2
  320. $this->assertEquals(array(
  321. 'data_ref_id' => 'x4om5b',
  322. 'data_thumb_url' => 'http://s1.dmcdn.net/sRiY/160x120-BYy.jpg',
  323. 'data_type' => 'other',
  324. 'data_title' => 'Punish yourself - gimme cocaine (live à nancy, azimut854)',
  325. 'data_tags' => array(
  326. 0 => 'Metal',
  327. 1 => 'Electro'
  328. )
  329. ),$this->proceed_element_datas_api(
  330. $bux,
  331. 'http://www.dailymotion.com/video/x4om5b_punish-yourself-gimme-cocaine-live_music?search_algo=2'
  332. ));
  333. /*
  334. * - soundcloud.com
  335. */
  336. // 'http://soundcloud.com/matas/sets/library-project'
  337. // On retire le test de "data_thumb_url", chez sound cloud ca arrete pas de
  338. // changer en ce moment
  339. $datas = $this->proceed_element_datas_api(
  340. $bux,
  341. 'http://soundcloud.com/matas/sets/library-project'
  342. );
  343. $this->assertTrue(array_key_exists('data_thumb_url', $datas));
  344. if (array_key_exists('data_thumb_url', $datas))
  345. {
  346. unset($datas['data_thumb_url']);
  347. }
  348. $this->assertEquals(array(
  349. 'data_ref_id' => 3770,
  350. 'data_title' => 'Library Project',
  351. //'data_thumb_url' => 'http://i1.sndcdn.com/artworks-000000514203-fsvbcj-large.jpg?51826bf',
  352. 'data_type' => 'playlist',
  353. 'data_artist' => 'matas',
  354. 'data_normalized_url' => 'http://api.soundcloud.com/playlists/3770',
  355. 'data_tags' => array(0 => '')
  356. ),$datas);
  357. // Test des tags récupérés
  358. $datas = $this->proceed_element_datas_api(
  359. $bux,
  360. 'https://soundcloud.com/mixessss3/white-stripes-vs-led-zeppelin-icky-kinky-love-rock-mashup-dj-zebra'
  361. );
  362. $this->assertTrue(array_key_exists('data_thumb_url', $datas));
  363. if (array_key_exists('data_thumb_url', $datas))
  364. {
  365. unset($datas['data_thumb_url']);
  366. }
  367. $this->assertEquals(array(
  368. 'data_ref_id' => 2215186,
  369. 'data_title' => 'White Stripes Vs Led Zeppelin - Icky Kinky Love (Rock Mashup) DJ Zebra',
  370. //'data_thumb_url' => 'http://i1.sndcdn.com/artworks-000000514203-fsvbcj-large.jpg?51826bf',
  371. 'data_type' => 'track',
  372. 'data_artist' => 'Mixes and Mashups #3',
  373. 'data_normalized_url' => 'http://api.soundcloud.com/tracks/2215186',
  374. 'data_tags' => array(0 => 'Rock', 1 => 'rock ')
  375. ),$datas);
  376. // 'http://soundcloud.com/matas/above-hyperion-redux'
  377. $datas = $this->proceed_element_datas_api(
  378. $bux,
  379. 'http://soundcloud.com/matas/above-hyperion-redux'
  380. );
  381. $this->assertTrue(array_key_exists('data_thumb_url', $datas));
  382. if (array_key_exists('data_thumb_url', $datas))
  383. {
  384. unset($datas['data_thumb_url']);
  385. }
  386. $this->assertEquals(array(
  387. 'data_ref_id' => 3154252,
  388. 'data_title' => 'Above Hyperion (redux)',
  389. //'data_thumb_url' => 'http://i1.sndcdn.com/artworks-000001536693-gb1n5v-large.jpg?51826bf',
  390. 'data_type' => 'track',
  391. 'data_artist' => 'matas',
  392. 'data_tags' => array(
  393. 0 => 'Spacestep'
  394. ),
  395. 'data_normalized_url' => 'http://api.soundcloud.com/tracks/3154252'
  396. ),$datas);
  397. // https://soundcloud.com/sinkane/okay-africa-mixtape-2011#play
  398. $datas = $this->proceed_element_datas_api(
  399. $bux,
  400. 'https://soundcloud.com/sinkane/okay-africa-mixtape-2011#play'
  401. );
  402. $this->assertTrue(array_key_exists('data_thumb_url', $datas));
  403. if (array_key_exists('data_thumb_url', $datas))
  404. {
  405. unset($datas['data_thumb_url']);
  406. }
  407. $this->assertEquals(array(
  408. 'data_ref_id' => 29186819,
  409. 'data_title' => 'Okay Africa Mixtape 2011',
  410. //'data_thumb_url' => 'http://i1.sndcdn.com/artworks-000001536693-gb1n5v-large.jpg?51826bf',
  411. 'data_type' => 'track',
  412. 'data_artist' => 'Sinkane',
  413. 'data_tags' => array(
  414. 0 => null
  415. ),
  416. 'data_normalized_url' => 'http://api.soundcloud.com/tracks/29186819',
  417. ),$datas);
  418. // 'http://soundcloud.com/tracks/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
  419. $this->assertEquals(array(
  420. ),$this->proceed_element_datas_api(
  421. $bux,
  422. 'http://soundcloud.com/tracks/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
  423. ));
  424. //'http://soundcloud.com/people/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
  425. $this->assertEquals(array(
  426. ),$this->proceed_element_datas_api(
  427. $bux,
  428. 'http://soundcloud.com/people/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
  429. ));
  430. // 'http://soundcloud.com/groups/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
  431. $this->assertEquals(array(
  432. ),$this->proceed_element_datas_api(
  433. $bux,
  434. 'http://soundcloud.com/groups/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
  435. ));
  436. $datas = $this->proceed_element_datas_api(
  437. $bux,
  438. 'http://snd.sc/11CyOpN'
  439. );
  440. $this->assertTrue(array_key_exists('data_thumb_url', $datas));
  441. if (array_key_exists('data_thumb_url', $datas))
  442. unset($datas['data_thumb_url']);
  443. $this->assertEquals(array(
  444. 'data_ref_id' => 90126814,
  445. 'data_title' => 'The Test - WAKANTANKA #01 (Back to the originz)',
  446. 'data_type' => 'track',
  447. 'data_artist' => 'mgl32',
  448. 'data_tags' => array(
  449. 0 => 'Tribe',
  450. 1 => 'Acid Tekno'
  451. ),
  452. 'data_normalized_url' => 'http://api.soundcloud.com/tracks/90126814',
  453. //'data_download' => true,
  454. //'data_download_url' => 'http://api.soundcloud.com/tracks/90126814/download'
  455. ),$datas);
  456. /*
  457. * - jamendo.com
  458. */
  459. // 'http://www.jamendo.com/fr/list/a120468/6-00-am'
  460. $this->assertEquals(array(
  461. 'data_ref_id' => '120468',
  462. 'data_title' => '6:00 AM',
  463. 'data_type' => 'album',
  464. 'data_thumb_url' => 'https://imgjam.com/albums/s120/120468/covers/1.100.jpg',
  465. 'data_artist' => 'Azyd Azylum',
  466. 'data_tags' => array(
  467. 0 => 'Metal',
  468. 1 => 'Hardcore',
  469. 2 => 'Metalcore',
  470. 3 => 'Azyd',
  471. 4 => 'Azylum',
  472. ),
  473. 'data_download' => true,
  474. ),$this->proceed_element_datas_api(
  475. $bux,
  476. 'http://www.jamendo.com/fr/list/a120468/6-00-am'
  477. ));
  478. // 'http://www.jamendo.com/fr/track/207079'
  479. $this->assertEquals(array(
  480. 'data_ref_id' => '207079',
  481. 'data_title' => 'Insanity',
  482. 'data_type' => 'track',
  483. 'data_thumb_url' => 'https://imgjam.com/albums/s30/30661/covers/1.100.jpg',
  484. 'data_artist' => 'Ptit lutin',
  485. 'data_tags' => array(
  486. 0 => 'Techno',
  487. 1 => 'Hardtek'
  488. ),
  489. 'data_download' => true,
  490. ),$this->proceed_element_datas_api(
  491. $bux,
  492. 'http://www.jamendo.com/fr/track/207079'
  493. ));
  494. // 'http://www.jamendo.com/fr/search/all/psytrance'
  495. $this->assertEquals(array(
  496. ),$this->proceed_element_datas_api(
  497. $bux,
  498. 'http://www.jamendo.com/fr/search/all/psytrance'
  499. ));
  500. // 'http://www.jamendo.com/fr/artist/DJ_BETO'
  501. $this->assertEquals(array(
  502. ),$this->proceed_element_datas_api(
  503. $bux,
  504. 'http://www.jamendo.com/fr/artist/DJ_BETO'
  505. ));
  506. /*/*
  507. * - deezer.com
  508. */
  509. // 'http://www.deezer.com/fr/music/pantera/far-beyond-driven-80398'
  510. $this->assertEquals(array(
  511. 'data_ref_id' => '80398',
  512. 'data_type' => 'album',
  513. 'data_thumb_url' => 'http://api.deezer.com/2.0/album/80398/image',
  514. 'data_title' => 'Far Beyond Driven',
  515. 'data_artist' => 'Pantera'
  516. ),$this->proceed_element_datas_api(
  517. $bux,
  518. 'http://www.deezer.com/fr/music/pantera/far-beyond-driven-80398'
  519. ));
  520. // 'http://www.deezer.com/fr/music/playlist/18701350'
  521. $this->assertEquals(array(
  522. 'data_ref_id' => '18701350',
  523. 'data_type' => 'playlist',
  524. 'data_title' => 'Trucs Cools'
  525. ),$this->proceed_element_datas_api(
  526. $bux,
  527. 'http://www.deezer.com/fr/music/playlist/18701350'
  528. ));
  529. /*
  530. * Vimeo
  531. *
  532. */
  533. $this->assertEquals(array(
  534. 'data_ref_id' => '43258820',
  535. 'data_title' => 'Punish Yourself',
  536. 'data_thumb_url' => 'http://b.vimeocdn.com/ts/301/282/301282081_200.jpg',
  537. 'data_type' => 'other'
  538. ),$this->proceed_element_datas_api(
  539. $bux,
  540. 'http://vimeo.com/43258820'
  541. ));
  542. /*
  543. * Spotify
  544. *
  545. */
  546. $this->assertEquals(array(
  547. 'data_ref_id' => '1Uz3BDNxgLI0S6ACV7yXlT',
  548. 'data_title' => 'Narkotek Old School Tracks',
  549. 'data_artist' => 'Guigoo Narkotek',
  550. 'data_type' => 'album'
  551. ),$this->proceed_element_datas_api(
  552. $bux,
  553. 'http://open.spotify.com/album/1Uz3BDNxgLI0S6ACV7yXlT'
  554. ));
  555. $this->assertEquals(array(
  556. 'data_ref_id' => '3d5FWJe19DkUJaO2wDEQHY',
  557. 'data_title' => 'Outta space',
  558. 'data_artist' => 'Guigoo Narkotek',
  559. 'data_type' => 'track'
  560. ),$this->proceed_element_datas_api(
  561. $bux,
  562. 'http://open.spotify.com/track/3d5FWJe19DkUJaO2wDEQHY'
  563. ));
  564. /*
  565. * Mixcloud
  566. *
  567. */
  568. $this->assertEquals(array(
  569. 'data_ref_id' => '/nevrakse_ISM/nevrakse-tranceplantation/',
  570. 'data_title' => 'Nevrakse - Tranceplantation',
  571. 'data_artist' => 'nevrakse_ISM',
  572. 'data_type' => 'track',
  573. 'data_normalized_url' => 'http://www.mixcloud.com/nevrakse_ISM/nevrakse-tranceplantation/',
  574. 'data_thumb_url' => 'http://images-mix.netdna-ssl.com/w/100/h/100/q/85/upload/images/profile/e0cf41b2-a34e-4638-abbe-4713ac17a9c8.jpeg',
  575. 'data_tags' => array(
  576. 0 => 'Trance',
  577. 1 => 'Psytrance'
  578. )
  579. ),$this->proceed_element_datas_api(
  580. $bux,
  581. 'http://www.mixcloud.com/nevrakse_ISM/nevrakse-tranceplantation/'
  582. ));
  583. }
  584. }