A plugin to use tango.info with MusicBrainz picard
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

#!/bin/env python2
# -*- coding: utf-8 -*-
# To run this:
# - Disable these two calls in tangoinfo.py:
# from picard.metadata import register_track_metadata_processor
# register_track_metadata_processor(TangoInfoTagger().add_tangoinfo_data)
# - Fix path:
# import sys
# sys.path.insert(0, '/usr/lib/picard')
# Messing around:
#
# class Metadata():
# @staticmethod
# def register_track_metadata_processor(dummy):
# return True
#
# import picard
# picard.metadata = Metadata()
import tangoinfo
try:
from urllib.request import urlopen # python3
except ImportError:
from urllib2 import urlopen # python2
# Test album:
# http://musicbrainz.org/release/65617e20-d445-41a3-a476-9868e6154317
# Barcode: 7798145106390
# tango.info: https://tango.info/07798145106390
# Metadata:
# 23 tracks, genre and performance date given but no vocalists
def test_barcode_process_metadata():
taggerclass = tangoinfo.TangoInfoTagger()
barcode = '7798145106390'
url = 'https://tango.info/07798145106390'
page = urlopen(url).read()
albuminfo = taggerclass.barcode_process_metadata(barcode, page)
assert albuminfo['07798145106390-1-19'].get('date') == u'1937-12-09'
assert len(albuminfo.keys()) == 23
#if __name__ == '__main__':
# test_barcode_process_metadata()