Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[c72b56]: plugin.video.gamestar / default.py Maximize Restore History

Download this file

default.py    70 lines (61 with data), 2.3 kB

 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
#-------------LicenseHeader--------------
# plugin.video.gamestar - Downloads/view videos from gamestar.de
# Copyright (C) 2010 Raptor 2101 [raptor2101@gmx.de]
#
# 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/>.
import os,xbmcgui,urllib,urllib2,re,xbmcaddon;
from gamestar import GamestarWeb
from simplexbmc import SimpleXbmcGui;
def get_params():
""" extract params from argv[2] to make a dict (key=value) """
paramDict = {}
try:
print "get_params() argv=", sys.argv
if sys.argv[2]:
paramPairs=sys.argv[2][1:].split( "&" )
for paramsPair in paramPairs:
paramSplits = paramsPair.split('=')
if (len(paramSplits))==2:
paramDict[paramSplits[0]] = paramSplits[1]
except:
errorOK()
return paramDict
__settings__ = xbmcaddon.Addon(id='plugin.video.gamestar')
rootPath = __settings__.getAddonInfo('path');
archivePath = __settings__.getSetting('path');
if(archivePath == ""):
archivePath = None;
gui = SimpleXbmcGui(archivePath);
webSite=GamestarWeb(gui);
gui.openMenuContext();
params=get_params()
action=params.get("action", "")
cat=int(params.get("cat", 0))
gui.log("action: "+action);
if(action == "list"):
forcedPrecaching = __settings__.getSetting(params.get("cat", 0));
forcedPrecaching = archivePath is not None and (forcedPrecaching == '1' or forcedPrecaching == '3')
category = webSite.categories[cat];
webSite.builCategoryMenu(category,forcedPrecaching);
elif(action == "download"):
gui.download(params.get("url", ""));
gui.refresh();
elif(action == "downloadPlay"):
mediaPath = gui.download(params.get("url", ""));
gui.play(mediaPath);
gui.refresh();
else:
webSite.buildCategoryMenu();
gui.closeMenuContext();