Giter Site home page Giter Site logo

enihseht / harvard_cs50p-final_project-audio_world_clock Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 20 KB

This repository contains my final project for the Harvard CS50 Introduction to Python course. The project is an implementation of a world clock with voince assistance. It was developed as part of the course requirements to demonstrate proficiency in Python programming concepts and problem-solving skills.

Python 100.00%
cs50 cs50p cs50python harvard python python3 texttospeech webscrape argparse beautifulsoup

harvard_cs50p-final_project-audio_world_clock's Introduction

Audio World Clock

The World Clock Scraper is a Python program developed as part of the CS50 Introduction to Python Programming course. It serves the purpose of scraping real-time world clock information from a website, creating a dictionary that pairs city names with their respective times, and offering the choice of presenting the information in either text or audio format using text-to-speech.

Web scraping: The program leverages the BeautifulSoup library for web scraping and extracting world clock data.
Data extraction: It parses the HTML content using lxml to fetch city names and their corresponding times.
Dictionary creation: The program structures the retrieved data into a dictionary, with city names as keys and times as values.
Command-line interface: Users can provide command-line arguments to specify the city and the desired output format.
Text output: It presents city names and current times in text format, enhancing visual representation with ASCII art generated by the pyfiglet library.
Audio output: With the assistance of the pyttsx3 library, the program can convert time information into speech for audio output.
Error handling: The program includes error-handling mechanisms through the sys module to manage situations involving invalid city names and network connection errors.

Dependencies

The World Clock Scraper relies on the following Python libraries:

BeautifulSoup4: Used for web scraping and parsing HTML content.
pyfiglet: Utilized for creating ASCII art to visually represent city names and times.
requests: Employed for making HTTP requests to retrieve website content.
pyttsx3: Used for converting time information into speech for audio output.
sys: Employed for error handling and program termination in the event of exceptions.

Usage

To use the World Clock Scraper, follow these steps:

1. Install the required dependencies by executing pip install -r requirements.txt in your terminal.
2. Run the program with the command python main.py --sound --city [CITY] to obtain both audio and text output, or python main.py --city [CITY] to receive only text output.
3. Replace [CITY] with the name of the desired city to retrieve its current time.
4. The program will display the city name and time in text format. If the --sound flag is provided, it will also vocalize the time using text-to-speech.

Example

To retrieve the current time in New York with both audio and text output, execute the following command:

python project.py --sound --city Bucharest

harvard_cs50p-final_project-audio_world_clock's People

Contributors

enihseht avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.