Добавил параметры дополнения
parent
2a740d818e
commit
48583b6bee
|
@ -4,7 +4,7 @@ from math import ceil
|
||||||
import xbmc, xbmcplugin, xbmcaddon, xbmcgui
|
import xbmc, xbmcplugin, xbmcaddon, xbmcgui
|
||||||
import urlparse
|
import urlparse
|
||||||
import urllib2
|
import urllib2
|
||||||
from urllib import urlencode
|
from urllib import urlencode, urlopen
|
||||||
import re
|
import re
|
||||||
|
|
||||||
_VERSION = '0.0.1'
|
_VERSION = '0.0.1'
|
||||||
|
@ -18,12 +18,21 @@ _addon_path = _addon.getAddonInfo('path').decode('utf-8')
|
||||||
_APP_ID = '4353740'
|
_APP_ID = '4353740'
|
||||||
_SCOPE = 'friends,photos,audio,video,groups,messages,offline'
|
_SCOPE = 'friends,photos,audio,video,groups,messages,offline'
|
||||||
|
|
||||||
_SETTINGS_TOKEN = 'vk_token'
|
|
||||||
|
_SETTINGS_ID_TOKEN = 'vk_token'
|
||||||
|
_SETTINGS_ID_MAX_RES = 'video_resolution'
|
||||||
|
_SETTINGS_ID_VIDEO_SEARCH_SORT = 'v_search_sort'
|
||||||
|
_SETTINGS_ID_VIDEO_SEARCH_HD = 'search_hd_video'
|
||||||
|
_SETTINGS_ID_VIDEO_SEARCH_ADULT = 'search_adult_video'
|
||||||
|
|
||||||
|
_SETTINGS_BOOL = {'true': 1, 'false': 0}
|
||||||
|
_SETTINGS_INV_BOOL = {'true': 0, 'false': 1}
|
||||||
|
|
||||||
_SETTINGS_PAGE_ITEMS = 20
|
_SETTINGS_PAGE_ITEMS = 20
|
||||||
_SETTINGS_MAX_RES = 1080
|
_SETTINGS_MAX_RES = int(_addon.getSetting(_SETTINGS_ID_MAX_RES))
|
||||||
_SETTINGS_VIDEO_SEARCH_SORT = 2
|
_SETTINGS_VIDEO_SEARCH_SORT = int(_addon.getSetting(_SETTINGS_ID_VIDEO_SEARCH_SORT))
|
||||||
_SETTINGS_VIDEO_SEARCH_HD = 0
|
_SETTINGS_VIDEO_SEARCH_HD = _SETTINGS_BOOL[_addon.getSetting(_SETTINGS_ID_VIDEO_SEARCH_HD)]
|
||||||
_SETTINGS_VIDEO_SEARCH_ADULT = 0
|
_SETTINGS_VIDEO_SEARCH_ADULT = _SETTINGS_INV_BOOL[_addon.getSetting(_SETTINGS_ID_VIDEO_SEARCH_ADULT)]
|
||||||
|
|
||||||
|
|
||||||
_FILE_VIDEO_SEARCH_HISTORY = _ADDON_NAME + '_vsh.pkl'
|
_FILE_VIDEO_SEARCH_HISTORY = _ADDON_NAME + '_vsh.pkl'
|
||||||
|
@ -865,7 +874,7 @@ class KodiVk:
|
||||||
item = xbmcgui.ListItem(name)
|
item = xbmcgui.ListItem(name)
|
||||||
xbmcplugin.addDirectoryItem(_addon_id, url, item, isFolder = True)
|
xbmcplugin.addDirectoryItem(_addon_id, url, item, isFolder = True)
|
||||||
def __connect_(self):
|
def __connect_(self):
|
||||||
token = _addon.getSetting(_SETTINGS_TOKEN)
|
token = _addon.getSetting(_SETTINGS_ID_TOKEN)
|
||||||
conn = Connection(_APP_ID, access_token = token)
|
conn = Connection(_APP_ID, access_token = token)
|
||||||
if not conn.conn._session.access_token:
|
if not conn.conn._session.access_token:
|
||||||
token = None
|
token = None
|
||||||
|
@ -876,7 +885,7 @@ class KodiVk:
|
||||||
try:
|
try:
|
||||||
conn = Connection(_APP_ID, login, password, scope = _SCOPE)
|
conn = Connection(_APP_ID, login, password, scope = _SCOPE)
|
||||||
token = conn.conn._session.access_token
|
token = conn.conn._session.access_token
|
||||||
_addon.setSetting(_SETTINGS_TOKEN, token)
|
_addon.setSetting(_SETTINGS_ID_TOKEN, token)
|
||||||
except vk.api.VkAuthError:
|
except vk.api.VkAuthError:
|
||||||
continue
|
continue
|
||||||
return conn
|
return conn
|
||||||
|
|
|
@ -72,6 +72,34 @@ msgctxt "#400516"
|
||||||
msgid "New Search"
|
msgid "New Search"
|
||||||
msgstr "[B]New Search[/B]"
|
msgstr "[B]New Search[/B]"
|
||||||
|
|
||||||
|
msgctxt "#400517"
|
||||||
|
msgid "Max video res"
|
||||||
|
msgstr "Max video resolution"
|
||||||
|
|
||||||
|
msgctxt "#400518"
|
||||||
|
msgid "Sort video search results by"
|
||||||
|
msgstr "Sort video search results by"
|
||||||
|
|
||||||
|
msgctxt "#400519"
|
||||||
|
msgid "v_search_sort_by_u_date"
|
||||||
|
msgstr "Upload date"
|
||||||
|
|
||||||
|
msgctxt "#400520"
|
||||||
|
msgid "v_search_sort_by_duration"
|
||||||
|
msgstr "Duration"
|
||||||
|
|
||||||
|
msgctxt "#400521"
|
||||||
|
msgid "v_search_sort_by_relevance"
|
||||||
|
msgstr "Relevance"
|
||||||
|
|
||||||
|
msgctxt "#400522"
|
||||||
|
msgid "Search only HD video"
|
||||||
|
msgstr "Search only HD video"
|
||||||
|
|
||||||
|
msgctxt "#400523"
|
||||||
|
msgid "Safe video search"
|
||||||
|
msgstr "Safe video search"
|
||||||
|
|
||||||
msgctxt "#400601"
|
msgctxt "#400601"
|
||||||
msgid "Previous page"
|
msgid "Previous page"
|
||||||
msgstr "[B]Previous page[/B]"
|
msgstr "[B]Previous page[/B]"
|
||||||
|
|
|
@ -72,6 +72,34 @@ msgctxt "#400516"
|
||||||
msgid "New Search"
|
msgid "New Search"
|
||||||
msgstr "[B]Новый поиск[/B]"
|
msgstr "[B]Новый поиск[/B]"
|
||||||
|
|
||||||
|
msgctxt "#400517"
|
||||||
|
msgid "Max video res"
|
||||||
|
msgstr "Макс. разрешение видео"
|
||||||
|
|
||||||
|
msgctxt "#400518"
|
||||||
|
msgid "Sort video search results by"
|
||||||
|
msgstr "Сортировать резултаты поиска видео по"
|
||||||
|
|
||||||
|
msgctxt "#400519"
|
||||||
|
msgid "v_search_sort_by_u_date"
|
||||||
|
msgstr "Дате добавления"
|
||||||
|
|
||||||
|
msgctxt "#400520"
|
||||||
|
msgid "v_search_sort_by_duration"
|
||||||
|
msgstr "Длительности"
|
||||||
|
|
||||||
|
msgctxt "#400521"
|
||||||
|
msgid "v_search_sort_by_relevance"
|
||||||
|
msgstr "Релевантности"
|
||||||
|
|
||||||
|
msgctxt "#400522"
|
||||||
|
msgid "Search only HD video"
|
||||||
|
msgstr "Искать только HD-видео"
|
||||||
|
|
||||||
|
msgctxt "#400523"
|
||||||
|
msgid "Safe video search"
|
||||||
|
msgstr "Безопасный поиск видеозаписей"
|
||||||
|
|
||||||
msgctxt "#400601"
|
msgctxt "#400601"
|
||||||
msgid "Previous page"
|
msgid "Previous page"
|
||||||
msgstr "[B]Предыдущая страница[/B]"
|
msgstr "[B]Предыдущая страница[/B]"
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
<settings>
|
<settings>
|
||||||
<setting id="vk_token" type="text" label="400507" default="" option="hidden" />
|
<setting id="vk_token" type="text" label="400507" default="" visible="false" />
|
||||||
|
<setting id="video_resolution" type="select" label="400517" default="1080" values="240|360|480|720|1080" />
|
||||||
|
<setting label="400518" type="enum" id="v_search_sort" default="2" lvalues="400519|400520|400521"/>
|
||||||
|
<setting label="400522" type="bool" id="search_hd_video" default="false"/>
|
||||||
|
<setting label="400523" type="bool" id="search_adult_video" default="true"/>
|
||||||
</settings>
|
</settings>
|
Loading…
Reference in New Issue