Skip to content

Commit

Permalink
Merge pull request #17 from mlsof21/always-listening
Browse files Browse the repository at this point in the history
Always listening
  • Loading branch information
mlsof21 committed Sep 25, 2022
2 parents b33b49e + f9d6355 commit 4a15c50
Show file tree
Hide file tree
Showing 16 changed files with 583 additions and 259 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
@@ -0,0 +1,7 @@
[*.py]
indent_style = space
indent_size = 4

[*.{js,ts}]
indent_style = space
indent_size = 2
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,10 @@
### 1.2.0 - 2022-09-24 - Always Listening

- Added a toggle-able `Always Listening` mode
- Each command must be prefixed with an activation phrase (defaulted to `okay ghost`)
- Added fix for `maxPower` command (didn't work in normal DIM, only in beta)
- Added fix for search already being populated when performing a command.

### 1.1.3 - 2022-09-20 - Perk fix

- Fixed perk matching
Expand Down
28 changes: 26 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "voice-dim",
"version": "1.1.3",
"version": "1.2.0",
"description": "Perform common DIM actions by using speech recognition.",
"main": "dist/chrome/js/voice-dim.js",
"scripts": {
Expand Down Expand Up @@ -29,9 +29,11 @@
},
"homepage": "https://github.com/mlsof21/voice-dim#readme",
"dependencies": {
"annyang": "^2.6.1",
"fuse.js": "^6.6.2"
},
"devDependencies": {
"@types/annyang": "^2.6.2",
"@types/chrome": "^0.0.193",
"@types/web": "^0.0.1",
"@typescript/lib-dom": "npm:@types/web@^0.0.71",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.chrome.json
@@ -1,7 +1,7 @@
{
"name": "Voice DIM",
"description": "Control DIM with your voice.",
"version": "1.1.3",
"version": "1.2.0",
"manifest_version": 3,
"background": {
"service_worker": "js/background.js"
Expand Down
92 changes: 46 additions & 46 deletions public/manifest.firefox.json
@@ -1,46 +1,46 @@
{
"name": "Voice DIM",
"description": "Control DIM with your voice.",
"version": "1.1.3",
"manifest_version": 2,
"background": {
"scripts": ["js/background.js"]
},
"content_scripts": [
{
"matches": ["https://*.destinyitemmanager.com/*"],
"js": ["js/voiceDim.js"],
"css": ["css/voiceDim.css"]
}
],
"commands": {
"dim-listen": {
"suggested_key": {
"default": "Ctrl+Shift+0"
},
"description": "Start/Stop listening for DIM commands"
}
},
"browser_action": {
"default_icon": "icons/icon_128.png",
"default_title": "Voice DIM"
},
"icons": {
"16": "icons/icon_16.png",
"32": "icons/icon_32.png",
"48": "icons/icon_48.png",
"128": "icons/icon_128.png"
},
"options_ui": {
"page": "html/options.html",
"open_in_tab": true
},
"permissions": [
"tabs",
"storage",
"https://www.bungie.net/Platform/Destiny2/Manifest",
"https://www.bungie.net/common/**",
"https://api.speechly.com/**"
],
"web_accessible_resources": ["icons/icon_large.png"]
}
{
"name": "Voice DIM",
"description": "Control DIM with your voice.",
"version": "1.2.0",
"manifest_version": 2,
"background": {
"scripts": ["js/background.js"]
},
"content_scripts": [
{
"matches": ["https://*.destinyitemmanager.com/*"],
"js": ["js/voiceDim.js"],
"css": ["css/voiceDim.css"]
}
],
"commands": {
"dim-listen": {
"suggested_key": {
"default": "Ctrl+Shift+0"
},
"description": "Start/Stop listening for DIM commands"
}
},
"browser_action": {
"default_icon": "icons/icon_128.png",
"default_title": "Voice DIM"
},
"icons": {
"16": "icons/icon_16.png",
"32": "icons/icon_32.png",
"48": "icons/icon_48.png",
"128": "icons/icon_128.png"
},
"options_ui": {
"page": "html/options.html",
"open_in_tab": true
},
"permissions": [
"tabs",
"storage",
"https://www.bungie.net/Platform/Destiny2/Manifest",
"https://www.bungie.net/common/**",
"https://api.speechly.com/**"
],
"web_accessible_resources": ["icons/icon_large.png"]
}
5 changes: 4 additions & 1 deletion scripts/requirements.txt
@@ -1 +1,4 @@
Pillow==9.2.0
gitdb==4.0.9
GitPython==3.1.27
Pillow==9.2.0
smmap==5.0.0
93 changes: 93 additions & 0 deletions scripts/update_version.py
@@ -0,0 +1,93 @@
import getopt
import json
import os
import sys

import git


def get_git_root(path):
git_repo = git.Repo(path, search_parent_directories=True)
git_root = git_repo.git.rev_parse("--show-toplevel")
return git_root


def read_version_from_file(file_path: str):
with open(file_path, 'r') as f:
data = json.load(f)
return data['version']


def get_next_version(current_version: str, part_to_update: str):
split_version = current_version.split('.')
major_version = int(split_version[0])
minor_version = int(split_version[1])
bugfix_version = int(split_version[2])

if part_to_update == 'major':
major_version = major_version + 1
minor_version = 0
bugfix_version = 0
if part_to_update == 'minor':
minor_version = minor_version + 1
bugfix_version = 0
if part_to_update == "bugfix":
bugfix_version = bugfix_version + 1

return f"{major_version}.{minor_version}.{bugfix_version}"


def write_new_version(file_path, new_version):
with open(file_path, 'r') as f:
data = json.load(f)

data['version'] = f"{new_version}"

with open(file_path, 'w') as f:
json.dump(data, f, indent=4)


def main():
argument_list = sys.argv[1:]
options = 'p:'
long_options = "part="
# Parsing argument
arguments, values = getopt.getopt(argument_list, options, long_options)
part = 'bugfix'
# checking each argument
for current_arg, current_value in arguments:

if current_arg in ("-p", "--part"):
if current_value in ('major', 'minor', 'bugfix'):
part = current_value
else:
print("No part provided. Updating the bugfix version by default")

git_root = get_git_root(os.getcwd())
files = [git_root + '/public/manifest.chrome.json', git_root +
'/public/manifest.firefox.json', git_root+'/package.json']
versions = []
for file in files:
versions.append(read_version_from_file(file))

versions = list(set(versions))
current_version = versions[0]

if len(versions) > 1:
input_string = "More than one version detected. What is the correct most recent version?"
for index, v in enumerate(versions):
input_string = f"\n{input_string}\n {(index + 1)}. {v}"
input_string = input_string+"\n"
user_input = input(input_string)
current_version = versions[int(user_input)-1]
print(current_version)

next_version = get_next_version(current_version, part)
print(next_version)

for file in files:
write_new_version(file, next_version)


if __name__ == "__main__":
main()

0 comments on commit 4a15c50

Please sign in to comment.