def __init__(self, bucket_label, station_id): self.__station_id = station_id self.__bucket_label = bucket_label self.__bucket_keeper = PTOFS( ) #current using pairtree with file system self.__bucket_id = "{0}_{1}".format( {self.__bucket_label, self.__station_id})
def save_to_ofs(session, filename, validity, station_id, category): o = PTOFS(storage_dir = "/home/amour/media/gdrive/Community Media/data") bucket_id = "{0}_{1}".format(station_id, category) session.consoleLog("info", "bucket id is " + bucket_id) result = o.put_stream(bucket_id, filename, open("{0}/{1}".format(base_files_directory, filename)), params={"validity":validity}) session.consoleLog("info", str(result)) session.streamFile("{0}/{1}".format(base_prompts_directory, station_message_saved_messages[station_lines[session.getVariable('destination_number')]]))
def __init__(self, bucket_label, station_id): self.__station_id = station_id self.__bucket_label = bucket_label self.__bucket_keeper = PTOFS( storage_dir="/home/amour/media/gdrive/Community Media/data" ) #current using pairtree with file system self.__bucket_id = "{0}_{1}".format(self.__station_id, self.__bucket_label) print "bucket id s " + self.__bucket_id
def save_to_ofs(session, filename, validity, station_id, category): o = PTOFS() bucket_id = "{0}_{1}".format(station_id, category) session.consoleLog("info", "bucket id is " + bucket_id) result = o.put_stream(bucket_id, filename, open("{0}/{1}".format(base_files_directory, filename)), params={"validity": validity}) session.consoleLog("info", str(result))
from flask import Flask, make_response, jsonify, request, send_file from flask.ext.restful import Api, Resource, reqparse from flask.ext.restful.utils import cors import werkzeug from flask.ext.httpauth import HTTPBasicAuth from flask.ext.sqlalchemy import SQLAlchemy from ofs.local import PTOFS import argparse import hashlib app = Flask(__name__) api = Api(app) # api.decorators=[cors.crossdomain(origin='*')] auth = HTTPBasicAuth() o = PTOFS() app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' db = SQLAlchemy(app) class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) email = db.Column(db.String(120), unique=True) password = db.Column(db.String(120), unique=False) key = db.Column(db.String(200), unique=True) uuid = db.Column(db.String(200), unique=True) def __init__(self, username, email, passw, key, uuid): self.username = username self.email = email self.password = passw self.key = key
from ofs.local import PTOFS o = PTOFS(storage_dir="/home/amour/data") bucket_id = "1_advertisments" # "1_advertisments" #o.claim_bucket("foo") print bucket_id #result = o.put_stream(bucket_id, "foo3.wav", open("/home/amour/20150316104826_0774712133.wav"), params={"validity" : 5}) #print result for item in o.list_labels(bucket_id): print item t = o.get_metadata(bucket_id, item) print t
def setUp(self): self.o = PTOFS(storage_dir="pt_deleteme")
from ofs.local import PTOFS o = PTOFS(storage_dir="/home/amour/media/gdrive/Community Media/data") bucket_id = "11_1" #o.claim_bucket("foo") print bucket_id #result = o.put_stream(bucket_id, "foo3.txt", "hello there Mclovin!") #print result for item in o.list_labels(bucket_id): print item