-
Notifications
You must be signed in to change notification settings - Fork 0
/
movietrailer.py
44 lines (36 loc) · 1.1 KB
/
movietrailer.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
__kupfer_name__ = _("MovieTrailer")
__kupfer_actions__ = ("MovieTrailer", )
__description__ = _("Search MovieTrailer")
__version__ = "2020-1"
__author__ = "thorko"
import http.client
import urllib.parse
from kupfer.obj import Action, TextLeaf
from kupfer import launch, plugin_support, config
_ALTERNATIVES = (
"german",
"english",
"spanish",
)
__kupfer_settings__ = plugin_support.PluginSettings(
{
"key": "language",
"label": _("Your language for the trailer"),
"type": str,
"value": "german",
"alternatives": _ALTERNATIVES,
}
)
class MovieTrailer (Action):
def __init__(self):
Action.__init__(self, _("Trailer"))
def activate(self, leaf):
language = __kupfer_settings__["language"]
query_url = "https://www.youtube.com/results?search_query=" + leaf.object + "+trailer+" + language
launch.show_url(query_url)
def item_types(self):
yield TextLeaf
def get_description(self):
return __description__
def get_icon_name(self):
return "gtk-execute"