예제 #1
0
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)
예제 #2
0
파일: pgpy.py 프로젝트: 9R/pgpy
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)
예제 #3
0
파일: pgpy.py 프로젝트: 9R/pgpy
def getsubs():
  return jsonify( subs=libpgpy.scanDir(config.py['mediadir'])[0]['subdirs'])
예제 #4
0
def getsubs():
    return jsonify(subs=libpgpy.scanDir(config.py['mediadir'])[0]['subdirs'])