Topic: Picard Plugin to search for AcoustID

Hello
I have played around with the Lookup PUID Pluing an changed it a little bit to lookup for AcoustID.

# -*- coding: utf-8 -*-

PLUGIN_NAME = u"Lookup AcoustID"
PLUGIN_AUTHOR = u"WPME Hofland"
PLUGIN_DESCRIPTION = "Show all releases that contains a track with the generated acoustid"
PLUGIN_VERSION = "0.1"
PLUGIN_API_VERSIONS = ["0.15"]

from PyQt4 import QtCore, QtGui, Qt
from picard.util import webbrowser2
from picard.ui.itemviews import BaseAction, register_file_action
from picard.metadata import register_track_metadata_processor

class SearchAcoustID(BaseAction):
    NAME = "Lookup AcoustID"
    def callback(self, objs):
        file = objs[0]
        url = "http://acoustid.org/track/"
        url += QtCore.QUrl.toPercentEncoding(file.metadata["acoustid_id"])
        if len(file.metadata["acoustid_id"]) > 1:
            webbrowser2.open(url)
        else:
            global ACID
            ACID = NoAcoustid()
            ACID.show()
register_file_action(SearchAcoustID())

class NoAcoustid(QtGui.QDialog):
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowTitle(_("No Acoustid found"))
        self.doc = QtGui.QTextDocument(self)
        self.textCursor = QtGui.QTextCursor(self.doc)
        font = QtGui.QFont()
        font.setFixedPitch(True)
        font.setPointSize(8)
        font.setWeight(QtGui.QFont.Normal)
        font.setFamily("")
        self.textFormat = QtGui.QTextCharFormat()
        self.textFormat.setFont(font)
        self.browser = QtGui.QTextBrowser(self)
        self.browser.setDocument(self.doc)
        vbox = QtGui.QHBoxLayout(self)
        vbox.addWidget(self.browser)     
        self.textCursor.insertText("No Acoustid tag. Please scan first.", self.textFormat)
        self.textCursor.insertBlock()

ACID = NoAcoustid()

Well, it works more or less good... If the files are unmatched or clusterd, the Browser opens the AcoustID page, but if the Files are matched to a release it doesn't work.
(same in the Original Lookup PUID Plugin)
Is there a way to get this to work with matched files?

Note:
Most of my Files have a saved AcoustID tag from Jaikoz

Greetings
MartDann

Re: Picard Plugin to search for AcoustID

You can try registering a track action (register_track_action) to add a right click hook for a track but since the acoustid is a property of the file rather than the track, it'll probably not be immediately available to you on the track. You might need to navigate to the matched files from the track (track.linked_files or track.iterfiles()).