Ejemplo n.º 1
0
 def _build_aux(self):
     if not self.artist:
         assert self.delivery.release.compil, "Artiste absent, impossible créer album"
         artist_mapper = ArtistMapper(delivery=self.delivery, vendor=self.vendor)
         self.artist = artist_mapper.create()
     # Create album
     release_mapper = ReleaseMapper(delivery=self.delivery, artist=self.artist, label=self.label, vendor=self.vendor)
     album = release_mapper.create() 
     # Create directory
     album_path = self.album_path(album)
     mp3_path = os.path.join(album_path, 'mp3')
     samples_path = os.path.join(album_path, 'samples')
     images_path = os.path.join(album_path, 'images')
     os.mkdir(album_path)
     os.mkdir(mp3_path)
     os.mkdir(samples_path)
     os.mkdir(images_path)
     # Process Tracks
     for delivery_track in self.delivery.tracks:
         track_processor = TrackProcessor(disc=self.disc, album=album, delivery_track=delivery_track)
         track = track_processor.build()
     #Process Images
     imagefile_processor = ImageFileProcessor(delivery_image=self.delivery.image,
                                              album=album, disc=self.disc)
     imagefile_processor.build()
     return album
Ejemplo n.º 2
0
 def test_create(self):
     artist_mapper = ArtistMapper(vendor=self.idol_vendor, delivery=self.delivery)
     produced_artist = artist_mapper.create(url=self.delivery.artist.name)
     self.assertEqual(self.delivery.artist.name, produced_artist.name)
     self.assertEqual('wax-tailor', produced_artist.url)
     self._check_artist_vendor(produced_artist)
     self._check_commons(produced_artist)
Ejemplo n.º 3
0
 def test_create_compil(self):
     delivery = IDOLDelivery(datapaths.compil1_path)
     artist_mapper = ArtistMapper(vendor=self.idol_vendor, delivery=delivery)
     produced_artist = artist_mapper.create()
     expected_name = "%s (compilation)" % (delivery.release.title,)
     expected_url = latin1_to_ascii(('-').join(delivery.release.title.split())).lower()
     self.assertEqual(expected_name, produced_artist.name)
     self.assertEqual(expected_url, produced_artist.url)
     self.assertEqual('compilation', produced_artist.type)
     self.assertEqual(0, len(produced_artist.artistvendor_set.all()))
     self._check_commons(produced_artist)
Ejemplo n.º 4
0
 def _build(self):
     mapper = ArtistMapper(delivery=self.delivery, vendor=self.vendor)
     """
     if not self.artist_form:
         assert self.delivery.release.compil, "Formulaire artiste absent"
         return mapper.create()
     """
     create = self.artist_form.cleaned_data['create']
     if create: # Création d'un nouvel artist            
         return mapper.create(url=self.artist_form.cleaned_data['url'])
     else: # Liaison avec un artiste existant
         return mapper.link(mdx_artist=Artist.objects.get(pk=self.artist_form.cleaned_data['mdx_artist_id']))
Ejemplo n.º 5
0
 def test_link(self):
     local_artist = Artist.objects.create(pk=56)
     artist_mapper = ArtistMapper(vendor=self.idol_vendor, delivery=self.delivery)
     produced_artist = artist_mapper.link(mdx_artist=local_artist)
     self.assertEqual(local_artist, produced_artist)
     self._check_artist_vendor(produced_artist)
Ejemplo n.º 6
0
 def test_create_clean_url(self):
     artist_mapper = ArtistMapper(vendor=self.idol_vendor, delivery=self.delivery)
     produced_artist = artist_mapper.create(url=u"azé RG")
     self.assertEqual('aze-rg', produced_artist.url)