Skip to content

Instantly share code, notes, and snippets.

@IzumiSy
Created April 4, 2014 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IzumiSy/9966572 to your computer and use it in GitHub Desktop.
Save IzumiSy/9966572 to your computer and use it in GitHub Desktop.
Plugin for radiotray
[RadioTrayPlugin]
name=Website Jumper
desc=Open the website of the current radio
script=WebsiteJumper.py
class=WebsiteJumper
author=Seiya IZUMI
from events.EventSubscriber import EventSubscriber
from events.EventManager import EventManager
from Plugin import Plugin
import webbrowser
class WebsiteJumper(Plugin):
# 初期化時に実行される関数
def __init__(self):
super(WebsiteJumper, self).__init__()
# 何に使うのかはわからないが必要らしい
def getName(self):
return self.name
# プラグインの設定から有効化されたときに実行される関数
def activate(self):
# SONG_CHANGEDにフックする関数を登録
self.eventSubscriber.bind(EventManager.SONG_CHANGED, self.on_song_changed)
# プラグインメニューに登録
self.tooltip.addSource(self.def_tooltip)
# プラグインのメニューに表示するために必要な関数
def hasMenuItem(self):
return True
# メニューに登録する名前を返す
def def_tooltip(self):
return "Website Jumper"
# SONG_CHANGEDにフックされる関数
def on_song_changed(self, data):
global location
if ('location' in data.keys()):
location = data['location']
# メニューから選択された場合の処理
def on_menu(self, data):
print "[WebsiteJumper] open %s" % (location)
webbrowser.open(location)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment