def assert_tag_present_in_mp3(self, eyed3_attribute, flac_key, flac_value):
     with TemporaryDirectory() as tmp:
         flac_file = join(tmp, 'tmp.flac')
         mp3_file = join(tmp, 'tmp.mp3')
         self.create_flac_file(flac_file, tags={flac_key: flac_value})
         transcode(flac_file, mp3_file)
         tag = eyed3.load(mp3_file).tag
         assert_equals(flac_value, getattr(tag, eyed3_attribute))
 def assert_tag_present_in_mp3(self, eyed3_attribute, flac_key, flac_value):
     with TemporaryDirectory() as tmp:
         flac_file = join(tmp, 'tmp.flac')
         mp3_file = join(tmp, 'tmp.mp3')
         self.create_flac_file(flac_file, tags={flac_key: flac_value})
         transcode(flac_file, mp3_file)
         tag = eyed3.load(mp3_file).tag
         assert_equals(flac_value, getattr(tag, eyed3_attribute))
 def assert_tag_present_in_mp3(self, eyed3_method_name, flac_key, flac_value):
     with TemporaryDirectory() as tmp:
         flac_file = join(tmp, 'tmp.flac')
         mp3_file = join(tmp, 'tmp.mp3')
         self.create_flac_file(flac_file, {flac_key: flac_value})
         transcode(flac_file, mp3_file)
         tag = eyeD3.Tag()
         tag.link(mp3_file)
         self.assertEquals(flac_value, getattr(tag, eyed3_method_name)())
    def test_acceptance_one_file_with_spaces(self):
        with TemporaryDirectory() as tmp:
            flac_file = join(tmp, 'file with spaces.flac')
            mp3_file = join(tmp, 'file with spaces.mp3')
            self.create_flac_file(flac_file)

            transcode(flac_file, mp3_file)

            ok_(os.path.isfile(mp3_file))
    def test_acceptance_one_file_with_spaces(self):
        with TemporaryDirectory() as tmp:
            flac_file = join(tmp, 'file with spaces.flac')
            mp3_file = join(tmp, 'file with spaces.mp3')
            self.create_flac_file(flac_file)

            transcode(flac_file, mp3_file)

            ok_(os.path.isfile(mp3_file))
    def test_acceptance_one_file_with_embedded_cover(self):
        with TemporaryDirectory() as tmp:
            flac_file, mp3_file = self.init_files(tmp, embbed=True)

            transcode(flac_file, mp3_file)

            tag = eyed3.load(mp3_file).tag
            assert_equals(1, len(tag.images))
            
            tmp_file_pattern = '%s.*\%s' % (CoverFile.tmp_prefix, CoverFile.tmp_suffix)
            assert_equals(0, len(set(find_files(tmp_file_pattern, tempfile.gettempdir()))))
    def test_acceptance_one_file_with_embedded_cover(self):
        with TemporaryDirectory() as tmp:
            flac_file, mp3_file = self.init_files(tmp, embbed=True)

            transcode(flac_file, mp3_file)

            tag = eyed3.load(mp3_file).tag
            assert_equals(1, len(tag.images))

            tmp_file_pattern = '%s.*\%s' % (CoverFile.tmp_prefix,
                                            CoverFile.tmp_suffix)
            assert_equals(
                0, len(set(find_files(tmp_file_pattern,
                                      tempfile.gettempdir()))))
    def test_acceptance_one_file(self):
        with TemporaryDirectory() as tmp:
            flac_file, mp3_file = self.init_files(tmp)

            transcode(flac_file, mp3_file)

            tag = eyed3.load(mp3_file).tag
            assert_equals('artist', tag.artist)
            assert_equals((1,15), tag.track_num)
            assert_equals('album', tag.album)
            assert_equals('title', tag.title)
            assert_equals('description', tag.comments[0].text)
            assert_equals('Electronic', tag.genre.name)
            assert_equals('2008', str(tag.getBestDate()))
            assert_equals(1, len(tag.images))
    def test_acceptance_one_file(self):
        with TemporaryDirectory() as tmp:
            flac_file, mp3_file = self.init_files(tmp)

            transcode(flac_file, mp3_file)

            tag = eyed3.load(mp3_file).tag
            assert_equals('artist', tag.artist)
            assert_equals((1, 15), tag.track_num)
            assert_equals('album', tag.album)
            assert_equals('title', tag.title)
            assert_equals('description', tag.comments[0].text)
            assert_equals('Electronic', tag.genre.name)
            assert_equals('2008', str(tag.getBestDate()))
            assert_equals(1, len(tag.images))
    def test_acceptance_one_file(self):
        with TemporaryDirectory() as tmp:
            flac_file = join(tmp, 'tmp.flac')
            mp3_file = join(tmp, 'tmp.mp3')
            self.create_flac_file(flac_file)

            transcode(flac_file, mp3_file)

            tag = eyeD3.Tag()
            tag.link(mp3_file)
            self.assertEquals(u"artist", tag.getArtist())
            self.assertEquals((1,15), tag.getTrackNum())
            self.assertEquals(u"album", tag.getAlbum())
            self.assertEquals(u"title", tag.getTitle())
            self.assertEquals('description', tag.getComments()[0].comment)
            self.assertEquals('Electronic', tag.getGenre().getName())
            self.assertEquals('2008', (tag.getDate()[0]).getYear())
            self.assertEquals(1, len(tag.getImages()))
 def test_transcode_without_cover(self):
     with TemporaryDirectory() as tmp:
         self.create_flac_file(join(tmp, 'tmp.flac'), cover=None)
         transcode(join(tmp, 'tmp.flac'),join(tmp, 'tmp.mp3'))
         self.assertTrue(os.path.isfile(join(tmp, 'tmp.mp3')))
 def test_transcode_without_cover(self):
     with TemporaryDirectory() as tmp:
         self.create_flac_file(join(tmp, 'tmp.flac'), cover=None)
         transcode(join(tmp, 'tmp.flac'), join(tmp, 'tmp.mp3'))
         ok_(os.path.isfile(join(tmp, 'tmp.mp3')))