Ejemplo n.º 1
0
def get_releases_for_release_group(release_group_id, includes=RELEASE_INCLUDES):
    with musicbrainz_lock:
        logger.debug('Fetching release for rgid {}'.format(release_group_id))
        search_results = musicbrainzngs.browse_releases(release_group=release_group_id,
                                                        release_type='album', includes=includes)['release-list']

        return [album_info(release) for release in search_results]
Ejemplo n.º 2
0
 def test_ignored_media(self):
     config['match']['ignored_media'] = ['IGNORED1', 'IGNORED2']
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(tracks=tracks, medium_format="IGNORED1")
     d = mb.album_info(release)
     self.assertEqual(len(d.tracks), 0)
Ejemplo n.º 3
0
 def test_parse_release_with_year(self):
     release = self._make_release('1984')
     d = mb.album_info(release)
     self.assertEqual(d.album, 'ALBUM TITLE')
     self.assertEqual(d.album_id, 'ALBUM ID')
     self.assertEqual(d.artist, 'ARTIST NAME')
     self.assertEqual(d.artist_id, 'ARTIST ID')
     self.assertEqual(d.year, 1984)
Ejemplo n.º 4
0
 def test_parse_disctitle(self):
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(None, tracks=tracks)
     d = mb.album_info(release)
     t = d.tracks
     self.assertEqual(t[0].disctitle, 'MEDIUM TITLE')
     self.assertEqual(t[1].disctitle, 'MEDIUM TITLE')
Ejemplo n.º 5
0
 def test_parse_track_artist(self):
     tracks = [self._make_track('a', 'b', 1, True)]
     release = self._make_release(None, tracks=tracks)
     track = mb.album_info(release).tracks[0]
     self.assertEqual(track.artist, 'TRACK ARTIST NAME')
     self.assertEqual(track.artist_id, 'TRACK ARTIST ID')
     self.assertEqual(track.artist_sort, 'TRACK ARTIST SORT NAME')
     self.assertEqual(track.artist_credit, 'TRACK ARTIST CREDIT')
Ejemplo n.º 6
0
 def test_parse_recording_artist(self):
     tracks = [self._make_track("a", "b", 1, True)]
     release = self._make_release(None, tracks=tracks)
     track = mb.album_info(release).tracks[0]
     self.assertEqual(track.artist, "RECORDING ARTIST NAME")
     self.assertEqual(track.artist_id, "RECORDING ARTIST ID")
     self.assertEqual(track.artist_sort, "RECORDING ARTIST SORT NAME")
     self.assertEqual(track.artist_credit, "RECORDING ARTIST CREDIT")
Ejemplo n.º 7
0
 def test_track_artist_overrides_recording_artist(self):
     tracks = [self._make_track("a", "b", 1, True)]
     release = self._make_release(None, tracks=tracks, track_artist=True)
     track = mb.album_info(release).tracks[0]
     self.assertEqual(track.artist, "TRACK ARTIST NAME")
     self.assertEqual(track.artist_id, "TRACK ARTIST ID")
     self.assertEqual(track.artist_sort, "TRACK ARTIST SORT NAME")
     self.assertEqual(track.artist_credit, "TRACK ARTIST CREDIT")
Ejemplo n.º 8
0
 def test_parse_media(self):
     tracks = [
         self._make_track("TITLE ONE", "ID ONE", 100.0 * 1000.0),
         self._make_track("TITLE TWO", "ID TWO", 200.0 * 1000.0),
     ]
     release = self._make_release(None, tracks=tracks)
     d = mb.album_info(release)
     self.assertEqual(d.media, "FORMAT")
Ejemplo n.º 9
0
    def test_parse_track_indices(self):
        tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
                  self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
        release = self._make_release(tracks=tracks)

        d = mb.album_info(release)
        t = d.tracks
        self.assertEqual(t[0].medium_index, 1)
        self.assertEqual(t[1].medium_index, 2)
Ejemplo n.º 10
0
 def test_parse_disctitle(self):
     tracks = [
         self._make_track("TITLE ONE", "ID ONE", 100.0 * 1000.0),
         self._make_track("TITLE TWO", "ID TWO", 200.0 * 1000.0),
     ]
     release = self._make_release(None, tracks=tracks)
     d = mb.album_info(release)
     t = d.tracks
     self.assertEqual(t[0].disctitle, "MEDIUM TITLE")
     self.assertEqual(t[1].disctitle, "MEDIUM TITLE")
Ejemplo n.º 11
0
    def test_parse_medium_numbers_single_medium(self):
        tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
                  self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
        release = self._make_release(tracks=tracks)

        d = mb.album_info(release)
        self.assertEqual(d.mediums, 1)
        t = d.tracks
        self.assertEqual(t[0].medium, 1)
        self.assertEqual(t[1].medium, 1)
Ejemplo n.º 12
0
 def test_skip_data_track(self):
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('[data track]', 'ID DATA TRACK',
                                100.0 * 1000.0),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(tracks=tracks)
     d = mb.album_info(release)
     self.assertEqual(len(d.tracks), 2)
     self.assertEqual(d.tracks[0].title, 'TITLE ONE')
     self.assertEqual(d.tracks[1].title, 'TITLE TWO')
Ejemplo n.º 13
0
 def test_skip_video_tracks_by_default(self):
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('TITLE VIDEO', 'ID VIDEO', 100.0 * 1000.0,
                                False, True),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(tracks=tracks)
     d = mb.album_info(release)
     self.assertEqual(len(d.tracks), 2)
     self.assertEqual(d.tracks[0].title, 'TITLE ONE')
     self.assertEqual(d.tracks[1].title, 'TITLE TWO')
Ejemplo n.º 14
0
 def test_parse_release_with_year(self):
     release = self._make_release("1984")
     d = mb.album_info(release)
     self.assertEqual(d.album, "ALBUM TITLE")
     self.assertEqual(d.album_id, "ALBUM ID")
     self.assertEqual(d.artist, "ARTIST NAME")
     self.assertEqual(d.artist_id, "ARTIST ID")
     self.assertEqual(d.original_year, 1984)
     self.assertEqual(d.year, 3001)
     self.assertEqual(d.artist_credit, "ARTIST CREDIT")
Ejemplo n.º 15
0
 def test_no_skip_video_tracks_if_configured(self):
     config['match']['ignore_video_tracks'] = False
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('TITLE VIDEO', 'ID VIDEO', 100.0 * 1000.0,
                                False, True),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(tracks=tracks)
     d = mb.album_info(release)
     self.assertEqual(len(d.tracks), 3)
     self.assertEqual(d.tracks[0].title, 'TITLE ONE')
     self.assertEqual(d.tracks[1].title, 'TITLE VIDEO')
     self.assertEqual(d.tracks[2].title, 'TITLE TWO')
Ejemplo n.º 16
0
    def test_parse_tracks(self):
        tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
                  self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
        release = self._make_release(tracks=tracks)

        d = mb.album_info(release)
        t = d.tracks
        self.assertEqual(len(t), 2)
        self.assertEqual(t[0].title, 'TITLE ONE')
        self.assertEqual(t[0].track_id, 'ID ONE')
        self.assertEqual(t[0].length, 100.0)
        self.assertEqual(t[1].title, 'TITLE TWO')
        self.assertEqual(t[1].track_id, 'ID TWO')
        self.assertEqual(t[1].length, 200.0)
Ejemplo n.º 17
0
    def test_parse_tracks(self):
        tracks = [
            self._make_track("TITLE ONE", "ID ONE", 100.0 * 1000.0),
            self._make_track("TITLE TWO", "ID TWO", 200.0 * 1000.0),
        ]
        release = self._make_release(tracks=tracks)

        d = mb.album_info(release)
        t = d.tracks
        self.assertEqual(len(t), 2)
        self.assertEqual(t[0].title, "TITLE ONE")
        self.assertEqual(t[0].track_id, "ID ONE")
        self.assertEqual(t[0].length, 100.0)
        self.assertEqual(t[1].title, "TITLE TWO")
        self.assertEqual(t[1].track_id, "ID TWO")
        self.assertEqual(t[1].length, 200.0)
Ejemplo n.º 18
0
    def test_parse_medium_numbers_two_mediums(self):
        tracks = [
            self._make_track("TITLE ONE", "ID ONE", 100.0 * 1000.0),
            self._make_track("TITLE TWO", "ID TWO", 200.0 * 1000.0),
        ]
        release = self._make_release(tracks=[tracks[0]])
        second_track_list = [{"recording": tracks[1], "position": "1"}]
        release["medium-list"].append({"position": "2", "track-list": second_track_list})

        d = mb.album_info(release)
        self.assertEqual(d.mediums, 2)
        t = d.tracks
        self.assertEqual(t[0].medium, 1)
        self.assertEqual(t[0].medium_index, 1)
        self.assertEqual(t[0].index, 1)
        self.assertEqual(t[1].medium, 2)
        self.assertEqual(t[1].medium_index, 1)
        self.assertEqual(t[1].index, 2)
Ejemplo n.º 19
0
    def test_parse_medium_numbers_two_mediums(self):
        tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
                  self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
        release = self._make_release(tracks=[tracks[0]])
        second_track_list = [{
            'recording': tracks[1],
            'position': '1',
        }]
        release['medium-list'].append({
            'position': '2',
            'track-list': second_track_list,
        })

        d = mb.album_info(release)
        self.assertEqual(d.mediums, 2)
        t = d.tracks
        self.assertEqual(t[0].medium, 1)
        self.assertEqual(t[0].medium_index, 1)
        self.assertEqual(t[1].medium, 2)
        self.assertEqual(t[1].medium_index, 1)
Ejemplo n.º 20
0
 def test_parse_disambig(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.albumdisambig,
                      'RG_DISAMBIGUATION, R_DISAMBIGUATION')
Ejemplo n.º 21
0
 def test_parse_status(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.albumstatus, 'STATUS')
Ejemplo n.º 22
0
 def test_parse_catalognum(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.catalognum, 'CATALOG NUMBER')
Ejemplo n.º 23
0
 def test_missing_language(self):
     release = self._make_release(None)
     del release['text-representation']['language']
     d = mb.album_info(release)
     self.assertEqual(d.language, None)
Ejemplo n.º 24
0
 def test_parse_releasegroupid(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.releasegroup_id, 'RELEASE GROUP ID')
Ejemplo n.º 25
0
 def test_parse_asin(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.asin, 'ALBUM ASIN')
Ejemplo n.º 26
0
 def test_parse_textrepr(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.script, 'SCRIPT')
     self.assertEqual(d.language, 'LANGUAGE')
Ejemplo n.º 27
0
 def test_data_source(self):
     release = self._make_release()
     d = mb.album_info(release)
     self.assertEqual(d.data_source, 'MusicBrainz')
Ejemplo n.º 28
0
 def test_parse_status(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.albumstatus, 'STATUS')
Ejemplo n.º 29
0
 def test_parse_disambig(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.albumdisambig,
                      'RG_DISAMBIGUATION, R_DISAMBIGUATION')
Ejemplo n.º 30
0
 def test_parse_textrepr(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.script, 'SCRIPT')
     self.assertEqual(d.language, 'LANGUAGE')
Ejemplo n.º 31
0
 def test_parse_asin(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.asin, 'ALBUM ASIN')
Ejemplo n.º 32
0
 def test_parse_artist_sort_name(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.artist_sort, 'ARTIST SORT NAME')
Ejemplo n.º 33
0
 def test_parse_country(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.country, 'COUNTRY')
Ejemplo n.º 34
0
 def test_parse_artist_sort_name(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.artist_sort, 'ARTIST SORT NAME')
Ejemplo n.º 35
0
 def test_parse_release_full_date(self):
     release = self._make_release('1987-03-31')
     d = mb.album_info(release)
     self.assertEqual(d.original_year, 1987)
     self.assertEqual(d.original_month, 3)
     self.assertEqual(d.original_day, 31)
Ejemplo n.º 36
0
 def test_parse_release_type(self):
     release = self._make_release('1984')
     d = mb.album_info(release)
     self.assertEqual(d.albumtype, 'album')
Ejemplo n.º 37
0
 def test_detect_various_artists(self):
     release = self._make_release(None)
     release['artist-credit'][0]['artist']['id'] = \
         mb.VARIOUS_ARTISTS_ID
     d = mb.album_info(release)
     self.assertTrue(d.va)
Ejemplo n.º 38
0
 def test_parse_release_year_month_only(self):
     release = self._make_release('1987-03')
     d = mb.album_info(release)
     self.assertEqual(d.original_year, 1987)
     self.assertEqual(d.original_month, 3)
Ejemplo n.º 39
0
 def test_parse_releasegroupid(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.releasegroup_id, 'RELEASE GROUP ID')
Ejemplo n.º 40
0
 def test_no_durations(self):
     tracks = [self._make_track('TITLE', 'ID', None)]
     release = self._make_release(tracks=tracks)
     d = mb.album_info(release)
     self.assertEqual(d.tracks[0].length, None)
Ejemplo n.º 41
0
 def test_parse_catalognum(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.catalognum, 'CATALOG NUMBER')
Ejemplo n.º 42
0
 def test_track_length_overrides_recording_length(self):
     tracks = [self._make_track('TITLE', 'ID', 1.0 * 1000.0)]
     release = self._make_release(tracks=tracks, track_length=2.0 * 1000.0)
     d = mb.album_info(release)
     self.assertEqual(d.tracks[0].length, 2.0)
Ejemplo n.º 43
0
 def test_parse_country(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertEqual(d.country, 'COUNTRY')
Ejemplo n.º 44
0
 def test_missing_language(self):
     release = self._make_release(None)
     del release['text-representation']['language']
     d = mb.album_info(release)
     self.assertEqual(d.language, None)
Ejemplo n.º 45
0
 def test_parse_media(self):
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(None, tracks=tracks)
     d = mb.album_info(release)
     self.assertEqual(d.media, 'FORMAT')
Ejemplo n.º 46
0
 def test_detect_various_artists(self):
     release = self._make_release(None)
     release['artist-credit'][0]['artist']['id'] = \
         mb.VARIOUS_ARTISTS_ID
     d = mb.album_info(release)
     self.assertTrue(d.va)
Ejemplo n.º 47
0
 def test_no_release_date(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertFalse(d.original_year)
     self.assertFalse(d.original_month)
     self.assertFalse(d.original_day)
Ejemplo n.º 48
0
 def test_parse_media(self):
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(None, tracks=tracks)
     d = mb.album_info(release)
     self.assertEqual(d.media, 'FORMAT')
Ejemplo n.º 49
0
 def test_various_artists_defaults_false(self):
     release = self._make_release(None)
     d = mb.album_info(release)
     self.assertFalse(d.va)
Ejemplo n.º 50
0
 def test_no_skip_dvd_audio(self):
     tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),
               self._make_track('TITLE TWO', 'ID TWO', 200.0 * 1000.0)]
     release = self._make_release(tracks=tracks, medium_format="DVD-Audio")
     d = mb.album_info(release)
     self.assertEqual(len(d.tracks), 2)