예제 #1
0
    def on_post(self, req, resp):
        #srcName = new file name
        #dirId = the folder id where the file create
        result = {'result': 'success'}

        # pprint.pprint(req.bounded_stream.read().decode("utf-8"))
        body = json.loads(req.bounded_stream.read().decode("utf-8"))
        dirPath = db.get_path(int(body['dirId'], 10))
        # print("DEBUG: " + str(dirPath))

        if dirPath == -1:
            result['result'] = "failed"
            resp.media = result
            return

        srcPath = os.path.join(dirPath, body['srcName'])

        try:
            os.mknod(srcPath)
            mime = magic.Magic(mime=True)
            mime.from_file(srcPath)
            db.create_file(srcPath, body['srcName'], mime)
        except:
            result['result'] = "failed"

        resp.media = result
예제 #2
0
    def on_post(self, req, resp):
        #srcId = src file ID
        #dirId = dir ID
        result = {'result': 'success'}
        body = json.loads(req.bounded_stream.read())

        srcPath = db.get_path(body['srcId'])
        dirPath = db.get_path(body['dstId'])
        fileName = body['fileName']
        dstPath = os.path.join(dirPath, fileName)

        if (srcPath == -1 or dirPath == -1):
            result['result'] = "failed"
            return

        try:
            os.rename(srcPath, dstPath)
            db.update(srcId, dstPath)
        except:
            result['result'] = "failed"

        resp.media = result
예제 #3
0
    def on_post(self, req, resp):
        #srcId = src file id
        result = {'result': 'success'}
        body = json.loads(req.bounded_stream.read())

        srcPath = db.get_path(body['srcId'])
        if (srcPath == -1):
            result['result'] = "failed"
            return

        try:
            os.remove(srcPath)
            db.soft_delete(srcPath)
            db.hard_delete(srcPath)
        except:
            result['result'] = "failed"

        resp.media = result
예제 #4
0
 def __init__(self):
     self.window = QtGui.QMainWindow()
     self.setupUi(self.window)
     
     icon = QtGui.QIcon()
     icon.addPixmap(QtGui.QPixmap(db.get_path(db.tool_location, "icons/logo.png")), 
                    QtGui.QIcon.Normal, QtGui.QIcon.Off)
     self.window.setWindowIcon(icon)
     self.window.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint|QtCore.Qt.WindowTitleHint)
     
     file_list_model = model.FileListModel()
     self.fileListView.setModel(file_list_model)
     self.fileListView.setItemDelegate(delegate.FileDelegate(self.window))
     self.fileListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
     self.fileListView.setAcceptDrops(True)
     self.fileListView.setDropIndicatorShown(True)
     self.fileListView.doubleClicked.connect(self.onItemDoubleClicked)
     
     file_list_model.progress.connect(self.onProgress)
     self.generateButton.clicked.connect(self.onButtonClicked)
     
     self.window.show()
예제 #5
0
#!/usr/local/bin/python2.7
# encoding: utf-8
'''
Created on 2017.11.30

@author: Serious Sam
'''

import os, shutil, sys, subprocess
import db

if __name__ == "__main__":

    output_dir, output_name = os.path.split(sys.argv[1])
    image_name = "%s_%%04d.tif" % output_name.split('.')[0]
    image_path = "%s/images/%s" % (output_dir, image_name)
    video_path = "%s.mov" % sys.argv[1].split('.')[0]
    ffmpeg_path = db.get_path(db.tool_location, "bin/ffmpeg")

    cmd = "{ffmpeg_path} -i \"{image_path}\" -vcodec \"mpeg4\" -y -qscale 0 \"{video_path}\"".format(
        **locals())
    if subprocess.Popen(cmd, shell=True).wait() == 0:
        print db.com_success_msg
        shutil.rmtree("%s/images" % output_dir, True)

    sys.exit()