Selaa lähdekoodia

Evolution #796: Url non gérée: deezer

Bastien Sevajol 11 vuotta sitten
vanhempi
commit
21a53c37c2

+ 8 - 0
src/Muzich/CoreBundle/Factory/Elements/Sndsc.php Näytä tiedosto

@@ -0,0 +1,8 @@
1
+<?php
2
+
3
+namespace Muzich\CoreBundle\Factory\Elements;
4
+
5
+class Sndsc extends Soundcloudcom
6
+{
7
+  
8
+}

+ 3 - 1
src/Muzich/CoreBundle/Factory/UrlMatchs.php Näytä tiedosto

@@ -34,7 +34,9 @@ class UrlMatchs
34 34
       "#^\/[a-zA-Z0-9_-]+\/sets\/[a-zA-Z0-9_-]+#" => null,
35 35
       // http://soundcloud.com/noisia/black-sun-empire-noisia-feed
36 36
       // http://soundcloud.com/user4818423/mechanika-crew-andrew-dj-set
37
-      "#^\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+#" => null
37
+      "#^\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+#" => null,
38
+      // http://snd.sc/11CyOpN
39
+      "#\/[a-zA-Z0-9_-]#" => null
38 40
     )
39 41
   );
40 42
   

+ 4 - 0
src/Muzich/CoreBundle/Managers/ElementManager.php Näytä tiedosto

@@ -12,6 +12,7 @@ use Muzich\CoreBundle\Factory\Elements\Youtube;
12 12
 use Muzich\CoreBundle\Factory\Elements\Dailymotioncom;
13 13
 use Muzich\CoreBundle\Factory\Elements\Jamendocom;
14 14
 use Muzich\CoreBundle\Factory\Elements\Soundcloudcom;
15
+use Muzich\CoreBundle\Factory\Elements\Sndsc;
15 16
 use Muzich\CoreBundle\Factory\Elements\Deezercom;
16 17
 use Muzich\CoreBundle\Factory\Elements\Vimeocom;
17 18
 use Muzich\CoreBundle\Factory\Elements\Spotifycom;
@@ -162,6 +163,9 @@ class ElementManager
162 163
       case 'soundcloud.com':
163 164
         return new Soundcloudcom($this->element, $this->container, $this->em);
164 165
       break;
166
+      case 'snd.sc':
167
+        return new Sndsc($this->element, $this->container, $this->em);
168
+      break;
165 169
       case 'jamendo.com':
166 170
         return new Jamendocom($this->element, $this->container, $this->em);
167 171
       break;

+ 22 - 0
src/Muzich/CoreBundle/Tests/ElementFactory/ElementFactoryTest.php Näytä tiedosto

@@ -497,6 +497,28 @@ class ElementFactoryTest extends UnitTest
497 497
       $bux, 
498 498
       'http://soundcloud.com/groups/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
499 499
     ));
500
+    
501
+    $datas = $this->proceed_element_datas_api(
502
+      $bux, 
503
+      'http://snd.sc/11CyOpN'
504
+    );
505
+    $this->assertTrue(array_key_exists('data_thumb_url', $datas));
506
+    if (array_key_exists('data_thumb_url', $datas))
507
+      unset($datas['data_thumb_url']);
508
+    
509
+    $this->assertEquals(array(
510
+      'data_ref_id' => 90126814,
511
+      'data_title' => 'The Test - WAKANTANKA #01 (Back to the originz)',
512
+      'data_type' => 'track',
513
+      'data_artist' => 'mgl32',
514
+      'data_tags' => array(
515
+        0 => 'Tribe',
516
+        1 => 'Acid Tekno'
517
+      ),
518
+      'data_normalized_url' => 'http://api.soundcloud.com/tracks/90126814',
519
+      'data_download' => true,
520
+      'data_download_url' => 'http://api.soundcloud.com/tracks/90126814/download'
521
+    ),$datas);
500 522
      
501 523
     /*
502 524
      *   - jamendo.com

+ 5 - 0
src/Muzich/CoreBundle/Tests/ElementFactory/UrlAnalyzerTest.php Näytä tiedosto

@@ -62,6 +62,11 @@ class UrlAnalyzerTest extends \PHPUnit_Framework_TestCase
62 62
     
63 63
     $url_analyzer = new UrlAnalyzer($this->getNewElement('soundcloud.com', 'https://soundcloud.com/search?q=toto'), UrlMatchs::$soundcloud);
64 64
     $this->assertFalse($url_analyzer->haveMatch());
65
+    
66
+    $url_analyzer = new UrlAnalyzer($this->getNewElement('snd.sc', 'http://snd.sc/11CyOpN'), UrlMatchs::$soundcloud);
67
+    $this->assertTrue($url_analyzer->haveMatch());
68
+    $this->assertEquals(Element::TYPE_OTHER, $url_analyzer->getType());
69
+    $this->assertEquals(null, $url_analyzer->getRefId());
65 70
   }
66 71
   
67 72
   public function testYoutu()