forked from brianfreud/Picard-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchDiscogs3.py
26 lines (23 loc) · 984 Bytes
/
SearchDiscogs3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
PLUGIN_NAME = u"Search Discogs for Release"
PLUGIN_AUTHOR = u"Brian Schweitzer"
PLUGIN_DESCRIPTION = "Search Discogs"
PLUGIN_VERSION = "0.2"
PLUGIN_API_VERSIONS = ["0.9.0", "0.10","0.11","0.12","0.13","0.14","0.15","0.16"]
from PyQt4 import QtCore
from picard.cluster import Cluster
from picard.util import webbrowser2
from picard.ui.itemviews import BaseAction, register_cluster_action
from picard.ui.itemviews import BaseAction, register_album_action
class SearchDiscogs(BaseAction):
NAME = "Search Discogs"
def callback(self, objs):
cluster = objs[0]
url = "http://www.discogs.com/search?type=all&q="
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
url += "+"
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
url += "&btn=Search"
webbrowser2.open(url)
register_cluster_action(SearchDiscogs())
register_album_action(SearchDiscogs())