Browse Source

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

Bastien Sevajol 11 years ago
parent
commit
21a53c37c2

+ 8 - 0
src/Muzich/CoreBundle/Factory/Elements/Sndsc.php View File

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 View File

34
       "#^\/[a-zA-Z0-9_-]+\/sets\/[a-zA-Z0-9_-]+#" => null,
34
       "#^\/[a-zA-Z0-9_-]+\/sets\/[a-zA-Z0-9_-]+#" => null,
35
       // http://soundcloud.com/noisia/black-sun-empire-noisia-feed
35
       // http://soundcloud.com/noisia/black-sun-empire-noisia-feed
36
       // http://soundcloud.com/user4818423/mechanika-crew-andrew-dj-set
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 View File

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

+ 22 - 0
src/Muzich/CoreBundle/Tests/ElementFactory/ElementFactoryTest.php View File

497
       $bux, 
497
       $bux, 
498
       'http://soundcloud.com/groups/search?q%5Bfulltext%5D=EEK+A+MOUSSE&q%5Btype%5D=&q%5Bduration%5D='
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
      *   - jamendo.com
524
      *   - jamendo.com

+ 5 - 0
src/Muzich/CoreBundle/Tests/ElementFactory/UrlAnalyzerTest.php View File

62
     
62
     
63
     $url_analyzer = new UrlAnalyzer($this->getNewElement('soundcloud.com', 'https://soundcloud.com/search?q=toto'), UrlMatchs::$soundcloud);
63
     $url_analyzer = new UrlAnalyzer($this->getNewElement('soundcloud.com', 'https://soundcloud.com/search?q=toto'), UrlMatchs::$soundcloud);
64
     $this->assertFalse($url_analyzer->haveMatch());
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
   public function testYoutu()
72
   public function testYoutu()