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 .
- 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.
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();
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.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 cvta Conversion from Video format to Audio Format.
dhwani catt Conversion from Audio format to Text Format.
dhwani ta Extraction of keywords from Text.
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
<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
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-lock.json files which makes cli-spinner not work after using the
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.
- My GitHub: https://github.com/ImmutableBox
- dhwani: https://github.com/sagar-jadhav/dhwani
- Hacktoberfest: https://hacktoberfest.digitalocean.com/
- Issue#9: https://github.com/sagar-jadhav/dhwani/issues/9
- Pull request#15: https://github.com/sagar-jadhav/dhwani/pull/15
- Node.js: https://nodejs.org/en/
- ffmpeg: https://www.ffmpeg.org/
- cli-spinner: https://www.npmjs.com/package/cli-spinner
- How to Install FFmpeg on Windows: http://blog.gregzaal.com/how-to-install-ffmpeg-on-windows/