|
@@ -5,14 +5,16 @@ namespace Muzich\CoreBundle\Factory\Elements;
|
5
|
5
|
use Muzich\CoreBundle\Factory\ElementFactory;
|
6
|
6
|
use Muzich\CoreBundle\Entity\Element;
|
7
|
7
|
use Muzich\CoreBundle\Factory\UrlMatchs;
|
|
8
|
+use Symfony\Component\DependencyInjection\Container;
|
|
9
|
+use Doctrine\ORM\EntityManager;
|
8
|
10
|
|
9
|
11
|
class Jamendocom extends ElementFactory
|
10
|
12
|
{
|
11
|
13
|
|
12
|
14
|
public function __construct(Element $element, Container $container, EntityManager $entity_manager)
|
13
|
15
|
{
|
14
|
|
- parent::__construct($element, $container, $entity_manager);
|
15
|
16
|
$this->url_matchs = UrlMatchs::$jamendo;
|
|
17
|
+ parent::__construct($element, $container, $entity_manager);
|
16
|
18
|
}
|
17
|
19
|
|
18
|
20
|
public function getStreamData()
|
|
@@ -64,7 +66,7 @@ class Jamendocom extends ElementFactory
|
64
|
66
|
|
65
|
67
|
protected function getApiTagUrl()
|
66
|
68
|
{
|
67
|
|
- return "http://api.jamendo.com/get2/name+weight/tag/json/album_tag/?".$this->url_analyzer->getType()."_id="
|
|
69
|
+ return "http://api.jamendo.com/get2/name+weight/tag/json/".$this->url_analyzer->getType()."_tag/?".$this->url_analyzer->getType()."_id="
|
68
|
70
|
.$this->url_analyzer->getRefId();
|
69
|
71
|
}
|
70
|
72
|
|
|
@@ -87,17 +89,16 @@ class Jamendocom extends ElementFactory
|
87
|
89
|
$this->element->setData(Element::DATA_TITLE, $response->get(array(0 => 'track_name')));
|
88
|
90
|
}
|
89
|
91
|
|
90
|
|
- if (($response = $this->getApiConnector()->getResponseForUrl($this->getApiTagUrl())))
|
|
92
|
+ $tags = array();
|
|
93
|
+ $response = $this->getApiConnector()->getResponseForUrl($this->getApiTagUrl());
|
|
94
|
+ if (count($response->getContent()))
|
91
|
95
|
{
|
92
|
|
- // TODO: Check si tout ce passe bien avec pas de tags en retour de l'api
|
93
|
|
- $tags = array();
|
94
|
|
- foreach ($result->getContent() as $tag)
|
|
96
|
+ foreach ($response->getContent() as $tag)
|
95
|
97
|
{
|
96
|
98
|
$tags[] = $tag['name'];
|
97
|
99
|
}
|
98
|
|
-
|
99
|
|
- $this->element->setData(Element::DATA_TAGS, $tags);
|
100
|
100
|
}
|
|
101
|
+ $this->element->setData(Element::DATA_TAGS, $tags);
|
101
|
102
|
}
|
102
|
103
|
|
103
|
104
|
// Un contenu jamendo est toujours téléchargeable
|