GithubHelp home page GithubHelp logo

quoto's Introduction

Quoto

Simple application which displays a Quote on regular intervals of time.

Features

  • Same quote on a particular day
  • Random quote everyday
  • Quote fetched from my Goodreads' liked quotes
  • Quoted displayed on a regular interval (3 hours interval)

Tools Used

  • Python 3.4
  • QtDesigner4
  • PyQt 4
  • feedparser (python module)

How?

A json file (local.json) is created having the following format, the relevance of each key is explained in the comments.

{
    "date": "",            # The current date
    "update": "",          # The last date when the number of pages of Goodreads' quotes are updated
    "pages": ,             # Number of pages you have in the Goodreads' liked quotes
    "pre_quo1": "",        # Last day quote
    "pre_quo2": "",        # Last to last day quote
    "today_quo": ""        # today's quote
}

When the disp.py is run, it calls the main() function of fetch.py module. What this function does is, it checks if the local.json exists. If it doesn't then it creates it and then returns the quote, saving the current date, up-date, number of pages and the number of quotes on each page, today's quote. If it does then the update is checked against today's date. If the difference is more than 30 days then the data is updated else it goes to next step. In the next step the current date is checked if is today's date or not. If it is not then a page out of total pages is randomly selected followed by the random selection of a quote number. This quote is fetched and returned. If the current date is today's date then the same quote is returned which was used previously. Thus, no fetching was done from the Goodreads' server in this case. This above returned quote is sent to the QTextBrowser and displayed in a widget. Here the widget was designed using QtDesigner and quotes were fetched using feedparser which uses the RSS feed links of my Goodreads' liked quotes. Here, have a look at the GUI made,

img here

Now, after this final script, I wrote a bash script which calls this above disp.py*. This step was to call the script at an hourly basis using cron jobs. Thus, now this quote is displayed each hour according to the above rules of new or same quote.

SR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.