예제 #1
0
                          initial_indent=indent,
                          subsequent_indent=indent)
    line_count += len(quote)
    quote = "\n".join(quote)

    # just using one sentence bios but bios have up to 10 sentences
    bio = bio[:bio.find('.') + 1]
    bio = textwrap.wrap(bio,
                        max_chars_line,
                        initial_indent=indent,
                        subsequent_indent=indent)
    line_count += len(bio)
    bio = "\n".join(bio)

    print()  # line feed
    q = f"\x1b[3m{quote}\x1b[0m\n{indent}-- \x1b[1m{title} by {name}\x1b[0m\n\n{bio} {indent_cols=} {x.width=} {x.height=} {x.cell_width=} {x.cell_height=}"
    print(q)

    sys.stdout.buffer.write(
        f"\x1b[{line_count}A".encode('ascii'))  # move back up line_count lines

    if display_size == image_size:
        show_image(image)
    else:
        resize_show_image(image, display_size, display_size)
    print()

    image_rows = display_size // x.cell_height
    if line_count > image_rows:
        print((line_count - image_rows) * "\n")
예제 #2
0
            print(e)
            continue

    return uris


if __name__ == '__main__':

    # Use input as song title and artist name
    artist = sys.argv[1]
    z = get_wiki_images2(artist)
    for x in z:
        print(x)
        if os.path.splitext(x)[1].lower() in ['.png', '.jpg']:
            img = generate_image(x, 900, 900)
            show_image(img)
            save_image(img, "testing123.png")
            print()

    exit(0)
    z = get_wiki_images(artist)
    a = artist.lower().replace(" ", "_")
    b = artist.lower().replace(" ", "")
    for x in z:
        if a in x.lower().replace("-", "_"):
            print(x, "Good url 1")
        elif b in x.lower():
            print(
                x, "Good url 2"
            )  # this situation where there is no space between names is rare and may not be worth it`
        else:
예제 #3
0
                        else:
                            s = "This image is being stored as just a URL in the database"
                            img_current = generate_image(row[1], sonos_image_size, sonos_image_size)
                            print()
                        if img_current:
                            break
                        if not rows:
                            rows = all_rows[::]
                    alpha = 0

                if img_previous and img_current:
                    #alpha += .015 # .025 goes will with time.sleep(.05)
                    img_blend = blend_images(img_previous, img_current, alpha)
                    if img_blend:
                        sys.stdout.buffer.write(b"\x1b[H")
                        show_image(img_blend)
                        print(f"\n\x1b[1m{title} {artist}\x1b[0m\n{s}")
                        alpha += .015 
                # I believe this is the path when the title changes
                elif img_current:
                    sys.stdout.buffer.write(b"\x1b[H")
                    show_image(img_current)
                    print(f"\n\x1b[1m{title} {artist}\x1b[0m\n{s}")
                    alpha += 0.25
                
            else:
                rows = all_rows[::]

            time.sleep(.01) 

예제 #4
0
    response = input(
        "Do you want to look at the images currently in the database? ")
    if response[0].lower() == 'y':

        cur.execute(
            f"SELECT id,link,width,height FROM images WHERE artist_id={artist_id}"
        )
        rows = cur.fetchall()
        for row in rows:
            image_id, link, width, height = row
            print()  # line feed
            cur.execute("SELECT image FROM image_files WHERE image_id=%s",
                        (image_id, ))
            row = cur.fetchone()
            if row:
                show_image(BytesIO(row[0]))
                print()
                response = input(
                    "This image is being stored as bytes in the database  - do you want to KEEP it? "
                )
                if response[0].lower() != 'y':
                    cur.execute("DELETE FROM image_files WHERE image_id=%s",
                                (image_id, ))
                    cur.execute("DELETE FROM images WHERE id=%s", (image_id, ))
                    conn.commit()
            else:
                display_image(link)
                print()
                response = input(
                    "This image is NOT being stored as bytes yet - do you want to KEEP it? "
                )