Created
January 28, 2013 15:50
-
-
Save Shchvova/4656632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<addon id="xbmc-vk.svoka.com" name="VK-xbmc" version="0.8.1" provider-name="shchvova"> | |
<requires> | |
<import addon="xbmc.python" version="2.0"/> | |
</requires> | |
<extension point="xbmc.python.pluginsource" provides="image, audio, video" library="default.py"> | |
<provides>image video audio</provides> | |
</extension> | |
<extension point="xbmc.addon.metadata"> | |
<summary lang="en">Video, audio and photos from VKontakte social network http://vkontakte.ru/</summary> | |
<description lang="en">Video from VKontakte social network http://vkontakte.ru/ | |
homepage - http://code.svoka.com/vk-xbmc-plugin | |
Author - Vlad Svoka aka Shchvova</description> | |
<summary lang="ru">Видео с сайта http://vkontakte.ru/</summary> | |
<description lang="ru">Видео, аудио и фотографии с сайта http://vkontakte.ru/ | |
Домашняя страница проекта - http://code.svoka.com/vk-xbmc-plugin | |
Автор - Влад Свока aka Shchvova</description> | |
<platform>all</platform> | |
</extension> | |
</addon> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# VK-XBMC add-on | |
# Copyright (C) 2011 Volodymyr Shcherban | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
__author__ = 'Volodymyr Shcherban' | |
import sys, os, xbmcaddon, xbmc, xbmcgui, xbmcplugin, urllib | |
from vkapp import GetApi, authUrlFile | |
from xbmcvkui import HOME | |
from xvaudio import XVKAudio | |
from xvimage import XVKImage | |
from xvvideo import XVKVideo | |
class XBMC_VK_UI_Factory: | |
def GetUI(self, param, api, handle): | |
#bloody hacks http://wiki.xbmc.org/index.php?title=Window_IDs | |
id = xbmcgui.getCurrentWindowId() | |
if id in (10006,10024,10025,10028): | |
return XVKAudio(param, handle, api) | |
elif id in (10005,10500,10501,10502): | |
return XVKAudio(param, handle, api) | |
elif id in (10002,): | |
return XVKImage(param, handle, api) | |
else: | |
print "Invalid context: " + id | |
def Main(): | |
globHandle = int(sys.argv[1]) | |
globApi = GetApi() | |
if globApi: | |
params = {"mode" : HOME} | |
if sys.argv[2]: | |
l = [s.split("=") for s in sys.argv[2][1:].split("&")] | |
l = map(lambda e: (e[0], urllib.unquote_plus(e[1])) , l) | |
params.update(dict(l)) | |
ui = XBMC_VK_UI_Factory().GetUI(params,globApi, globHandle) | |
else: | |
listItem = xbmcgui.ListItem("-- something wrong, try again --") | |
xbmcplugin.addDirectoryItem(globHandle, sys.argv[0], listItem, True) | |
xbmc.log("THIS IS THE END") | |
raise Exception("Api is null") | |
try: | |
Main() | |
except Exception, e: | |
xbmc.log("CAUGHT ERROR" + str(e)) | |
if os.path.isfile(authUrlFile): | |
os.remove(authUrlFile) | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment