Commits

Vincenzo Ampolo  committed 4d78165

First Release

  • Participants
  • Parent commits a8761c3

Comments (0)

Files changed (5)

+import os
+import sys
+(head, tail) = os.path.split(os.path.abspath(os.path.dirname(__file__)))
+sys.path.append(head)
+sys.path.append(os.path.join(head,tail))
+
+os.environ['DJANGO_SETTINGS_MODULE'] = 'raiurl.settings'
+
+import django.core.handlers.wsgi
+application = django.core.handlers.wsgi.WSGIHandler()

File main/templates/index.html

 <html>
 	<head>
 		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-		<title>Untitled Document</title>
+		<link rel="stylesheet" href="site_media/css/screen.css" type="text/css">
+		<title>Railibera.info - Stream Rai</title>
 	</head>
 	<body>
+		<img id="logo" src="site_media/images/rai.jpg"></img>
 		<div id="content">
 			<form method="post" action="/">
-				<input type="text" name="link">
-				<input type="submit">
+				<input class="text" type="text" name="link">
+				<input class="button" type="submit" value="Cerca video">
 			</form>
-			<div id="result">
-				{{result}}
-			</div>
+			{% if error %}
+				<div id="error"> 
+					{{error}}
+				</div>
+			{% endif %}
+			{% if result %}
+				<div id="result">
+					<a href="{{result}}">{{result}}</a>
+				</div>
+			{% endif %}
 		</div>
+		<div id="footer"> Questo sito è stato realizzato da <a href="http://vincenzo-ampolo.net">Vincenzo Ampolo</a></div>
 	</body>
 </html>

File main/views.py

 def index(request):
     d = {}
     if request.method == 'POST':
-        page = urllib.urlopen(request.POST.get('link',''))
-        page_source = page.read()
-        match = video_finder.search(page_source)
-        d['result'] = match.group('url')
+        link = request.POST.get('link','')
+        if link[0:7] != 'http://':
+            link = 'http://' + link
+        try:
+            page = urllib.urlopen(link)
+            page_source = page.read()
+            match = video_finder.search(page_source)
+            d['result'] = match.group('url')
+        except:
+            d['error'] = 'Errore, inserisci un url di rai.tv valido'
         return render_to_response('index.html', d )
     return render_to_response('index.html', d)

File static_serve/static/css/screen.css

+body {
+	width: 850px;
+	margin: 0px auto;
+	font-family: Helvetica;
+	text-align:center;
+}
+
+#logo {
+	width: 500px;
+}
+
+#content {
+	margin: 100px auto 300px;
+}
+
+#content input.text {
+	width: 730px;
+	height: 20px;
+}
+
+#content input.button {
+	width: 100px;
+	height: 25px;
+}
+
+#content form{
+	margin-bottom: 70px;
+}
+
+#error {
+	color: red;
+}
+
+#footer {
+	font-size:small;
+}

File static_serve/static/images/rai.jpg

Added
New image