Esempio n. 1
0
def handle_edit():
    """
            Helps the user change an existing Librium item.
    """

    h = 0
    item_dict = {}
    temp = Librium()
    current_objects = temp.get_items()
    for i in current_objects:
        item_dict[h] = i["location"]
        print("{} : {}".format(h,item_dict[h]))
        h += 1

    user_selection = input("Please select item [0 - {}]: ".format((h-1)))

    try:
        user_selection = int(user_selection)
    except ValueError:
        print("User selection not intiger value.. Exiting")
        return
    if user_selection < 0 or user_selection > h:
        print("User selection out of range.. Exiting")
        return

    print("User selected : {}".format(user_selection))
    temp.update_item(user_selection, build_item())
    del temp
    return
Esempio n. 2
0
class MyDemiurge(Demiurge):
    def run(self):
        self.librium = Librium()
        while True:
            # Run scan
            self.librium.run_object_scan()
            time.sleep(10)
Esempio n. 3
0
def handle_add():
    """
            Helps the user make a new Librium item.
    """

    new_item = build_item()
    temp = Librium()
    temp.add_item(new_item)
    del temp
    print("Added new item : \n   {}".format(new_item))
    return
Esempio n. 4
0
def main():

    # Initialize Librium
    l = Librium()

    print("""

                    Initiating object scan.

    """)

    # Check sized ( Every 10 Sec or so )
    l.run_object_scan()

    print("""

                    Object scan complete.

    """)

    # Show existing Items
    l.display_objects()

    # Add Item to config list
    l.add_item('{"location":"/tmp/example_dir", "type":"dir","unit":"m","max":2,"action":"clean"}')
Esempio n. 5
0
 def run(self):
     self.librium = Librium()
     while True:
         # Run scan
         self.librium.run_object_scan()
         time.sleep(10)