Beispiel #1
0
def test_add_metadata(config, test_folder):
    import time
    media_file = test_folder.join('mystation', 'myshow', 'myepisode.pm3')
    station = config.stations['dlf']
    show = Show(station, 'me', 'Me', 2)
    recorder = Recorder()
    recorder.start_time = time.time()
    recorder._copy_file_to_destination(
        os.path.join(os.path.dirname(__file__), 'testfile.mp3'),
        str(media_file))
    recorder._add_metadata(show, str(media_file))
    try:
        # Python 2.x
        from mutagen.mp3 import MP3
    except ImportError:
        # Python 3.x
        from mutagenx.mp3 import MP3

    audio = MP3(str(media_file))
    #assert 'tit' == audio['TIT2'].text[0]
    assert 'Podcast' == audio['TCON'].text[0]
    assert 'Deutschlandfunk' == audio['TPE1'].text[0]
    assert 'Deutschlandfunk' == audio['TCOP'].text[0]
    assert 'Me' == audio['TALB'].text[0]
    assert 'http://example.org/dlf' == audio['TCOM'].text[0]
    assert u'2000' == audio['TLEN'].text[0]
Beispiel #2
0
def test_add_metadata(config, test_folder):
    import shutil
    from mutagenx.mp3 import MP3

    media_file = test_folder.join('mystation', 'myshow', 'myepisode.pm3')
    os.makedirs(os.path.dirname(str(media_file)))
    shutil.copy(os.path.join(os.path.dirname(__file__), 'testfile.mp3'), str(media_file))

    station = config.stations['dlf']
    show = Show(config, station, 'me', 'Me', 2)
    episode = Episode(config, show)
    episode.filename = str(media_file)
    recorder = Recorder()
    recorder._add_metadata(episode)

    audio = MP3(str(media_file))
    #assert 'tit' == audio['TIT2'].text[0]
    assert 'Podcast' == audio['TCON'].text[0]
    assert 'Deutschlandfunk' == audio['TPE1'].text[0]
    assert 'Deutschlandfunk' == audio['TCOP'].text[0]
    assert 'Me' == audio['TALB'].text[0]
    assert 'http://example.org/dlf' == audio['TCOM'].text[0]
    assert u'2000' == audio['TLEN'].text[0]
def test_add_metadata(config, test_folder):
    import time
    media_file = test_folder.join('mystation', 'myshow', 'myepisode.pm3')
    station = config.stations['dlf']
    show = Show(station, 'me', 'Me', 2)
    recorder = Recorder()
    recorder.start_time = time.time()
    recorder._copy_file_to_destination(os.path.join(os.path.dirname(__file__), 'testfile.mp3'), str(media_file))
    recorder._add_metadata(show, str(media_file))
    try:
        # Python 2.x
        from mutagen.mp3 import MP3
    except ImportError:
        # Python 3.x
        from mutagenx.mp3 import MP3

    audio = MP3(str(media_file))
    #assert 'tit' == audio['TIT2'].text[0]
    assert 'Podcast' == audio['TCON'].text[0]
    assert 'Deutschlandfunk' == audio['TPE1'].text[0]
    assert 'Deutschlandfunk' == audio['TCOP'].text[0]
    assert 'Me' == audio['TALB'].text[0]
    assert 'http://example.org/dlf' == audio['TCOM'].text[0]
    assert u'2000' == audio['TLEN'].text[0]