示例#1
0
from library.web.template import render as make_renderer
render = make_renderer('templates/browse')
from index import render as index_render
import os

mediaroot = "/var/media"


class browse:
    def GET(self, dir):
        webpath = dir
        dir = os.path.normpath(os.path.join(mediaroot, dir))

        if (dir[:len(mediaroot)] != mediaroot):
            raise web.notfound("You cannot go up directories.")

        if not (os.path.isdir(dir)):
            head = '<script type="text/javascript" src="/static/jwplayer/jwplayer.js"></script>'
            return index_render.index(head,
                                      render.player('/stream/' + webpath))
        body = ''
        dirs = ['..']
        files = []
        for file in os.listdir(dir):
            fullname = dir + file
            if (os.path.isdir(fullname)):
                dirs.append(file)
            else:
                files.append(file)
        dirs.sort()
        files.sort()
示例#2
0
#!/usr/bin/python

# As of 12/17/11 this module does NOT work, and doesn't conform to RamonaSt
# module format. Will be updated later --sdobz

import os, subprocess, time, xmlrpclib
from random import random

port = 7979

from library.web.template import render as make_renderer
render = make_renderer('templates/appcontrol')
from index import render as index_render


class appcontrol:
	def GET(self,action):
		return index_render.index(render.head(),render.body())

def action(app,action,block=False):
	log("=== NEW ACTION")
	if not (app in apps):
		return "Invalid app"
	if not (action in actions):
		return "Invalid action"

	
	
	if(block):
		return runcmd(["sudo","control",app,action])
	else:
示例#3
0
#!/usr/bin/python

# As of 12/17/11 this module does NOT work, and doesn't conform to RamonaSt
# module format. Will be updated later --sdobz

import os, subprocess, time, xmlrpclib
from random import random

port = 7979

from library.web.template import render as make_renderer
render = make_renderer('templates/appcontrol')
from index import render as index_render


class appcontrol:
    def GET(self, action):
        return index_render.index(render.head(), render.body())


def action(app, action, block=False):
    log("=== NEW ACTION")
    if not (app in apps):
        return "Invalid app"
    if not (action in actions):
        return "Invalid action"

    if (block):
        return runcmd(["sudo", "control", app, action])
    else:
示例#4
0
from library.web.template import render as make_renderer
render = make_renderer('templates/browse')
from index import render as index_render
import os

mediaroot="/var/media"

class browse:
	def GET(self,dir):
		webpath=dir
		dir=os.path.normpath(os.path.join(mediaroot,dir))

		if(dir[:len(mediaroot)]!=mediaroot):
			raise web.notfound("You cannot go up directories.")
			
		if not(os.path.isdir(dir)):
			head='<script type="text/javascript" src="/static/jwplayer/jwplayer.js"></script>'
			return index_render.index(head,render.player('/stream/'+webpath))
		body=''
		dirs=['..']
		files=[]
		for file in os.listdir(dir):
			fullname=dir+file
			if(os.path.isdir(fullname)):
				dirs.append(file)
			else:
				files.append(file)
		dirs.sort()
		files.sort()
		
		for dir in dirs: