Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from mlsof21/always-listening
Always listening
- Loading branch information
Showing
16 changed files
with
583 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{js,ts}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
Pillow==9.2.0 | ||
gitdb==4.0.9 | ||
GitPython==3.1.27 | ||
Pillow==9.2.0 | ||
smmap==5.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
Oops, something went wrong.