forked from brianfreud/Picard-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchAmazon3.py
86 lines (77 loc) · 3.37 KB
/
SearchAmazon3.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- coding: utf-8 -*-
PLUGIN_NAME = u"Search Amazon for Release"
PLUGIN_AUTHOR = u"Brian Schweitzer"
PLUGIN_DESCRIPTION = "Search Amazon"
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_album_action
from picard.ui.itemviews import BaseAction, register_cluster_action
class SearchAmazonCA(BaseAction):
NAME = "Search Amazon.ca"
def callback(self, objs):
cluster = objs[0]
url = "http://www.amazon.ca/s/?url=search-alias%3Dpopular&field-keywords="
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
url += " "
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
webbrowser2.open(url)
register_cluster_action(SearchAmazonCA())
register_album_action(SearchAmazonCA())
class SearchAmazonCOM(BaseAction):
NAME = "Search Amazon.com"
def callback(self, objs):
cluster = objs[0]
url = "http://www.amazon.com/s/?url=search-alias%3Dpopular&field-keywords="
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
url += " "
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
webbrowser2.open(url)
register_cluster_action(SearchAmazonCOM())
register_album_action(SearchAmazonCOM())
class SearchAmazonDE(BaseAction):
NAME = "Search Amazon.de"
def callback(self, objs):
cluster = objs[0]
url = "http://www.amazon.de/s/?url=search-alias%3Dpopular&field-keywords="
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
url += " "
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
webbrowser2.open(url)
register_cluster_action(SearchAmazonDE())
register_album_action(SearchAmazonDE())
class SearchAmazonFR(BaseAction):
NAME = "Search Amazon.fr"
def callback(self, objs):
cluster = objs[0]
url = "http://www.amazon.fr/s/?url=search-alias%3Dpopular&field-keywords="
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
url += " "
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
webbrowser2.open(url)
register_cluster_action(SearchAmazonFR())
register_album_action(SearchAmazonFR())
class SearchAmazonJP(BaseAction):
NAME = "Search Amazon.jp"
def callback(self, objs):
cluster = objs[0]
url = "http://www.amazon.jp/s/?url=search-alias%3Dpopular&field-keywords="
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
url += " "
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
webbrowser2.open(url)
register_cluster_action(SearchAmazonJP())
register_album_action(SearchAmazonJP())
class SearchAmazonUK(BaseAction):
NAME = "Search Amazon.co.uk"
def callback(self, objs):
cluster = objs[0]
url = "http://www.amazon.co.uk/s/?url=search-alias%3Dpopular&field-keywords="
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
url += " "
url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
webbrowser2.open(url)
register_cluster_action(SearchAmazonUK())
register_album_action(SearchAmazonUK())