forked from enen92/program.plexus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.py
More file actions
191 lines (176 loc) · 5.23 KB
/
default.py
File metadata and controls
191 lines (176 loc) · 5.23 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# -*- coding: utf-8 -*-
#
# Plexus (c) 2015 enen92
#
# This file contains the main menu and the addon directory tree.
# All the necessary modules are present in ~/resources/plexus directory
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import urllib
import urllib2
import os
import re
import sys
import datetime
import time
import subprocess
import xbmcvfs
import socket
from resources.plexus.plexusutils.pluginxbmc import *
from resources.plexus import acestream as ace
from resources.plexus import sopcast as sop
from resources.plexus.autoconf import *
from resources.plexus.plexusutils.directoryhandle import addLink, addDir
from resources.plexus.advancedfunctions import *
from resources.plexus.resolver import go_to_id
from resources.plexus.acecore import stop_aceengine
from resources.plexus.history import *
from resources.plexus.mystreams import *
def main_menu():
addDir('[B]'+translate(30001)+'[/B]', MainURL, 10,
os.path.join(addonpath, art, 'mystreams.png'), 2, True)
if settings.getSetting('addon_history') == "true":
addDir('[B]'+translate(30002)+'[/B]', MainURL, 8,
os.path.join(addonpath, art, 'history.png'), 2, True)
if "confluence" in xbmc.getSkinDir():
addLink('', '', 'plexus')
addDir('[B][COLOR maroon]'+translate(30003)+'[/COLOR][/B]' + translate(30005),
MainURL, 4, os.path.join(addonpath, art, 'acestream-menu-item.png'), 1, False)
addDir('[B][COLOR maroon]'+translate(30003)+'[/COLOR][/B]' + translate(30006),
MainURL, 6, os.path.join(addonpath, art, 'acestream-menu-item.png'), 1, False)
addDir('[B][COLOR maroon]'+translate(30004)+'[/COLOR][/B]' + translate(30007),
MainURL, 3, os.path.join(addonpath, art, 'sopcast-menu-item.png'), 1, False)
addDir('[B][COLOR maroon]'+translate(30004)+'[/COLOR][/B]' + translate(30008),
MainURL, 5, os.path.join(addonpath, art, 'sopcast-menu-item.png'), 1, False)
#if "confluence" in xbmc.getSkinDir(): addLink('','','plexus')
#addDir('[B][COLOR maroon]' + translate(40057) + '[/COLOR][/B]',MainURL,300,os.path.join(addonpath,art,'settings.png'),2,True)
# break_sopcast is a function used in windows to intentionally break the
# sopcast.exe setup by renaming one of its codec files. It's ran here to
# rename the file again in case it failed when played before
sop.break_sopcast()
# Addon tree is below
def get_params():
param = []
paramstring = sys.argv[2]
if len(paramstring) >= 2:
params = sys.argv[2]
cleanedparams = params.replace('?', '')
if (params[len(params)-1] == '/'):
params = params[0:len(params)-2]
pairsofparams = cleanedparams.split('&')
param = {}
for i in range(len(pairsofparams)):
splitparams = {}
splitparams = pairsofparams[i].split('=')
if (len(splitparams)) == 2:
param[splitparams[0]] = splitparams[1]
return param
params = get_params()
url = None
name = None
mode = None
iconimage = None
parser = None
parserfunction = None
try:
url = urllib.unquote_plus(params["url"])
except:
pass
try:
name = urllib.unquote_plus(params["name"])
except:
pass
try:
mode = int(params["mode"])
except:
pass
try:
regexs = params["regexs"]
except:
pass
try:
iconimage = urllib.unquote_plus(params["iconimage"])
except:
pass
try:
parser = urllib.unquote_plus(params["parser"])
except:
pass
try:
parserfunction = params["parserfunction"]
except:
pass
print("Mode: "+str(mode))
print("URL: "+str(url))
print("Name: "+str(name))
print("Iconimage: "+str(iconimage))
print("Parser: "+str(parser))
print("Parserfunction: "+str(parserfunction))
# from 1-99 functions related to the addon menu functions
if mode == None:
print("Installed version: v" + versao)
if settings.getSetting('autoconfig') == "true":
first_conf()
else:
if settings.getSetting('last_version_check') != versao:
try:
check_for_updates()
except:
pass
main_menu()
elif mode == 1:
ace.acestreams(name, iconimage, url)
elif mode == 2:
sop.sopstreams(name, iconimage, url)
elif mode == 3:
go_to_id('sop_id')
elif mode == 4:
go_to_id('ace')
elif mode == 5:
go_to_id('sop_url')
elif mode == 6:
ace.load_local_torrent()
elif mode == 7:
stop_aceengine()
elif mode == 8:
list_history()
elif mode == 9:
remove_history()
elif mode == 10:
my_streams_menu()
elif mode == 11:
add_stream()
elif mode == 12:
add_stream(name, url, iconimage)
elif mode == 13:
remove_stream(name, url)
# from 300-399 Advanced functions
elif mode == 300:
advanced_menu()
elif mode == 301:
import_advancedxml()
elif mode == 302:
recoverbackup_advancedxml()
elif mode == 303:
backup_advancedxml()
elif mode == 304:
delete_advancedxml()
elif mode == 305:
set_engine_setting(url)
elif mode == 306:
remove_lock()
elif mode == 307:
clear_cache(url)
elif mode == 308:
set_linux_engine_setting(url)
elif mode == 309:
set_acestream_engine_cache_folder(url)
elif mode == 310:
shutdown_hooks()
elif mode == 311:
set_android_port()
elif mode == 312:
set_android_cache_aloc()
xbmcplugin.endOfDirectory(int(sys.argv[1]))