Coder Social home page Coder Social logo

jarvis's Introduction

Jarvis

Build Status Join the chat at https://gitter.im/Sukeesh_Jarvis/Lobby

A Personal Assistant for Linux, MacOS and Windows

Jarvis

Jarvis is a simple personal assistant for Linux, MacOS and Windows which works on the command line. He can talk to you if you enable his voice. He can tell you the weather, he can find restaurants and other places near you. He can do some great stuff for you.

Getting Started With Installation

In order to install Jarvis, follow these steps:

  1. Clone this repository with git clone https://github.com/sukeesh/Jarvis.git
  2. Run the command python installer (or python3 installer if that doesn't work) from the terminal.

Run Jarvis from anywhere by command jarvis, or ./jarvis from within the project directory to start up Jarvis!

You can start by typing help within the Jarvis command line to check what Jarvis can do for you.

Frequently encountered issues

Question: When I run Jarvis, it shows an error relating to module not found
Platform: Windows
Solution 1: Uninstall and/or install the module package
Example:
Error: ImportError: DLL load failed while importing win32api: The specified module could not be found.
Solution:
pip uninstall pywin32
pip install pywin32 or conda instapll pywin32
Solution 2: add the package to your environment variables system PATH.

Question: After cloning the repo in terminal it gives an error when running python3 installer saying please install virtual environemnt Solution:

  • Install virtual env using this command "python3 -m pip install virtualenv"
  • OR: On Linux use package manager (e.g. Ubuntu sudo apt install python3-venv)
  • Restart Installer

If you find other issues and/or have found solutions to them on any platform, please consider adding to this list!

Youtube Video Showing Jarvis

Click here

Contributing

Check out our CONTRIBUTING.md to learn how you can contribute!

QuickStart: Create a new feature (plugin)

Create new file custom/hello_world.py

from plugin import plugin


@plugin("helloworld")
def helloworld(jarvis, s):
    """Repeats what you type"""
    jarvis.say(s)

Check it out!

./jarvis
Jarvis' sound is by default disabled.
In order to let Jarvis talk out loud type: enable sound
Type 'help' for a list of available actions.

~> Hi, what can I do for you?
helloworld Jarvis is cool!
jarvis is cool

Plugins

Click here to learn more about plugins.

Creating a test

Creating a test is optional but never a bad idea ;).

Click here to learn more about testing.

How to run tests:

Run test.sh

./test.sh

Optional Dependencies

  • Any pyttsx3 text-to-speech engine (sapi5, nsss or espeak) for Jarvis to talk out loud (e.g. Ubuntu do sudo apt install espeak)
  • Portaudio + python-devel packages for voice control
  • notify-send on Linux if you want to receive nice and desktop-notification instead of ugly pop up windows (e.g. Ubuntu do sudo apt install libnotify-bin)
  • ffmpeg if you want music to download songs as .mp3 instead of .webm

Docker

Run with docker (docker needs to be installed and running):

[sudo] make build_docker
[sudo] make run_docker

Authors

sukeesh

See also the list of contributors who have participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

jarvis's People

Contributors

5n8ke avatar aazuspan avatar abcumm avatar airlinedog avatar ak2243 avatar akshgpt7 avatar anaisabel7 avatar anderrasovazquez avatar appi147 avatar aprzn123 avatar bsushmith avatar chekoduadarsh avatar csenshi avatar gianniskokkosis avatar hugofpaiva avatar jlvivero avatar konstantinosl avatar mbuildingeveryday avatar methenitis avatar milind220 avatar mmkumr avatar nikolasmoatsos avatar papajohn77 avatar pnhofmann avatar stefanoschaliasos avatar sukeesh avatar thedevbrent avatar trp07 avatar umangahuja1 avatar vieiraroger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jarvis's Issues

Music Plugins Suggested

Hei, you are forgot to add instantmusic in requirements.txt if you want use this library.

Hi, What can I do for you?
music
sh: instantmusic: command not found

Is this fine if using 3rd party and just download music(Legality)? Maybe for later, music command can searching music in local directory and then indexing. Need to add music player, so user just type music and choose song then play :)

Download "Heavy (Official Video) - Linkin Park (feat. Kiiara)"? (y/n) y
Downloading
[generic] watch?v=5dmQ3QWpy1Q: Requesting header
[redirect] Following redirect to https://www.youtube.com/watch?v=5dmQ3QWpy1Q
[youtube] 5dmQ3QWpy1Q: Downloading webpage
[youtube] 5dmQ3QWpy1Q: Downloading video info webpage
[youtube] 5dmQ3QWpy1Q: Extracting video information
[youtube] 5dmQ3QWpy1Q: Downloading js player en_US-vflsP-F5F
WARNING: "id" field is not a string - forcing string conversion
[download] Destination: Heavy (Official Video) - Linkin Park (feat. Kiiara).webm
[download] 100% of 2.70MiB in 00:03
[ffmpeg] Destination: Heavy (Official Video) - Linkin Park (feat. Kiiara).mp3
Deleting original file Heavy (Official Video) - Linkin Park (feat. Kiiara).webm (pass -k to keep)
Fixing id3 tags
http://www.metrolyrics.com/linkin-park-ft-kiiara-heavy-ml-video-hor.html
Cant get album name

Heavy (Official Video)   Linkin Park (feat. Kiiara) 
Downloaidng album art..
Fixing Heavy (Official Video) - Linkin Park (feat. Kiiara)
Fixed

Awesome!

Issue in Setup

As the setup file is only targeted for ubuntu/Debian based user. If it is executed on the Redhat based machine. It is showing error messages, because the package downloader for them is dnf. So there is a need to make it consistent across platforms. So that all linux distros can use this project.

Jarvis crashes when given an incorrect location after 'check weather'

When an incorrect location is included after check weather, Jarvis crashes with
KeyError: 'main'
from

File "Jarvis/packages/weatherIn.py", line 41, in main
    temperature = j['main']['temp']

Besides, when check weather is written as a command with no location afterwards, the weather in the location of "Weather" (???) is given.

Python 3 support

It would be great if Jarvis could run on Python 3.
I'll try to make the changes to reach this, but any help would be welcome.

Music downloaded as .webm

Music is downloaded as .webm and cannot be played by vlc, is there any way to get it to download as mp4?

test_timeIn.py failed

~/b/J/Jarvis $ python -m unittest discover
..Getting Location ... 
.......Song name doesn't exist. (music 'song name') 
...F.Valencia
.E....
======================================================================
ERROR: test_print_say_called_for_all_cmd_help (tests.test_help.HelpTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/test_help.py", line 25, in test_print_say_called_for_all_cmd_help
    mock_print_say.assert_called()
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 721, in __getattr__
    raise AttributeError(name)
AttributeError: assert_called

======================================================================
FAIL: test_timeIn (tests.test_timeIn.TimeInTest)
test the timeIn.main function against time.ctime
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/test_timeIn.py", line 36, in test_timeIn
    self.assertEqual(result, time_here)
AssertionError: '6:01:13' != '06:01:13'

----------------------------------------------------------------------
Ran 20 tests in 3.959s

FAILED (failures=1, errors=1)

What do you think about implementing command line functionality to Jarvis class?

Python's Cmd class provides a simple framework for writing line-oriented command interpreters. I've been playing a little making Jarvis class to inherit from it. Here's a demo with the commands that I've implemented so far the Cmd way.

command line in jarvis

Cmd class provides tab completion, command history, ctrl-L to clear window and a lot of great tools to manage commands. This method of managing and extending Jarvis is different from the current one: Let's see clock command for example:

    def do_clock(self, s):
        """
        Gives information about time.
        """
        print(Fore.BLUE + ctime() + Fore.RESET)

    def help_clock(self):
        """
        Prints help about clock command.
        """
        print("Gives information about time.")

Quick overview of Python's Cmd class

cmd.cmdloop() is the main loop. When it is called it shows the prompt and asks user for input. When hitting enter, Cmd takes the line entered, executes a function according to it and passing to it the rest of the arguments of the line. If we enter clock it will execute the corresponding command. For a command to work, Cmd requires a function named do_command with a parameter where it will add the rest of the line. Clock's function would be do_clock, weather's do_weather... etc.

There's also help_command to show help about that command. All the commands that have a help_command function are shown in help command.

~> Hi, what can i do for you?
help

Documented commands (type help <topic>):
========================================
ask    decrease    exit     increase  near  pinpoint  remind    todo   
check  directions  goodbye  movies    news  quit      say       weather
clock  evaluate    help     music     os    reboot    shutdown

~> What can i do for you?
help clock
Gives information about time.

A command prompt is cool but I want to communicate with Jarvis using sentences too

Commands like "what about chuck", or "what's the weather like" are a cool way to interact with Jarvis. So I was thinking that we could delegate parsing small commands (<=2 words) to Cmd class and for longer ones use some natural language processing to extract the intent of the line (nltk module can do this).

For example: if we extract the nouns of what's the weather like we would get weather. We can pass it to Cmd and it will know what command to execute.

Before continuing

I've done this just for fun, because I wanted to try coding something with Cmd class. If you are interested in this I would be happy to finish it, clean it and make a pull request. I've only made changes to Jarvis.py class, here's the code if you want to take a look.

Keep up the good work! =)

import colorama error

Even I installed the colorama package

# pip list --format=legacy | grep colorama 
colorama (0.3.7)`

I got a weird import error

# python main.py
Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import os, sys, json, todo, newws, pyowm, mapps, picshow, requests, evaluator, audioHandler
  File "/root/src/Jarvis/todo.py", line 2, in <module>
    from colorama import init
ImportError: No module named colorama

Test failing for "test_say"

Right after cloning and installing dependencies, running tests with the command
python -m unittest discover
reports a failing test with this information:
AssertionError: Lists differ: ['say', "i'm", 'a', 'robot'] != ['say', "i'm", 'a', 'robot?']
(notice the ? sign)

I believe I understand why this happens and I am more than happy to solve it.
However, I am not 100% of what is the desired behaviour.

A different would be observed in behaviour if we had a single word sentence.

can you say onions?
would currently produce a slightly different pronunciation to
say onions
since the ? sign is understood as part of the sentence to be pronounced.
Notice that can you say onions and say onions produce the same output.

Basically, do I correct the test to expect the output from can you say i'm a robot? to be that of say i'm a robot? (instead of that of say i'm a robot) or do I change the code to ignore the last ? sign if the sentence of the say command starts with can or could?

Apologies for the long explanation.

Newcomer's request

Hello,
I am a newcomer to open source community and landed on this repository. I want to contribute but since I am a newcomer, I don't know how to start.

Can anyone help?

PEP8 guidelines not followed.

Docstrings are not in standard form. Spacing is not proper. Naming conventions are not followed at few places.

I can work on this issue.

will not run with Python3 pyttsx issues

tested with python 3.4 and python 3.5. There is an issue with pyttsx compatibility with python3. I have contacted the owner of the project to try and see if we can get those issues resolved.

Roadmap and development coordination

Due to studying I only have a limited amount of time for hobby projects such as this one.

So I want to spend my time as productive as possible. Right now I mostly did what I felt like regarding reminders and the to do list. But my latest feature (lexical similarity) could easily be used by more parts.

But I feel like we are missing a place to coordinate our efforts and discuss new features and the priorities of them. But these issues are definitely not the right place for this.

How are you feeling about this?

Jarvis breaks when using the near command

When trying to run the command restaurants near me within Jarvis, Jarvis breaks. This is the last part of the traceback:

  File "Jarvis/Jarvis.py", line 143, in executor
    self.cmdloop(self.first_reaction_text)
  File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "Jarvis/CmdInterpreter.py", line 319, in do_near
    near_me.main(data)
  File "Jarvis/packages/near_me.py", line 7, in main
    things = " ".join(wordList[0:wordIndex(data, "near")])
  File "Jarvis/utilities/GeneralUtilities.py", line 7, in wordIndex
    return wordList.index(word)
ValueError: 'near' is not in list

Store actions in file.

Actions which are stored in a dictionary in CmdInterpreter.py, should be stored in a file. Storing them in dictionary violates open close principle. Also, add a method add_action(*args, **kwargs), which will add actions to that file without manually opening that file. Doing this will make your code open for extension but closed for modification(Open Close Principle)

Add .coafile to repo and activate travis

Activating travis over repo and adding .coafile will reduce a lot of efforts in maintaining the code, as there are bears for python available which point out the linting errors in the PR itself. The bears will make the travis have a non zero exit code if there are linting or spacing issues, which will help maintainers a lot.
Specially SpaceConsistencyBear and PEP8Bear will be useful for python linting.

If its okay I'd like to send a PR for this.

Jokes chat

Create an action like chat action to tell some jokes. The command to activate the jokes chat should be something like "tell me a joke".

No module named 'reminder'

I'm trying to run Jarvis on python3, but the following error appears:

File "Jarvis/packages/todo.py", line 5, in <module>
    from reminder import addReminder, removeReminder
ModuleNotFoundError: No module named 'reminder'

The file reminder.py is under packages/ folder.
Do I have to change something?

Object oriented approach not followed

If you consider a feature as an Action, then there is a has-a relationship between Jarvis and Action. Also, you can make an abstract class Action, then inherit this class to define all features. Doing this will make your code more flexible and elegant.

If you like my suggestion, then I am ready to work on this issue.

can't find things in maps

I get this error when asking for restaurants nearby

Hi, What can I do for you?
restaurants near me
Hold on!, I'll show restaurants near you
Traceback (most recent call last):
File "/home/abraham/.local/share/jarvis/main.py", line 109, in
Jarvis(some)
File "/home/abraham/.local/share/jarvis/main.py", line 41, in Jarvis
mapps.nearme(data)
File "/home/abraham/.local/share/jarvis/mapps.py", line 46, in nearme
url = "https://www.google.co.in/maps/search/{1}/@{2},{3}".format(things, j['latitude'], j['longitude'])
IndexError: tuple index out of range

Adding KeyBoard shortcuts

Jarvis now exits on pressing Ctrl + C, similarly we can add different actions for different keyboard shortcuts. Don't know if it is possible. Just an idea.

Im getting this error

SyntaxError: Non-ASCII character '\xc2' in file /home/abraham/.local/share/jarvis/mapps.py on line 35, but no encoding declared

Weather doesn't work

python3 main.py Hi, What can I do for you? weather Traceback (most recent call last): File "main.py", line 110, in <module> Jarvis(some) File "main.py", line 39, in Jarvis mapps.weatherr() File "/home/matt/jarvis/mapps.py", line 34, in weatherr weath = j['main']['temp'] KeyError: 'main' zsh: exit 1 python3 main.py

Music not downloading

When trying to use the music feature with a command such as
music i was made for loving you
after picking one of the offered choices and confirming the download
Pick one: 8
Download "KISS - I Was Made For Loving You"? (y/n) y
an error occurred with the following information:
ERROR: Signature extraction failed: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 1070, in _decrypt_signature video_id, player_url, s File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 958, in _extract_signature_function raise ExtractorError('Cannot identify player %r' % player_url) ExtractorError: Cannot identify player u'https://www.youtube.com/yts/jsbin/player-vflZ_L_3c/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. (caused by ExtractorError(u"Cannot identify player u'https://www.youtube.com/yts/jsbin/player-vflZ_L_3c/en_US/base.js'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

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.