Exemplo n.º 1
0
    def cut(self, url_list, time_list):
        try:
            if len(url_list) > 0 and len(time_list) == 2:
                movie = Movie(url_list[0])
                name = url_list[0].split("/")
                save_path = path
                save_path = save_path + name[-1]
                temp1 = time_list[0]
                temp2 = time_list[1]
                temp1 = temp1.split(":")
                temp2 = temp2.split(":")
                t1 = 3600 * int(temp1[0]) + 60 * int(temp1[1]) + int(temp1[2])
                t2 = 3600 * int(temp2[0]) + 60 * int(temp2[1]) + int(temp2[2])
                if t1 < t2:
                    movie.cut(t1, t2, save_path)
                else:
                    print(
                        "Cei doi parametrii au fost introdusi in ordine inversa sau sunt egali!!!"
                    )

                return save_path

            else:
                print("The list is empty")
        except:
            print("Something went wrong with cut method from Panel class")
Exemplo n.º 2
0
    def cut(self, url_list, time_list):
        try:
            if len(url_list) > 0 and len(time_list) == 2:
                movie = Movie(url_list[0])
                name = url_list[0].split("/")
                save_path = path
                save_path = save_path + name[-1]
                temp1 = time_list[0]
                temp2 = time_list[1]
                temp1 = temp1.split(":")
                temp2 = temp2.split(":")
                t1 = 3600 * int(temp1[0]) + 60 * int(temp1[1]) + int(temp1[2])
                t2 = 3600 * int(temp2[0]) + 60 * int(temp2[1]) + int(temp2[2])

                newName = name[-1].split('.')
                newName2 = newName[0].split("_edit_")
                try:
                    nr = int(newName2[1])
                    nr = nr + 1
                    nr = str(nr)
                except:
                    nr = "0"
                newSavePath = path + newName2[
                    0] + "_edit_" + nr + "." + newName[1]
                print("NEW PATH:" + newSavePath)
                if t1 < t2:
                    movie.cut(t1, t2, newSavePath)
                else:
                    print(
                        "Cei doi parametrii au fost introdusi in ordine inversa sau sunt egali!!!"
                    )

                #return save_path
                return newSavePath
            else:
                print("The list is empty")
        except:
            print("Something went wrong with cut method from Panel class")
            return url_list[0]