2013-10-08, 03:01
hi im creating a web page that you can install on to a web server and all you have to do is change one line of code in the xbmc addon and you will have a working xbmc script the web page is so you can go to it log in and add a new video link for your addon at the moment im having some trouble with integrating it all i would love some help if anyone's willing to help
Updatehttp://pipcanvid.uphero.com/ login area added default username admin password admin
DEMO
its very basic for not
the webscipt
the xbmc addon its the liveleak leak one
so if anyone could help me or join me would really appropriate it
Updatehttp://pipcanvid.uphero.com/ login area added default username admin password admin
DEMO
its very basic for not
the webscipt
PHP Code:
<?php require_once('Connections/lo.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_lo, $lo);
$query_videos = "SELECT title, `year`, image, url FROM video ORDER BY title ASC";
$videos = mysql_query($query_videos, $lo) or die(mysql_error());
$row_videos = mysql_fetch_assoc($videos);
$totalRows_videos = mysql_num_rows($videos);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "index.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_lo, $lo);
$LoginRS__query=sprintf("SELECT username, password FROM login WHERE username=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $lo) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#form1 #search {
text-align: left;
}
</style>
</head>
<body>
<p><img src="images/icon.png" width="100" height="100" alt="icon" />
</p>
<form id="form1" name="form1" method="post" action="">
<p>
<input type="text" name="search" id="search" />
<input type="submit" name="submit" id="submit" value="Submit" />
</p>
</form>
<table width="1299" height="81" border="1">
<tr>
<td><strong>title</strong></td>
<td><strong>image</strong></td>
<td><strong>url</strong></td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_videos['title']; ?>( <?php echo $row_videos['year']; ?>)</td>
<td><a href="<?php echo $row_videos['url']; ?>"><img src="<?php echo $row_videos['image']; ?>" alt="<?php echo $row_videos['title']; ?>" /></a></td>
<td><a href="<?php echo $row_videos['url']; ?>" title="video" target="_new">video</a></td>
</tr>
<?php } while ($row_videos = mysql_fetch_assoc($videos)); ?>
</table>
<p> </p>
<form id="form2" name="form2" method="POST" action="<?php echo $loginFormAction; ?>">
<p>
<label for="username">username</label>
<input type="text" name="username" id="username" />
</p>
<p>
<label for="password">password</label>
<input type="text" name="password" id="password" />
</p>
<p>login
<input type="submit" name="login" id="login" value="Submit" />
</p>
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($videos);
?>
the xbmc addon its the liveleak leak one
Code:
import urllib,urllib2,re,xbmcplugin,xbmcgui
BASE = "http://pipcanvid.uphero.com/index.php/"
def CATEGORIES():
addDir('Movies','/',1,'')
def INDEX(url):
if url=="browse?q=":
searchString = addSearch()
url="browse?q="+searchString
after = url
url = BASE + url
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
try:
appdg = after.split('&')[1]
before = after.split('&')[0]
appdg = int(appdg.split('=')[1]) + 1
newURL = before + "&page=" + str(appdg)
except:
newURL = after + "&page=2"
appdg = 2
addDir("Go To Page " + str(appdg), newURL, 1, "")
match=re.compile('href="(.+?)" src="(.+?)" alt="(.+?)"').findall(link)
for url,thumbnail,name in match:
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('href="(.+?)" src="(.+?)" alt="(.+?)"').findall(link)
for url in match:
addLink(thumbnail,url,name,"")
match=re.compile('src="http://www.youtube.com/embed/(.+?)?rel=0').findall(link)
for url in match:
youtubeurl = 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % url
addLink(name,youtubeurl,thumbnail,"")
def VIDEOLINKS(url,name):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match=re.compile('img src="(.+?)" alt="(.+?)"').findall(link)
for url in match:
addLink(name,url,'',"")
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
def addLink(name,url,iconimage,urlType):
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
liz.setProperty('IsPlayable','true')
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
return ok
def addSearch():
searchStr = ''
keyboard = xbmc.Keyboard(searchStr, 'Search')
keyboard.doModal()
if (keyboard.isConfirmed()==False):
return
searchStr=keyboard.getText()
if len(searchStr) == 0:
return
else:
return searchStr
def addDir(name,url,mode,iconimage):
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
return ok
params=get_params()
url=None
name=None
mode=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
print "Mode: "+str(mode)
print "URL: "+str(url)
print "Name: "+str(name)
if mode==None or url==None or len(url)<1:
print ""
CATEGORIES()
elif mode==1:
print ""+url
INDEX(url)
elif mode==2:
print ""+url
addSearch()
xbmcplugin.endOfDirectory(int(sys.argv[1]))
so if anyone could help me or join me would really appropriate it