~nikolai/picard/plugins

« back to all changes in this revision

Viewing changes to contrib/plugins/SearchAMG.py

  • Committer: Nikolai Prokoschenko
  • Date: 2009-01-06 17:02:13 UTC
  • Revision ID: nikolai@prokoschenko.de-20090106170213-g2m4x41p0x4d4mmf
add all plugins from the wiki

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
PLUGIN_NAME = u"Search AMG"
 
4
PLUGIN_AUTHOR = u"Brian Schweitzer"
 
5
PLUGIN_DESCRIPTION = "Search AMG"
 
6
PLUGIN_VERSION = "0.1"
 
7
PLUGIN_API_VERSIONS = ["0.9.0"]
 
8
 
 
9
from PyQt4 import QtCore
 
10
from picard.cluster import Cluster
 
11
from picard.util import webbrowser2
 
12
from picard.ui.itemviews import BaseAction, register_cluster_action
 
13
from picard.ui.itemviews import BaseAction, register_album_action
 
14
from picard.ui.itemviews import BaseAction, register_file_action
 
15
from picard.metadata import register_track_metadata_processor
 
16
 
 
17
class SearchAMGR(BaseAction):
 
18
    NAME = "Search AMG for Release"
 
19
    def callback(self, objs):
 
20
        cluster = objs[0]
 
21
        url = "http://wc10.allmusic.com/cg/amg.dll?P=amg&opt1=2&sql="
 
22
        url += QtCore.QUrl.toPercentEncoding(cluster.metadata["album"])
 
23
        webbrowser2.open(url)
 
24
register_cluster_action(SearchAMGR())
 
25
register_album_action(SearchAMGR())
 
26
 
 
27
class SearchAMGA(BaseAction):
 
28
    NAME = "Search AMG for Artist"
 
29
    def callback(self, objs):
 
30
        cluster = objs[0]
 
31
        url = "http://wc09.allmusic.com/cg/amg.dll?P=amg&opt1=1&sql="
 
32
        url += QtCore.QUrl.toPercentEncoding(cluster.metadata["artist"])
 
33
        webbrowser2.open(url)
 
34
register_cluster_action(SearchAMGA())
 
35
register_album_action(SearchAMGA())
 
36
 
 
37
class SearchAMGT(BaseAction):
 
38
    NAME = "Search AMG for Track"
 
39
    def callback(self, objs):
 
40
        file = objs[0]
 
41
        url = "http://wc10.allmusic.com/cg/amg.dll?P=amg&opt1=3&sql="
 
42
        url += QtCore.QUrl.toPercentEncoding(file.metadata["title"])
 
43
        webbrowser2.open(url)
 
44
register_file_action(SearchAMGT())
 
 
b'\\ No newline at end of file'