Skip to content
/ tiq Public

Display a random image and related quote in a beautiful way.

Notifications You must be signed in to change notification settings

Fansesi/tiq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terminal-img-quote

Python 3.11 Code style: black

Display a random image and a related quote in a beautiful way.

Examples

Example Video

Example Image 1

Example Image 2

Requirements

  • For image viewing, currently ascii-image-converter or viu are supported. You may download their binaries easily.
  • python 3.11 or higher (because of tomllib). No other python dependencies.

Usage

  1. Clone this project with:
git clone --depth 1 https://github.com/Fansesi/tiq.git
  1. Prepare folders with images in them. ascii-image-converter and viu both supports jpeg, png, webp and gif.
  2. Create a quote.json file for each folder and put the quotes in a list as like this:
[
    "This is the quote 1.",
    "This is the quote 2.",
    "This is the quote 3."
]
  1. Move the prepared folders to a location of your desire. In default configuration this folder is called categories under the root of the project.
  2. If successfully installed, you may run a command to create the settings for each image:
tiq create --categories-dir PATH/TO/CATEGORIES/FOLDER --user-settings PATH/TO/user_settings.toml

[!note] You may run tiq create --help to see the default paths.

This will create a settings.json for each folder (category). Each settings.json file hosts the individual settings of each image for ascii-image-converter and/or viu to use. You may refer their documentation for the settings explanation.

  1. Finally, run the program with:
tiq normal --categories-dir PATH/TO/CATEGORIES/FOLDER --user-settings PATH/TO/user_settings.toml

[!note] Similarly, you may run tiq normal --help to see the default paths.

Further Customization

user_settings.toml hosts couple of settings about the displayer and text appearance. You may tweak them as you like.

List of Commands

  • create:
    • Create the settings for each category.
    • Will not override already created individual image settings. Only updates settings.json file if an image is added or deleted.
    • If --category is provided, will only generate settings for that category.
  • normal:
    • Randomly select an image and quote to display.
  • reset:
    • Hard reset settings. Will override everything.
    • If --category is provided, only reset the settings on that category.
    • Uses default_img_settings.json, therefore if you change anything in the default settings, you can update every setting with this.
  • check:
    • Display every image into screen to check if there is a problem with displaying the image. (Especially handy with ascii-image-converter)
    • If --category is provided, only display the images on that category.
  • debug:
    • For debugging a single image.
    • Uses debug_settings.json.
    • You can provide the json file path with --debug-settings argument.
  • static:
    • Show a static image and/or quote. Setting 'RANDOM' to QUOTE or CATEGORY will make those settings randomized.
    • You can provide the json file path with --static-settings argument.

How to add another displayer

Displayer class has display_img function that calls message preparation functions. They are titled prepare_viu_msg and prepare_ascii_msg. You may write you own prepare_*_msg function for a different displayer toolkit.

About

Display a random image and related quote in a beautiful way.

Resources

Stars

Watchers

Forks