Пример #1
0
    def GetPathID(self, path):
        myDB = Storage()

        if myDB.DB_is_new(path) is True:
            return False
        else:
            return myDB.DB_GetPathID(path)
Пример #2
0
    def AddPath(self, path):
        myDB = Storage()

        if os.path.exists(path) is True:
            if myDB.DB_is_new(path) is True:
                myDB.DB_AddNewPath(path)
                return True
            else:
                return False
        else:
            return False
Пример #3
0
def remove_path(path, yes):
    """Remove specific Path form DB"""
    myPath = Path()
    myDB = Storage()

    if myDB.DB_is_new(path) is True:
        print("This {0} \nis wrong, it's not available on the DB".format(path))
    else:
        if yes is True:
            myPath.RemovePath(path)
            print("done")
        else:
            message = "Are you sure you want to remove \"" + path + "\"? [Y/N]"
            answer = input(message)
            if answer.upper() == "Y":
                myPath.RemovePath(path)
                print("Done!!!")
            else:
                print("Ok, nothing had been removed")
Пример #4
0
def get_report(path, count):
    """Show a saved information about specific path"""
    myPath = Path()
    myUnit = UniConv()
    myDB = Storage()

    if myDB.DB_is_new(path) is False:
        table = PrettyTable()

        table.field_names = ["#", "Time", "Size", "Path"]

        for count, result in enumerate(myPath.GetSizes(path, count), start=1):
            table.add_row([
                count, result['time_stamp'],
                myUnit.beauty_size(result['size']), path
            ])

        print(table)
    else:
        print("Sorry, The path is not exist !!")