Third pull request for Hacktoberfest

Continuing from the last blog post Second pull request for Hacktoberfest. I found a different project written in a different language compared to the other two pull request I have done which was written in Java. I am very pleased that I was able to branch out from just programming in Java .


Project:

The project I will be working on is called dhwani written in JavaScript and used on the command line. The main features of dhwani is:

  • Conversion from Video format to Audio Format.
  • Conversion from Audio format to Text Format.
  • Extraction of keywords from Text.

dhwani is mainly built off of Node.js and ffmpeg. I had a lot of difficulty setting up ffmpeg but I found a blog How to Install FFmpeg on Windows that worked perfectly for my Windows 10 operation system.

Issue:

The issue I will be working on is an enchantment. Before applying the solution, when you use dhwani on the command line to convert videos/audios there tend to be a long execution time. This means that the user is waiting with no terminal message, unsure if the conversion is still happening. The issue I will be working on is to add support for a progress bar when the program is converting videos/audios. I will be implementing this solution using cli-spinner.

Implementing the solution

On the cli-spinner site the example usage is pretty much the code needed to implement the solution:

var Spinner = require('cli-spinner').Spinner;
 
var spinner = new Spinner('processing.. %s');
spinner.setSpinnerString('|/-\\');
spinner.start(); 
spinner.stop(true);  

The first three lines declare the our cli-spinner and sets the progress bar message. spinner.start() starts the spinner and spinner.stop(true) stops the spinner (Passing in the value true to clear the progress bar message when spinner stops). I will have to place spinner.start() and spinner.stop(true) in the beginning are end of the 3 features respectively.


Here is a demo from the cli-spinner site to see what the progress bar can look like:


Going through the code/testing I realized that I would also have to place spinner.stop(true) whenever an exception happens. The reason I do this is because if a user enters a argument that is an invalid format, without the line spinner.stop(true) the progress bar would keep spinning.


Here are the command features for dhwani:

dhwani cvta Conversion from Video format to Audio Format.
dhwani catt Conversion from Audio format to Text Format.
dhwani ta Extraction of keywords from Text.

Trouble Testing:

I was able to test my progress bar on command dhwani cvta but unable for the other two commands. The other two commands took arguments <url> and <api_key> which I was unsure what to enter even after looking through the README file many of time. I think it has something to do with IBM Watson API but after a lot of googling I was not able to come to an answer. When asking for assignment for this issue I wrote that I was unable to use those two commands. Thankfully the creator replied saying that after I have implemented the changes he can test with valid <url> and <api_key> arguments.

Pull Request:

I created my pull request and upload it to be reviewed (Still waiting on reply/merge from creator). This pull request was less programming and more research compared to my second pull request (Most of the research was spent of figuring out how to setup the project). I spent longer than I originally thought when implementing the solution, since it was my first time working on a command line JavaScript project. For my final pull request I may try to contribute to a bigger project if the time allows for it.


After sometime I went back to look over my pull request (Not merge yet) and realized I made a mistake with the commit. I forgot to add the package.json/package-lock.json files which makes cli-spinner not work after using the Makefile or npm install. I pushed a new commit into the issue branch and left a comment addressing the commit. package.json specify any libraries I added to the project. This was a good lesson for me, hopefully I won’t be making the same mistakes in future projects.

Links:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s