Example #1
0
def edit_store_resource(exlPath, e=1):
    path = r"C:\Users\ws\Desktop\20181208"
    #当e的值不为1时,代表不需要重新上传资源
    m = MyExcelUtil(exlPath)
    listDir = list_dir(path)
    for d in listDir:
        zip_dir(d)

    dir = path + "\\"
    time = 0
    for j in range(0, 6):
        for i in range(1, m.get_row_num(j)):
            if m.get_rowCol_data(i, 8, j).upper() == "Y":
                zipDir = dir + m.get_rowCol_data(
                    i, 7, j) + "\\" + m.get_rowCol_data(i, 2, j) + ".zip"
                print zipDir
                if os.path.exists(zipDir):
                    # print zipDir
                    if m.get_rowCol_data(i, 7, j).lower() == "title":
                        resource_type = 1
                    elif m.get_rowCol_data(i, 7, j).lower() == "transition":
                        resource_type = 2
                    elif m.get_rowCol_data(i, 7, j).lower() == "filter":
                        resource_type = 3
                    elif m.get_rowCol_data(i, 7, j).lower() == "overlay":
                        resource_type = 4
                    elif m.get_rowCol_data(i, 7, j).lower() == "audio":
                        resource_type = 6
                    elif m.get_rowCol_data(i, 7, j).lower() == "element":
                        resource_type = 7
                    try:
                        if e == 1:
                            resUrl = reqApi.post_files(zipDir, 2)
                            print resUrl
                        else:
                            resUrl = ""
                            print "资源不用上传"
                        resText = reqApi.post_ResourceEdit(
                            m.get_rowCol_data(i, 6, j), resUrl,
                            m.get_rowCol_data(i, 3, j),
                            m.get_rowCol_data(i, 4, j),
                            m.get_rowCol_data(i, 5, j), resource_type,
                            "store Edit")
                        if resText.find(u"操作成功") >= 0:
                            time = time + 1
                            print("操作成功 " + str(time))
                            MyExcelUtil(exlPath).write_rowNum_data(
                                i, 8, MyExcelUtil.set_style(3), j, "N", "PASS")
                        else:
                            print("操作失败")
                            MyExcelUtil(exlPath).write_data(
                                i, 9, "FAIL", MyExcelUtil.set_style(2), j)
                    except Exception as err:
                        print err
                        MyExcelUtil(exlPath).write_data(
                            i, 9, "FAIL", MyExcelUtil.set_style(2), j)
Example #2
0
def up_store_resource(exlPath):
    dir = r"C:\Users\ws\Desktop\9.0_pack"
    m = MyExcelUtil(exlPath)
    listDir = list_dir(dir)
    for d in listDir:
        zip_dir(d)

    time = 0
    for j in range(0, 6):
        for i in range(1, m.get_row_num(j)):
            if m.get_rowCol_data(i, 8, j).upper() == "Y":
                zipDir = dir + "\\" + m.get_rowCol_data(
                    i, 7, j) + "\\" + m.get_rowCol_data(i, 2, j) + ".zip"
                # print zipDir
                if os.path.exists(zipDir):
                    print zipDir
                    # print type(zipDir)
                    if m.get_rowCol_data(i, 7, j).lower() == "title":
                        resource_type = 1
                    elif m.get_rowCol_data(i, 7, j).lower() == "transition":
                        resource_type = 2
                    elif m.get_rowCol_data(i, 7, j).lower() == "filter":
                        resource_type = 3
                    elif m.get_rowCol_data(i, 7, j).lower() == "overlay":
                        resource_type = 4
                    elif m.get_rowCol_data(i, 7, j).lower() == "audio":
                        resource_type = 6
                    elif m.get_rowCol_data(i, 7, j).lower() == "element":
                        resource_type = 7
                    try:
                        resUrl = reqApi.post_files(zipDir, 2)
                        print resUrl
                        resText = reqApi.post_ResourceAdd(
                            m.get_rowCol_data(i, 6, j), resUrl,
                            m.get_rowCol_data(i, 3, j),
                            m.get_rowCol_data(i, 4, j),
                            m.get_rowCol_data(i, 5, j), resource_type,
                            "store auto")
                        if resText.find(u"操作成功") >= 0:
                            time = time + 1
                            print("操作成功 " + str(time))
                            MyExcelUtil(exlPath).write_rowNum_data(
                                i, 8, MyExcelUtil.set_style(3), j, "N", "PASS")
                        elif resText.find(u"唯一标识不能重复") >= 0:
                            print("唯一标识不能重复")
                            MyExcelUtil(exlPath).write_data(
                                i, 9, "FAIL", MyExcelUtil.set_style(2), j)
                        else:
                            print("操作失败")
                            MyExcelUtil(exlPath).write_data(
                                i, 9, "FAIL", MyExcelUtil.set_style(2), j)
                    except Exception as err:
                        print err
                        MyExcelUtil(exlPath).write_data(
                            i, 9, "FAIL", MyExcelUtil.set_style(2), j)
Example #3
0
def edit_default_resource(exlPath):
    dir = r"C:\Users\ws\Desktop\20181208"
    listDir = list_dir(dir)
    i = 1
    for d in listDir:
        zip_dir(d)

    m = MyExcelUtil(exlPath)
    time = 0
    for j in range(0, 7):
        for i in range(1, m.get_row_num(j)):
            if m.get_rowCol_data(i, 6, j).upper() == "Y":
                zipDir = dir + "\\" + m.get_rowCol_data(
                    i, 2, j) + "\\" + m.get_rowCol_data(i, 4, j) + ".zip"
                # print zipDir
                if os.path.exists(zipDir):
                    print zipDir
                    if m.get_rowCol_data(i, 2, j).lower() == "title":
                        resource_type = 1
                    elif m.get_rowCol_data(i, 2, j).lower() == "transition":
                        resource_type = 2
                    elif m.get_rowCol_data(i, 2, j).lower() == "filter":
                        resource_type = 3
                    elif m.get_rowCol_data(i, 2, j).lower() == "overlay":
                        resource_type = 4
                    elif m.get_rowCol_data(i, 2, j).lower() == "splitscreen":
                        resource_type = 5
                    elif m.get_rowCol_data(i, 2, j).lower() == "audio":
                        resource_type = 6
                    elif m.get_rowCol_data(i, 2, j).lower() == "element":
                        resource_type = 7
                    try:
                        resUrl = reqApi.post_files(zipDir, 2)
                        print resUrl
                        resText = reqApi.post_ResourceEdit(
                            m.get_rowCol_data(i, 8, j), resUrl,
                            m.get_rowCol_data(i, 5, j),
                            m.get_rowCol_data(i, 1, j),
                            m.get_rowCol_data(i, 0, j), resource_type,
                            "default Edit")
                        if resText.find(u"操作成功") >= 0:
                            time = time + 1
                            print("操作成功 " + str(time))
                            MyExcelUtil(exlPath).write_rowNum_data(
                                i, 6, MyExcelUtil.set_style(3), j, "N", "PASS")
                        else:
                            print("操作失败")
                            MyExcelUtil(exlPath).write_data(
                                i, 7, "FAIL", MyExcelUtil.set_style(2), j)
                    except Exception as err:
                        print err
                        MyExcelUtil(exlPath).write_data(
                            i, 7, "FAIL", MyExcelUtil.set_style(2), j)
Example #4
0
def edit_store_resource(exlPath, e=1):
    """
    编辑商城资源
    :param exlPath:
    :param e: 为1时需要上传资源,其余不需要上传
    """
    path = r"E:\Filmore\package\Filmaro9.X-FX-Vault\Resource Packs"
    # 当e的值不为1时,代表不需要重新上传资源
    m = MyExcelUtil(exlPath)
    listDir = list_dir(path)
    for d in listDir:
        zip_dir(d)

    dir = path + "\\"
    time = 0
    for j in range(0, 6):
        for i in range(1, m.get_row_num(j)):
            if m.get_rowCol_data(i, 8, j).upper() == "Y":
                zipDir = dir + m.get_rowCol_data(i, 7, j) + "\\" + m.get_rowCol_data(i, 2, j) + ".zip"
                print zipDir
                if os.path.exists(zipDir):
                    # print zipDir
                    if m.get_rowCol_data(i, 7, j).lower() == "title":
                        resource_type = 1
                    elif m.get_rowCol_data(i, 7, j).lower() == "transition":
                        resource_type = 2
                    elif m.get_rowCol_data(i, 7, j).lower() == "filter":
                        resource_type = 3
                    elif m.get_rowCol_data(i, 7, j).lower() == "overlay":
                        resource_type = 4
                    elif m.get_rowCol_data(i, 7, j).lower() == "audio":
                        resource_type = 6
                    elif m.get_rowCol_data(i, 7, j).lower() == "element":
                        resource_type = 7
                    try:
                        if e == 1:
                            if "Filmora" in exlPath:
                                resUrl = reqApi.post_files(zipDir, 2)
                                print resUrl
                            else:
                                resUrl = reqApi.post_shenCut_files(zipDir)
                                print resUrl
                        else:
                            resUrl = ""
                            print "资源不用上传"

                        if "Filmora" in exlPath:
                            resText = reqApi.post_ResourceEdit(m.get_rowCol_data(i, 6, j), resUrl,
                                                               m.get_rowCol_data(i, 3, j),
                                                               m.get_rowCol_data(i, 4, j), m.get_rowCol_data(i, 5, j),
                                                               resource_type, "store Edit")
                        else:
                            import time as t
                            if time > 0:
                                t.sleep(120)
                            resText = reqApi.post_shenCutEdit(m.get_rowCol_data(i, 6, j), resUrl,
                                                              m.get_rowCol_data(i, 3, j),
                                                              m.get_rowCol_data(i, 4, j), m.get_rowCol_data(i, 5, j),
                                                              resource_type, "shencut store Edit")

                        if resText.find(u"操作成功") >= 0:
                            time = time + 1
                            print("操作成功 " + str(time))
                            MyExcelUtil(exlPath).write_rowNum_data(i, 8,
                                                                   MyExcelUtil.set_style(3),
                                                                   j, "N", "PASS")
                        else:
                            print("操作失败")
                            MyExcelUtil(exlPath).write_data(i, 9, "FAIL",
                                                            MyExcelUtil.set_style(2),
                                                            j)
                    except Exception as err:
                        print err
                        MyExcelUtil(exlPath).write_data(i, 9, "FAIL",
                                                        MyExcelUtil.set_style(2),
                                                        j)
Example #5
0
def up_store_resource(exlPath):
    """
    上传商城资源
    :param exlPath:
    """
    dir = r"E:\Filmore\package\Filmaro9.X-FX-Vault\Resource Packs"
    m = MyExcelUtil(exlPath)
    listDir = list_dir(dir)
    for d in listDir:
        zip_dir(d)

    time = 0
    for j in range(0, 6):
        for i in range(1, m.get_row_num(j)):
            if m.get_rowCol_data(i, 8, j).upper() == "Y":
                zipDir = dir + "\\" + m.get_rowCol_data(i, 7, j) + "\\" + m.get_rowCol_data(i, 2, j) + ".zip"
                print zipDir
                if os.path.exists(zipDir):
                    # print zipDir
                    # import shutil
                    # zipDir2 = r"C:\Users\ws\Desktop\2\\" + m.get_rowCol_data(i, 3, j) + ".zip"
                    # shutil.copy(zipDir,zipDir2)
                    # print type(zipDir)
                    if m.get_rowCol_data(i, 7, j).lower() == "title":
                        resource_type = 1
                    elif m.get_rowCol_data(i, 7, j).lower() == "transition":
                        resource_type = 2
                    elif m.get_rowCol_data(i, 7, j).lower() == "filter":
                        resource_type = 3
                    elif m.get_rowCol_data(i, 7, j).lower() == "overlay":
                        resource_type = 4
                    elif m.get_rowCol_data(i, 7, j).lower() == "audio":
                        resource_type = 6
                    elif m.get_rowCol_data(i, 7, j).lower() == "element":
                        resource_type = 7
                    try:
                        if "Filmora" in exlPath:
                            resUrl = reqApi.post_files(zipDir, 2)
                            print resUrl
                            resText = reqApi.post_ResourceAdd(m.get_rowCol_data(i, 6, j), resUrl,
                                                              m.get_rowCol_data(i, 3, j),
                                                              m.get_rowCol_data(i, 4, j), m.get_rowCol_data(i, 5, j),
                                                              resource_type, "store auto")
                        else:
                            resUrl = reqApi.post_shenCut_files(zipDir)
                            print resUrl
                            # resUrl = ""
                            resText = reqApi.post_shenCutAdd(m.get_rowCol_data(i, 6, j), resUrl,
                                                             m.get_rowCol_data(i, 3, j),
                                                             m.get_rowCol_data(i, 4, j), m.get_rowCol_data(i, 5, j),
                                                             resource_type, "shenCut store auto")

                        if resText.find(u"操作成功") >= 0:
                            time = time + 1
                            print("操作成功 " + str(time))
                            MyExcelUtil(exlPath).write_rowNum_data(i, 8,
                                                                   MyExcelUtil.set_style(3),
                                                                   j, "N", "PASS")
                        elif resText.find(u"唯一标识不能重复") >= 0:
                            print("唯一标识不能重复")
                            MyExcelUtil(exlPath).write_data(i, 9, "FAIL",
                                                            MyExcelUtil.set_style(2),
                                                            j)
                        else:
                            print("操作失败")
                            MyExcelUtil(exlPath).write_data(i, 9, "FAIL",
                                                            MyExcelUtil.set_style(2),
                                                            j)
                    except Exception as err:
                        print err
                        MyExcelUtil(exlPath).write_data(i, 9, "FAIL",
                                                        MyExcelUtil.set_style(2),
                                                        j)
Example #6
0
def edit_default_resource(exlPath, type=0):
    """
    编辑内置资源
    :param exlPath:
    """
    dir = r"E:\Filmore\package\Filmaro9.X-FX-Vault\Default"
    listDir = list_dir(dir)
    i = 1
    for d in listDir:
        zip_dir(d)

    m = MyExcelUtil(exlPath)
    time = 0
    for j in range(0, 8):
        for i in range(1, m.get_row_num(j)):
            if m.get_rowCol_data(i, 6, j).upper() == "Y":
                zipDir = dir + "\\" + m.get_rowCol_data(i, 2, j) + "\\" + m.get_rowCol_data(i, 4, j) + ".zip"
                print zipDir
                if os.path.exists(zipDir):
                    # print zipDir
                    if m.get_rowCol_data(i, 2, j).lower() == "title":
                        resource_type = 1
                    elif m.get_rowCol_data(i, 2, j).lower() == "transition":
                        resource_type = 2
                    elif m.get_rowCol_data(i, 2, j).lower() == "filter":
                        resource_type = 3
                    elif m.get_rowCol_data(i, 2, j).lower() == "overlay":
                        resource_type = 4
                    elif m.get_rowCol_data(i, 2, j).lower() == "splitscreen":
                        resource_type = 5
                    elif m.get_rowCol_data(i, 2, j).lower() == "audio":
                        resource_type = 6
                    elif m.get_rowCol_data(i, 2, j).lower() == "element":
                        resource_type = 7
                    elif m.get_rowCol_data(i, 2, j).lower() == "media":
                        resource_type = 8
                    elif m.get_rowCol_data(i, 2, j).lower() == "sfx":
                        resource_type = 10
                    try:
                        if type == 0:
                            resUrl = reqApi.post_files(zipDir, 2)
                            print resUrl
                            # resUrl = ""
                            resText = reqApi.post_ResourceEdit(m.get_rowCol_data(i, 8, j), resUrl,
                                                               m.get_rowCol_data(i, 5, j),
                                                               m.get_rowCol_data(i, 1, j), m.get_rowCol_data(i, 0, j),
                                                               resource_type, "default Edit"
                                                               )
                        else:
                            # resUrl = reqApi.post_shenCut_files(zipDir)
                            # print resUrl
                            resUrl = ""
                            # print "资源不用上传"
                            resText = reqApi.post_shenCutEdit(m.get_rowCol_data(i, 8, j), resUrl,
                                                              m.get_rowCol_data(i, 5, j),
                                                              m.get_rowCol_data(i, 1, j), m.get_rowCol_data(i, 0, j),
                                                              resource_type, "shenCut Edit"
                                                              )

                        if resText.find(u"操作成功") >= 0:
                            time = time + 1
                            print("操作成功 " + str(time))
                            MyExcelUtil(exlPath).write_rowNum_data(i, 6,
                                                                   MyExcelUtil.set_style(3),
                                                                   j, "N", "PASS")
                            import time as t
                            t.sleep(200)
                        else:
                            print("操作失败")
                            MyExcelUtil(exlPath).write_data(i, 7, "FAIL",
                                                            MyExcelUtil.set_style(2),
                                                            j)
                    except Exception as err:
                        print err
                        MyExcelUtil(exlPath).write_data(i, 7, "FAIL",
                                                        MyExcelUtil.set_style(2),
                                                        j)