Rhythm by Sunil Shastry.
Rhythm is an open-source software written in Python 3 programming language. Rhythm is free to download and use for everyone. The main objective of the software is to accurately fetch the lyrics of any and every song available on the lyrics.ovh public API.
You will find helpful resources and step-by-step guide to install and run Rhythm efficiently on your computer device, on this website.
Other Projects
Sunil Shastry has designed and developed several projects using modern programming languages and with best coding practices and software design implementation. Please visit Sunil’s personal website or his GitHub profile to view all his projects in much detail.
Contact & Hire
Please contact Sunil Shastry by mailing to sunil.shastry69@gmail.com for any queries. Sunil is a software developer and a designer, proficient in several programming languages and technologies including HTML, CSS, SASS, JavaScript, Python, C, C++, ReactJS, Git, Bootstrap, Figma and Adobe XD, with over three years of experience. Sunil is currently an undergraduate student at the University of Saskatchewan, Canada majoring in Computer Science. Please contact me for any contact or hiring purpose.
Installation and Setup
Rhythm is designed and built using Python 3, it is recommend for the user to have Python 3.5 or a higher version of Python installed on their computer device. This is a console based application and consequently it is assumed that the user is aware of running a Python program on their console. If you do not have Python 3.5 or a higher version installed, please follow the provided steps below.
Python Installation
Installing Python for Windows and Mac by Corey Schafer:
- To install Python, please visit the official Python.org website. Click on the "Download Python" button available. After downloading, please make sure you initiate the actual installation process of Python. (IMPORTANT NOTE: During the first few stages of the installation, you will see a checkbox saying "Add Python to PATH", please SELECT the check-mark!)
- On finishing the Python installation process, depending on the device, you may need to restart your device.
- Once you have completed the process and rebooted your device, you can run Python language right on your terminal or command prompt. To run Python, open up your terminal and type the following command
- However, if you see an error that pops up when you type python on your terminal, it only means that you have not installed Python correctly to your device. In such a case, please view the video through a link I have provided above, which shows how to install Python for Windows and Mac (by Corey Schafer), it can be very helpful.
Command Line Navigation
Rhythm is a console based application and consequently it is assumed that the user is aware of running a Python program on their console. However, it is not mandatory to know it, if a person reading this is not aware of any basic command line interfaces (CLI), I have included a short reference below to get some idea on running the main.py Rhythm file (or any Python file in that regard). Open up your terminal or command prompt and try out these following CLI commands.
- pwd: The print working directory (pwd) command prints the current location of your prompt, which will most likely be the User files or Desktop. Type out the command to check where your terminal's initial location starts from.
- cd: Change directory (cd) helps you navigate from one folder to another, it is very similar to "double clicking" a folder to open it, the cd command lets you do the exact same, but on the command line.
- ls: List (ls) lets you view all the files and folders present in a particular folder, when you type out 'ls' you view all the files present at the location you're currently on the command line. (PRO-TIP: you can view the hidden files present in a folder by typing ls -a)
- clear: The clear command is a little different and is limited to the command line only, which means there is no equivalent command for it when navigating using a GUI. The clear command is pretty simple, it clears your console, it does not terminate any process, but it only builds up some extra space for better visibility while using the console.
Please know that there are a lot more CLI commands than just the ones mentioned above, I have stated a few important ones for the scope of the project. For programmers, CLI is a very efficient tool and it is used quite often for several purposes. To learn more about CLI and CLI commands, please visit the following links
- What is CLI by W3Schools.
- Background of CLI article by CodeAcademy.
- List of all commands on the CLI by CodeAcademy
Required Packages for Rhythm
A Python library is a reusable chunk of code that you may want to include in your programs/ projects. Compared to languages like C or C++, Python libraries do not pertain to any specific context in Python. Here, a ‘library’ loosely describes a collection of core modules. The Python Standard Library is a collection of exact syntax, token, and semantics of Python. It comes bundled with core Python distribution.
Rhythm is built using the Python 3 programming language and uses the following libraries:
- requests: Requests is a simple, yet elegant HTTP library. Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your PUT & POST data — but nowadays, just use the json method!
- os: This module provides a portable way of using operating system dependent functionality. For this project we have used os.path. You do not have to "manually" install os as it comes with the Python Standard Library.
- rhythm: This is a custom module created by Sunil Shastry. You will not find this on any Python documentation page, because this specific module is used only for our project. To read the documentation about the rhythm module (Python class), download the project from GitHub and you can find rhythm.txt file inside the project.
- termcolor: This module allows ANSII color formatting for output in terminal. Although this module does not have anything in depth with our project, it is mainly used to make the user experience better while working on the terminal. Installation of this package can be omitted, although it is suggested not to.
- colorama: This is also an optional module that can be installed to make the user experience feel better. Colorama makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under Microsoft Windows.
- pyfiglet: Pyfiglet is a full port of FIGlet (http://www.figlet.org/) into pure python. It takes ASCII text and renders it in ASCII art fonts (like the title above, which is the 'block' font). Just like the two modules mentioned above, this module is not strictly required to run Rhythm but it is suggested to have it installed.
In order to have the Rhythm application running accurately, you must have the requests library installed, the rest can be omitted. However, the other packages can surely be nice to have, as they help Rhythm perform better in terms of the user experience.
Installing Modules
Installing a module/library in Python can be pretty simple and straight-forward. It is something even a novice can easily achieve without much confusion and complication. To install a package, open up your terminal or command prompt and type the following.
pip is a package installer for Python. You can use pip to install packages from the Python Package Index and other indexes. pip is the PyPA recommended tool for installing Python packages. To install the required packages for our project, please type the following commands:
You need to install the packages one at a time, it might take some time to download depending on your internet speed, once you have successfully downloaded all the required modules for the project, proceed ahead.
Installing Packages using pip by Corey
Schafer:
How to use Rhythm?
Once you have downloaded and installed the project files and the required Python libraries, head over to your terminal or command prompt. Since Rhythm is primarily based on the console, one can use the application through their terminal or command prompt only. However, Rhythm provides an option for the user to download external text files if needed. To run the Rhythm project, navigate to the project directory using some CLI commands and run the following command.
If you are using a Mac, the above command may or may not work since Mac comes with a Python 2 version pre-installed on it already. To tackle this issue, please try running the following command.
On the terminal, by writing out python followed by the Python file name, the corresponding Python file is executed right in the terminal, unlike most softwares that involve a "click", "hover", "drag", Rhythm is used through the terminal. Such applications are generally known as console applications, and on the contrary, softwares that involve such "clicks", "hover" and "drag" options are known as GUI (Graphical User Interface) applications.
A full reference about running Python on the command line can be found here
On running the Rhythm application, you will be able you enter the song and artist name and the software will do its working in fetching the lyrics for, this process might take a while depending on your internet speed and the lyrics.ovh public API's access network. However, it is very unlikely for the application to take more than a minute. On receiving the response from the API, Rhythm informs you that your song lyrics have successfully been loaded. At this point, you are given two options, you can either view the lyrics on the terminal or you can download a text file containing the lyrics to your song. The application asks for an input where you are allowed to enter either "view" or "text", and on pressing the "text" option, you will have to provide Rhythm a name for the file and Rhythm will automatically create a "downloads" folder in the same directory and your text file can be present inside the "downloads" folder.
Facing Issues?
Rhythm requires you to download and install loads of packages and files, for a non-developer point of view, this can be very frustrating and error prone. The explanations provided in this documentation may or may not have the perfect description about running the software, and in places where you can easily go wrong, I have provided links to YouTube videos that help you visualize your tasks. However, if you are still having trouble downloading any file or package, or in case you find an error while running your Rhythm application, I would sincerely request you to e-mail me regarding the problem. I would truly appreciate it if you let me know what the problem is and when it occurred. I will try my best to provide a response to you at the earliest, and of course try and fix the problem that is at large with Rhythm.
For any issues and queries, please e-mail me at sunil.shastry69@gmail.com
References and Credits
While developing the Rhythm project, there have been a lot of external tools that are used and that have been extremely helpful in the process of developing the application. These include packages that have made my task easier. Below, there are all the references and credits that are worth mentioning for making my life easier.
- lyrics.ovh A simple API to retrieve the lyrics of a song, this is the brain of the Rhythm application, the lyrics provided for every song is from this public API available for usage for over ten programming languages.
- Requests Module, together with lyrics.ovh, requests is a Python module that helps you send a request to external servers using the .get() method and access the data from it. It's safe to say that the requests module has truly been the brawn of the Rhythm application.
- Corey Schafer's YouTube Channel. Corey Schafer's YouTube channel has been very crucial not only while building the application but as you could probably guess, a couple of his videos proved to be vital for providing proper documentation for the Rhythm application, especially for people who are non-programmers.
- Python Package Index is the main hub for installing all and any Python package, it has provided a lot of clarity while selecting for the right package, you may not know but there are thousands of Python packages available and choosing the best ones are always a task.