Skip to content

Commit

Permalink
Updated to twitchemotes.com v3 API, added bad channel entries, added …
Browse files Browse the repository at this point in the history
….gitignore file
  • Loading branch information
melalawi committed Sep 21, 2017
1 parent a024c82 commit 15a0d47
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 25 deletions.
86 changes: 86 additions & 0 deletions .gitignore
@@ -0,0 +1,86 @@
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Node template
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history
# Created by .ignore support plugin (hsz.mobi)

.idea/
bin/
build/
release/
12 changes: 8 additions & 4 deletions build.js
Expand Up @@ -35,16 +35,20 @@ function init() {
var buildMode = VALID_BUILD_MODES.indexOf(process.argv[2].toLowerCase()) === -1 ? 'test': process.argv[2].toLowerCase();

if (browser === 'all') {
console.log('No browser was specified (or specified browser is not one of [' + VALID_BROWSERS.join(' | ') + '])');
console.log('No browser was specified.');
console.log('Building for all browsers...');

buildAllBrowsers(buildMode).then(function() {
console.log('Complete.');
});
} else {
build(browser, buildMode).then(function() {
console.log('Complete.');
});
if (VALID_BROWSERS.indexOf(browser) === -1) {
console.log('Specified browser "' + browser + '" is not one of [' + VALID_BROWSERS.join(' | ') + '])');
} else {
build(browser, buildMode).then(function() {
console.log('Complete.');
});
}
}
}

Expand Down
21 changes: 11 additions & 10 deletions src/common/background/hosts/twitchChannels.js
@@ -1,16 +1,18 @@
var URL = 'https://twitchemotes.com/api_cache/v2/subscriber.json';
var URL = 'https://twitchemotes.com/api_cache/v3/subscriber.json';
var BASE_EMOTE_URL = 'https://static-cdn.jtvnw.net/emoticons/v1/{EMOTE_ID}/1.0';
var OLD_CHANNELS = [
'90stardust',
'agetv1',
'beyondthesummit',
'canadacup',
'delovely',
'esg',
'fahr3nh3it_ftw',
'fahr3nh3it_',
'fwiz',
'gomexp_2014_season_two',
'gsl',
'ilastpack',
'jeromewnl',
'jewelxo',
'lcs_pros_in_koreansoloq',
'nadeshot',
Expand All @@ -28,20 +30,19 @@ var OLD_CHANNELS = [


function parseEmotes(json) {
var channels = json.channels;
var templateURL = json.template.small;
var result = {};

for (var emoteChannel in channels) {
if (channels.hasOwnProperty(emoteChannel)) {
var emotes = channels[emoteChannel].emotes;
for (var entry in json) {
if (json.hasOwnProperty(entry)) {
var emoteChannel = json[entry].channel_name;
var emotes = json[entry].emotes;
var isOldChannel = OLD_CHANNELS.indexOf(emoteChannel.toLowerCase()) !== -1;

for (var i = 0; i < emotes.length; ++i) {
var emoteKey = isOldChannel ? emoteChannel + emotes[i].code : emotes[i].code;
var code = isOldChannel ? emoteChannel + emotes[i].code : emotes[i].code;

result[emoteKey] = {
url: templateURL.replace('{image_id}', emotes[i].image_id),
result[code] = {
url: BASE_EMOTE_URL.replace('{EMOTE_ID}', emotes[i].id),
channel: emoteChannel
};
}
Expand Down
11 changes: 5 additions & 6 deletions src/common/background/hosts/twitchGlobal.js
@@ -1,15 +1,14 @@
var URL = 'https://twitchemotes.com/api_cache/v2/global.json';
var URL = 'https://twitchemotes.com/api_cache/v3/global.json';
var BASE_EMOTE_URL = 'https://static-cdn.jtvnw.net/emoticons/v1/{EMOTE_ID}/1.0';


function parseEmotes(json) {
var emotes = json.emotes;
var templateURL = json.template.small;
var result = {};

for (var emoteKey in emotes) {
if (emotes.hasOwnProperty(emoteKey)) {
for (var emoteKey in json) {
if (json.hasOwnProperty(emoteKey)) {
result[emoteKey] = {
url: templateURL.replace('{image_id}', emotes[emoteKey].image_id),
url: BASE_EMOTE_URL.replace('{EMOTE_ID}', json[emoteKey].id),
channel: ''
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/background/httpRequest.js
@@ -1,4 +1,4 @@
var TIMEOUT = 3000;
var TIMEOUT = 10000;
var TOTAL_RETRIES = 2;


Expand Down
2 changes: 1 addition & 1 deletion src/edge/metadata/manifest.json
Expand Up @@ -5,7 +5,7 @@
"short_name": "GTE",
"author": "Mohamed El-Alawi",
"description": "Twitch culture wherever you go! This extension replaces all Twitch.tv emote phrases with their actual emoticons.",
"version": "1.2.1009",
"version": "1.2.1010",

"background": {
"persistent": true,
Expand Down
2 changes: 1 addition & 1 deletion src/firefox/metadata/manifest.json
Expand Up @@ -12,7 +12,7 @@
"name": "Global Twitch Emotes",
"short_name": "GTE",
"description": "Twitch culture wherever you go! This extension replaces all Twitch.tv emote phrases with their actual emoticons.",
"version": "1.2.1009",
"version": "1.2.1010",

"background": {
"scripts": ["background.js"]
Expand Down
4 changes: 2 additions & 2 deletions src/webkit/metadata/manifest.json
Expand Up @@ -4,8 +4,8 @@
"name": "Global Twitch Emotes",
"short_name": "GTE",
"description": "Twitch culture wherever you go! This extension replaces all Twitch.tv emote phrases with their actual emoticons.",
"version": "1.2.1009",
"version_name": "1.2.0 Beta",
"version": "1.2.1010",
"version_name": "1.2.0",

"background": {
"persistent": true,
Expand Down

0 comments on commit 15a0d47

Please sign in to comment.