def listing(directory=""): #check if dirs are valid if not os.path.isdir(config.py['mediadir']): return render_template( 'error.html', message='The media directory was not found at "' + config.py['mediadir'] + '". Please check permissions and your configuration.', sitename=config.py['sitename']) if not os.path.isdir(config.py['mediadir'] + directory): abort(404) # return render_template('error.html', message='Invalid directory: "/' + directory + '". Please verify the submitted URL.' , sitename=sitename) #construct path p = config.py['mediadir'] + directory #handle trailng slash if not p.endswith('/'): p = p + '/' #scan dir for files and subdirs dirs = libpgpy.scanDir(p) #render site return render_template('list.html', md=config.py['mediadir'], dirs=dirs, sitename=sitename)
def listing(directory=""): #check if dirs are valid if not os.path.isdir( config.py['mediadir'] ): return render_template('error.html', message='The media directory was not found at "' + config.py['mediadir'] + '". Please check permissions and your configuration.', sitename=config.py['sitename']) if not os.path.isdir( config.py['mediadir'] + directory ): abort(404) # return render_template('error.html', message='Invalid directory: "/' + directory + '". Please verify the submitted URL.' , sitename=sitename) #construct path p = config.py['mediadir']+directory #handle trailng slash if not p.endswith('/'): p = p + '/' #scan dir for files and subdirs dirs = libpgpy.scanDir(p) #render site return render_template('list.html' , md=config.py['mediadir'] , dirs=dirs, sitename=sitename)
def getsubs(): return jsonify( subs=libpgpy.scanDir(config.py['mediadir'])[0]['subdirs'])
def getsubs(): return jsonify(subs=libpgpy.scanDir(config.py['mediadir'])[0]['subdirs'])