예제 #1
0
 def setUp(self):
     remove_tmp_file() 
     self._id = str(add_file(open("./tmp.mov").read(), 
         content_type="video/quicktime",
         filename="tmp.mov", 
         
     ))
     
     update("fs.files",{"_id": self._id}, {"uuid": self._id})
     self.task_id = insert("TaskData", {
       "converd": False,
       "entryList":[{
         "fieldType":"Video", "uuid": self._id, "converdid": "",
           }]
       })
예제 #2
0
파일: task.py 프로젝트: baoliang/task
def convert_file_2_flv(_id):
    """
    @todo: 把视频音频转为FLV格式
    @param _id: 文件ID
    """
    file_obj = get_file_by_id(_id)
    open("/tmp/tmp", "w").write(file_obj.get("content"))
    print "------------------king is king "
    os.system(
        "ffmpeg -i /tmp/tmp -y -ab 56\
                  -ar 22050 -b 500 -qscale 1  -s  320*240 /tmp/tmp.flv"
    )
    stream = open("/tmp/tmp.flv").read()
    converd_id = add_file(stream, content_type="video/x-flv", filename=str(_id) + ".flv")
    remove_tmp_file()
    return str(converd_id)
예제 #3
0
파일: task.py 프로젝트: baoliang/task
def convert_file_2_flv(_id):
    """
    @todo: 把视频音频转为FLV格式
    @param _id: 文件ID
    """
    file_obj = get_file_by_id(_id)
    open("/tmp/tmp", "w").write(file_obj.get("content"))
    print "------------------king is king "
    os.system("ffmpeg -i /tmp/tmp -y -ab 56\
                  -ar 22050 -b 500 -qscale 1  -s  320*240 /tmp/tmp.flv")
    stream = open("/tmp/tmp.flv").read()
    converd_id = add_file(stream,
                          content_type="video/x-flv",
                          filename=str(_id) + ".flv")
    remove_tmp_file()
    return str(converd_id)
예제 #4
0
    def setUp(self):
        remove_tmp_file()
        self._id = str(
            add_file(
                open("./tmp.mov").read(),
                content_type="video/quicktime",
                filename="tmp.mov",
            ))

        update("fs.files", {"_id": self._id}, {"uuid": self._id})
        self.task_id = insert(
            "TaskData", {
                "converd":
                False,
                "entryList": [{
                    "fieldType": "Video",
                    "uuid": self._id,
                    "converdid": "",
                }]
            })
예제 #5
0
파일: file.py 프로젝트: baoliang/farm
def save_file(file, content_type, filename):
    return add_file(file, content_type, filename)