Implemented and tested CLI for multi-language support. #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To provide support for multiple languages (issue #37), I implemented a command-line interface with the following options (described neatly in click's built in help messaging system):
I also added a test module to test the command-line interface. There weren't that many things I could find a way to assert, so it still requires some amount of manually checking the output, but it's definitely a lot faster than jumping around directories and running the commands separately.
Implementing this fix unfortunately required introducing an external dependency on the click library to an otherwise fairly self-contained program. However, I noticed there were a couple of other dependencies already listed in requirements.txt. I went ahead and copied those into a setup.py file and changed the directory structure a bit to form a proper python package; this was mostly for my own convenience in terms of keeping dependencies resolved, simplifying the testing process, etc. I also wrote short install and run scripts to cut down on copy-paste time during development; I can't say for sure how well they would work in a production build.
When testing support for languages other than English and Arabic, I discovered that one of the sites the original program downloaded from, subscene.com, has a flaw in their search algorithm: you have to search the exact title of the movie or it won't have any results (for example, "The Room" works, but "TheRoom" doesn't). Rather than trying to navigate the natural language processing nightmare that would be trying to figure out the exact title of a movie based on the filename (or other more convoluted means such as looking for it in the video itself), I decided to drop that website from the search (I did leave that section of code in for maintainability; I just never call it).
I apologize if my approach to fixing this issue is a bit "rough around the edges"; I did this as part of a class assignment that only gave us two weeks to finish (and I started the assignment late). I will have some free time over the summer, during which I could potentially interact more with the development community, but for now this is all I have to offer.
Incidentally, if you do decide to accept my patch, I would very much appreciate it if you do so as soon as possible (I get extra credit if the patch is accepted). Of course, it is entirely up to you, the project maintainers, whether to accept it based solely on its inherent merit (or lack thereof), but I thought it was worth mentioning (at least for my sake -- I am fully aware of how unlikely a quick merge is).
TL;DR Just try the program out and see if you like the new changes. You may have to modify a couple of file paths here and there, but your script was designed that way to begin with, so this shouldn't be too much of an issue. I've only tested it on Linux via command-line; I'm curious to see if it works on Mac.