forked from PseudoTV/PseudoTV_Live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utilities.py
131 lines (121 loc) · 4.61 KB
/
utilities.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
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
# Copyright (C) 2015 Kevin S. Graer
#
#
# This file is part of PseudoTV Live.
#
# PseudoTV 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.
#
# PseudoTV 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 PseudoTV Live. If not, see <http://www.gnu.org/licenses/>.
import xbmc, xbmcgui, xbmcaddon, xbmcvfs
import os, sys, time, urllib
from resources.lib.Globals import *
from resources.lib.utils import *
def showInfo(addonID=None, type='changelog'):
log('utilities: showInfo')
try:
if addonID:
ADDON = xbmcaddon.Addon(addonID)
else:
ADDON = xbmcaddon.Addon(ADDONID)
if type == 'changelog':
title = "PseudoTV Live - Changelog"
f = open(ADDON.getAddonInfo('changelog'))
elif type == 'readme':
title = "PseudoTV Live - Readme"
f = open(os.path.join(ADDON_PATH,'README.md'))
elif type == 'disclaimer':
title = "PseudoTV Live - Privacy Disclaimer"
f = open(os.path.join(ADDON_PATH,'disclaimer'))
elif type == 'settings':
title = "PseudoTV Live - User Settings"
f = open(os.path.join(ADDON_PATH,'settings'))
text = f.read()
f.close()
textViewer(text, title)
except:
pass
def DeleteSettings2():
log('utilities: DeleteSettings2')
ClearChanFavorites(False)
if xbmcvfs.exists(SETTINGS_FLE):
if yesnoDialog("Delete Current Channel Configurations?"):
try:
REAL_SETTINGS.setSetting("CurrentChannel","1")
xbmcvfs.delete(SETTINGS_FLE)
infoDialog("Channel Configurations Cleared")
except:
pass
# Return to PTVL Settings
REAL_SETTINGS.openSettings()
def addBypass():
try:
from resources.lib.ChannelList import ChannelList
chnlst = ChannelList()
chnlst.fillPluginList()
BYPASS_LST = matchMselect(chnlst.pluginList[1], mselectDialog(chnlst.pluginList[0], header='Disable Seeking for specified Plugins'))
REAL_SETTINGS.setSetting("BYPASS_LST",str(BYPASS_LST))
except:
Unavailable()
def ClearTempKey():
log('utilities: ClearTempKey')
def ClearChanFavorites(close=True):
log('utilities: ClearChanFavorites')
REAL_SETTINGS.setSetting("FavChanLst","0")
infoDialog("Channel Favourites Cleared")
if close == True:
# Return to PTVL Settings
REAL_SETTINGS.openSettings()
def showChtype():
log('utilities: showChtype')
ChtypeLst = ['General','Custom Playlist','TV Network','Movie Studio','TV Genre','Movie Genre','Mixed Genre','TV Show','Directory','LiveTV','InternetTV','Youtube','RSS','Music','Music Videos','Exclusive','Plugin','UPNP']
select = selectDialog(ChtypeLst, 'Select Channel Type')
if select != -1:
help(ChtypeLst[select])
def EGIntro():
log('utilities: EGIntro')
for e in range(len(EG_ALL)):
egTrigger('PseudoTV_Live - ' + EG_ALL[e])
infoDialog("Eventghost Broadcast Complete")
if sys.argv[1] == '-SimpleDownloader':
xbmcaddon.Addon(id='script.module.simple.downloader').openSettings()
elif sys.argv[1] == '-showChangelog':
showInfo(ADDON_ID, 'changelog')
elif sys.argv[1] == '-showReadme':
showInfo(ADDON_ID, 'readme')
elif sys.argv[1] == '-showUserSettings':
showInfo(ADDON_ID, 'settings')
elif sys.argv[1] == '-showChtype':
showChtype()
elif sys.argv[1] == '-showDisclaimer':
showInfo(ADDON_ID, 'disclaimer')
elif sys.argv[1] == '-DeleteSettings2':
DeleteSettings2()
elif sys.argv[1] == '-backupSettings2':
backupSettings2()
elif sys.argv[1] == '-restoreSettings2':
restoreSettings2()
elif sys.argv[1] == '-purgeSettings2':
purgeSettings2()
elif sys.argv[1] == '-repairSettings2':
from resources.lib.Settings import *
Setfun = Settings()
Setfun.repairSettings()
elif sys.argv[1] == '-ClearTempKey':
ClearTempKey()
elif sys.argv[1] == '-EGIntro':
EGIntro()
elif sys.argv[1] == '-ClearChanFavorites':
ClearChanFavorites()
elif sys.argv[1] == '-YTDownloader':
xbmcaddon.Addon(id='script.module.youtube.dl').openSettings()
elif sys.argv[1] == '-BYPASS_SEEK':
addBypass()