Beispiel #1
0
def html_cat(datafile, category):
    # output everything of a certain category

    items = []
    ids = core.get_all_ids(datafile)
    subcats = dict(zip(core.subcategories, [[], [], [], [], []]))
    other = []

    #print(category)
    for x in ids:
        item = core.get_by_id(datafile, x)[x]
        if item.get("cat") == category:
            subcat = item.get("subcat")
            if subcat and subcat != "none":
                subcats.get(subcat).append(x)
            else:
                other.append(x)

    for y in iter(subcats):
        for z in subcats.get(y):
            items.append(html_one(datafile, z))

    for y in other:
        items.append(html_one(datafile, y))

    return "".join(items)
Beispiel #2
0
def html_status(datafile, status):
    # output everything of a certain status

    items = []
    ids = core.get_all_ids(datafile)

    sorted(dictionary.items(), key=lambda x: x[1])
Beispiel #3
0
def html_cat(datafile, category):
    # output everything of a certain category

    items = []
    ids = core.get_all_ids(datafile)
    subcats = dict(zip(core.subcategories, [[],[],[],[],[]]))
    other = []

    #print(category)
    for x in ids:
        item = core.get_by_id(datafile, x)[x]
        if item.get("cat") == category:
            subcat = item.get("subcat")
            if subcat and subcat != "none":
                subcats.get(subcat).append(x)
            else:
                other.append(x)

    for y in iter(subcats):
        for z in subcats.get(y):
            items.append(html_one(datafile, z))

    for y in other:
        items.append(html_one(datafile, y))

    return "".join(items)
Beispiel #4
0
def html_status(datafile, status):
    # output everything of a certain status

    items = []
    ids = core.get_all_ids(datafile)

    sorted(dictionary.items(), key=lambda x: x[1])
Beispiel #5
0
def short_data(data):
    ids = core.get_all_ids(data)
    shortdata = {}
    for x in ids:
        raw = core.get_by_id(datafile, x)[x]
        item = {x:{"make":raw.get("make"), "model":raw.get("model"), "name":raw.get("name"), "nick":raw.get("nick")}}
        shortdata.update(item)

    return pretty_data(shortdata)
Beispiel #6
0
def pick_id():
    print("give me an ID: (q to cancel) ", end="")
    ans = input()
    ids = core.get_all_ids(datafile)

    if ans in ids:
        return ans
    elif ans == "q":
        return quickrel
    else:
        print("sorry, i didn't find that in the current dataset.")
        return pick_id()
Beispiel #7
0
def pick_id():
    print("give me an ID: (q to cancel) ", end="")
    ans = input()
    ids = core.get_all_ids(datafile)

    if ans in ids:
        return ans
    elif ans == "q":
        return quickrel
    else:
        print("sorry, i didn't find that in the current dataset.")
        return pick_id()
Beispiel #8
0
def short_data(data):
    ids = core.get_all_ids(data)
    shortdata = {}
    for x in ids:
        raw = core.get_by_id(datafile, x)[x]
        item = {
            x: {
                "make": raw.get("make"),
                "model": raw.get("model"),
                "name": raw.get("name"),
                "nick": raw.get("nick")
            }
        }
        shortdata.update(item)

    return util.pretty_data(shortdata)
Beispiel #9
0
def random_item():
    ids = core.get_all_ids(datafile)
    return core.get_by_id(datafile, random.choice(ids))
Beispiel #10
0
def random_item():
    ids = core.get_all_ids(datafile)
    return core.get_by_id(datafile, random.choice(ids))