def tvarchive(name, description): days = 7 now = str(datetime.datetime.now()).replace('-', '').replace(':', '').replace( ' ', '') date3 = datetime.datetime.now() - datetime.timedelta(days) date = str(date3) date = str(date).replace('-', '').replace(':', '').replace(' ', '') APIv2 = base64.b64decode( "JXM6JXMvcGxheWVyX2FwaS5waHA/dXNlcm5hbWU9JXMmcGFzc3dvcmQ9JXMmYWN0aW9uPWdldF9zaW1wbGVfZGF0YV90YWJsZSZzdHJlYW1faWQ9JXM=" ) % (user.host(), user.port, username, password, description) link = tools.OPEN_URL(APIv2) match = re.compile( '"title":"(.+?)".+?"start":"(.+?)","end":"(.+?)","description":"(.+?)"' ).findall(link) for ShowTitle, start, end, DesC in match: ShowTitle = base64.b64decode(ShowTitle) DesC = base64.b64decode(DesC) format = '%Y-%m-%d %H:%M:%S' try: modend = dtdeep.strptime(end, format) modstart = dtdeep.strptime(start, format) except: modend = datetime.datetime(*(time.strptime(end, format)[0:6])) modstart = datetime.datetime(*(time.strptime(start, format)[0:6])) StreamDuration = modend - modstart modend_ts = time.mktime(modend.timetuple()) modstart_ts = time.mktime(modstart.timetuple()) FinalDuration = int(modend_ts - modstart_ts) / 60 strstart = start Realstart = str(strstart).replace('-', '').replace(':', '').replace(' ', '') start2 = start[:-3] editstart = start2 start2 = str(start2).replace(' ', ' - ') start = str(editstart).replace(' ', ':') Editstart = start[:13] + '-' + start[13:] Finalstart = Editstart.replace('-:', '-') if Realstart > date: if Realstart < now: catchupURL = base64.b64decode( "JXM6JXMvc3RyZWFtaW5nL3RpbWVzaGlmdC5waHA/dXNlcm5hbWU9JXMmcGFzc3dvcmQ9JXMmc3RyZWFtPSVzJnN0YXJ0PQ==" ) % (user.host(), user.port, username, password, description) ResultURL = catchupURL + str( Finalstart) + "&duration=%s" % (FinalDuration) kanalinimi = "[COLOR white]%s[/COLOR] - %s" % (start2, ShowTitle) tools.addDir(kanalinimi, ResultURL, 4, icon, fanart, DesC)
def correctPVR(): addon = xbmcaddon.Addon(user.id) username_text = addon.getSetting(id='Username') password_text = addon.getSetting(id='Password') jsonSetPVR = '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"pvrmanager.enabled", "value":true},"id":1}' IPTVon = '{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","params":{"addonid":"pvr.iptvsimple","enabled":true},"id":1}' nulldemo = '{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","params":{"addonid":"pvr.demo","enabled":false},"id":1}' loginurl = user.host()+':'+user.port+"/get.php?username="******"&password="******"&type=m3u_plus&output=ts" EPGurl = user.host()+':'+user.port+"/xmltv.php?username="******"&password="******"false") moist.setSetting(id='epgCache', value="false") xbmc.executebuiltin("Container.Refresh")
def start(): if username == "": usern = userpopup() passw = passpopup() control.setSetting('Username', usern) control.setSetting('Password', passw) xbmc.executebuiltin('Container.Refresh') auth = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % ( user.host(), user.port, usern, passw) auth = tools.OPEN_URL(auth) if auth == "": line1 = "Incorrect Login Details" line2 = "Please Re-enter" line3 = "" xbmcgui.Dialog().ok('Attention', line1, line2, line3) start() else: line1 = "Login Sucsessfull" line2 = "Welcome to " + user.name line3 = ('[COLOR white]%s[/COLOR]' % usern) xbmcgui.Dialog().ok(user.name, line1, line2, line3) tvguidesetup() addonsettings('ADS2', '') xbmc.executebuiltin('Container.Refresh') home() else: auth = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % ( user.host(), user.port, username, password) auth = tools.OPEN_URL(auth) if not auth == "": tools.addDir('Account Information', 'url', 6, icon, fanart, '') tools.addDir('Live TV', 'live', 1, icon, fanart, '') tools.addDir('Catchup TV', 'url', 12, icon, fanart, '') if xbmc.getCondVisibility('System.HasAddon(pvr.iptvsimple)'): tools.addDir('TV Guide', 'pvr', 7, icon, fanart, '') tools.addDir('VOD', 'vod', 3, icon, fanart, '') tools.addDir('Search', 'url', 5, icon, fanart, '') tools.addDir('Settings', 'url', 8, icon, fanart, '') tools.addDir('Extras', 'url', 16, icon, fanart, '')
from datetime import date import xml.etree.ElementTree as ElementTree ################################# #############Defined Strings############# icon = xbmc.translatePath( os.path.join('special://home/addons/' + user.id, 'icon.png')) fanart = xbmc.translatePath( os.path.join('special://home/addons/' + user.id, 'fanart.jpg')) username = control.setting('Username') password = control.setting('Password') live_url = '%s:%s/enigma2.php?username=%s&password=%s&type=get_live_categories' % ( user.host(), user.port, username, password) vod_url = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories' % ( user.host(), user.port, username, password) panel_api = '%s:%s/panel_api.php?username=%s&password=%s' % ( user.host(), user.port, username, password) play_url = '%s:%s/live/%s/%s/' % (user.host(), user.port, username, password) Guide = xbmc.translatePath( os.path.join( 'special://home/addons/addons/' + user.id + '/resources/catchup', 'guide.xml')) GuideLoc = xbmc.translatePath( os.path.join( 'special://home/addons/addons/' + user.id + '/resources/catchup', 'g')) advanced_settings = xbmc.translatePath('special://home/addons/' + user.id +
import xbmc,xbmcaddon,xbmcgui,xbmcplugin,base64,os,re,unicodedata,requests,time,string,sys,urllib,urllib2,json,urlparse,datetime,zipfile,shutil from resources.modules import client,control,tools,user from datetime import date import xml.etree.ElementTree as ElementTree ################################# #############Defined Strings############# icon = xbmc.translatePath(os.path.join('special://home/addons/' + user.id, 'icon.png')) fanart = xbmc.translatePath(os.path.join('special://home/addons/' + user.id , 'fanart.jpg')) username = control.setting('Username') password = control.setting('Password') live_url = '%s:%s/enigma2.php?username=%s&password=%s&type=get_live_categories'%(user.host(),user.port,username,password) vod_url = '%s:%s/enigma2.php?username=%s&password=%s&type=get_vod_categories'%(user.host(),user.port,username,password) panel_api = '%s:%s/panel_api.php?username=%s&password=%s'%(user.host(),user.port,username,password) play_url = '%s:%s/live/%s/%s/'%(user.host(),user.port,username,password) Guide = xbmc.translatePath(os.path.join('special://home/addons/addons/'+user.id+'/resources/catchup', 'guide.xml')) GuideLoc = xbmc.translatePath(os.path.join('special://home/addons/addons/'+user.id+'/resources/catchup', 'g')) advanced_settings = xbmc.translatePath('special://home/addons/'+user.id+'/resources/advanced_settings') advanced_settings_target = xbmc.translatePath(os.path.join('special://home/userdata','advancedsettings.xml')) KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4]) ######################################### def buildcleanurl(url):