Beispiel #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
Beispiel #2
0
class ReleaseMapperTest(TestCase):

    def setUp(self):
        self.delivery = IDOLDelivery(TEST_COMMON + '/batch1/3596971288129')
        self.vendor = Vendor.objects.create(pk=self.delivery.vendor_id)
        self.label = Label.objects.create(name='aaaa')
        self.artist = Artist.objects.create(name='aaaa')
        self.prix = Prix.objects.create(code=price_dic['B0'])
        self.release_mapper = ReleaseMapper(self.delivery, artist=self.artist, label=self.label, vendor=self.vendor)

    def _check_notes(self, produced_album):
        notes = (',').join([style.name for style in self.delivery.styles])
        notes = notes + " - IDOL-ID: %s" % (str(self.delivery.release.pk),)
        self.assertEqual(notes, produced_album.notes)

    def test_create(self):
        produced_album = self.release_mapper.create()
        self.assertEqual(self.delivery.release.title, produced_album.title)
        self.assertEqual(self.delivery.release.publish_date_digital, produced_album.publish_date_digital)
        self.assertEqual(self.delivery.release.publish_date, produced_album.publish_date)
        self.assertEqual(','.join(self.delivery.release.territories), produced_album.territories)
        self.assertEqual(self.label, produced_album.label)
        self.assertEqual(self.artist, produced_album.artist)
        self.assertEqual(self.prix, produced_album.prix)
        self.assertEqual(date.today(), produced_album.created)
        self.assertEqual('boutique', produced_album.domain)
        self.assertEqual(self.vendor, produced_album.vendor)
        self.assertEqual(self.delivery.release.upc, produced_album.upc)
        self._check_notes(produced_album)
        album_vendor = produced_album.albumvendor_set.get(vendor=self.vendor)
        self.assertEqual(self.delivery.release.pk, album_vendor.external_album_id)
Beispiel #3
0
 def setUp(self):
     self.delivery = IDOLDelivery(TEST_COMMON + '/batch1/3596971288129')
     self.vendor = Vendor.objects.create(pk=self.delivery.vendor_id)
     self.label = Label.objects.create(name='aaaa')
     self.artist = Artist.objects.create(name='aaaa')
     self.prix = Prix.objects.create(code=price_dic['B0'])
     self.release_mapper = ReleaseMapper(self.delivery, artist=self.artist, label=self.label, vendor=self.vendor)
Beispiel #4
0
class ReleaseWithWorldWideTerritoryMapperTest(TestCase):

    fixtures = ['iso.json',]

    def setUp(self):
        self.delivery = IDOLDelivery(TEST_COMMON + '/batch_similar/3307516706028')
        self.vendor = Vendor.objects.create(pk=self.delivery.vendor_id)
        self.label = Label.objects.create(name='aaaa')
        self.artist = Artist.objects.create(name='aaaa')
        self.prix = Prix.objects.create(code=price_dic['B0'])
        self.release_mapper = ReleaseMapper(self.delivery, artist=self.artist, label=self.label, vendor=self.vendor)

    def _build_expected_territories(self):
        country_codes = CountryIsoEn.objects.all().values_list('code')
        return set([code for (code,) in country_codes])

    def test_create(self):
        produced_album = self.release_mapper.create()
        self.assertEqual(self._build_expected_territories(), set(produced_album.territories.split(',')))