Ejemplo n.º 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": "",
           }]
       })
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 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": "",
                }]
            })
Ejemplo n.º 5
0
def save_file(file, content_type, filename):
    return add_file(file, content_type, filename)