-
Notifications
You must be signed in to change notification settings - Fork 32
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 #23 from resin-io-projects/0.5
adapt to resinOS 2.0 and include stereo
- Loading branch information
Showing
33 changed files
with
643 additions
and
281 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 |
---|---|---|
@@ -1,6 +1,22 @@ | ||
pcm.!default { | ||
type hw card 0 | ||
pcm.hifiberry { | ||
type hw card 0 | ||
} | ||
ctl.!default { | ||
type hw card 0 | ||
|
||
pcm.!default { | ||
type plug | ||
slave.pcm "dmixer" | ||
} | ||
|
||
pcm.dmixer { | ||
type dmix | ||
ipc_key 1024 | ||
slave { | ||
pcm "hifiberry" | ||
channels 2 | ||
} | ||
} | ||
|
||
ctl.dmixer { | ||
type hw | ||
card 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
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,20 +1,20 @@ | ||
{ | ||
"name": "resin-wifi-connect", | ||
"version": "0.0.0", | ||
"homepage": "https://github.com/pcarranzav/resin-wifi-connect", | ||
"authors": [ | ||
"Pablo Carranza Vélez <[email protected]>" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"src/public/bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"bootstrap": "~3.3.5" | ||
} | ||
"name": "resin-wifi-connect", | ||
"version": "2.0.0", | ||
"homepage": "https://github.com/pcarranzav/resin-wifi-connect", | ||
"authors": [ | ||
"Pablo Carranza Vélez <[email protected]>" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"src/public/bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"bootstrap": "~3.3.5" | ||
} | ||
} |
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,89 +1,89 @@ | ||
{ | ||
const fs = require('fs'); | ||
const ini = require('ini'); | ||
const exec = require('child_process').exec; | ||
const chalk = require("chalk"); | ||
const request = require('request'); | ||
const display = require(__dirname + '/libs/ledmatrix/index.js'); | ||
const supervisor = require(__dirname + '/libs/supervisor/index.js'); | ||
const emoji = require(__dirname + '/libs/emoji/index.js'); | ||
const debug = require('debug')('main'); | ||
const fs = require('fs'); | ||
const ini = require('ini'); | ||
const exec = require('child_process').exec; | ||
const chalk = require("chalk"); | ||
const request = require('request'); | ||
const display = require(__dirname + '/libs/ledmatrix/index.js'); | ||
const supervisor = require(__dirname + '/libs/supervisor/index.js'); | ||
const emoji = require(__dirname + '/libs/emoji/index.js'); | ||
const debug = require('debug')('main'); | ||
|
||
let mopidy = ini.parse(fs.readFileSync('/etc/mopidy/mopidy.conf', 'utf-8')); | ||
console.log(chalk.cyan('configuring Mopidy from env vars...')); | ||
let updating = false; | ||
let mopidy = ini.parse(fs.readFileSync('/etc/mopidy/mopidy.conf', 'utf-8')); | ||
console.log(chalk.cyan('configuring Mopidy from env vars...')); | ||
let updating = false; | ||
|
||
// http config | ||
mopidy.http.port = parseInt(process.env.MOPIDY_HTTP_PORT) || 8080; | ||
// mpd config | ||
mopidy.mpd.port = parseInt(process.env.MOPIDY_MPD_PORT) || 6680; | ||
// audio config | ||
mopidy.audio.mixer_volume = parseInt(process.env.MOPIDY_AUDIO_MIXER_VOLUME) || 50; | ||
// Google Play Music config | ||
mopidy.gmusic.enabled = process.env.MOPIDY_GMUSIC_ENABLED === '1' ? true : false; | ||
mopidy.gmusic.username = process.env.MOPIDY_GMUSIC_USERNAME || "none"; | ||
mopidy.gmusic.password = process.env.MOPIDY_GMUSIC_PASSWORD || "none"; | ||
mopidy.gmusic.all_access = process.env.MOPIDY_GMUSIC_ALL_ACCESS === '1' ? true : false; | ||
// Spotify config | ||
mopidy.spotify.enabled = process.env.MOPIDY_SPOTIFY_ENABLED === '1' ? true : false; | ||
mopidy.spotify.username = process.env.MOPIDY_SPOTIFY_USERNAME || "none"; | ||
mopidy.spotify.password = process.env.MOPIDY_SPOTIFY_PASSWORD || "none"; | ||
// Soundcloud config | ||
mopidy.soundcloud.enabled = process.env.MOPIDY_SOUNDCLOUD_ENABLED === '1' ? true : false; | ||
mopidy.soundcloud.auth_token = process.env.MOPIDY_SOUNDCLOUD_AUTH_TOKEN || "none"; | ||
// YouTube config | ||
mopidy.youtube.enabled = process.env.MOPIDY_YOUTUBE_ENABLED === '1' ? true : false; | ||
// http config | ||
mopidy.http.port = parseInt(process.env.MOPIDY_HTTP_PORT) || 8080; | ||
// mpd config | ||
mopidy.mpd.port = parseInt(process.env.MOPIDY_MPD_PORT) || 6680; | ||
// audio config | ||
mopidy.audio.mixer_volume = parseInt(process.env.MOPIDY_AUDIO_MIXER_VOLUME) || 50; | ||
// Google Play Music config | ||
mopidy.gmusic.enabled = process.env.MOPIDY_GMUSIC_ENABLED === '1' ? true : false; | ||
mopidy.gmusic.username = process.env.MOPIDY_GMUSIC_USERNAME || "none"; | ||
mopidy.gmusic.password = process.env.MOPIDY_GMUSIC_PASSWORD || "none"; | ||
mopidy.gmusic.all_access = process.env.MOPIDY_GMUSIC_ALL_ACCESS === '1' ? true : false; | ||
// Spotify config | ||
mopidy.spotify.enabled = process.env.MOPIDY_SPOTIFY_ENABLED === '1' ? true : false; | ||
mopidy.spotify.username = process.env.MOPIDY_SPOTIFY_USERNAME || "none"; | ||
mopidy.spotify.password = process.env.MOPIDY_SPOTIFY_PASSWORD || "none"; | ||
// Soundcloud config | ||
mopidy.soundcloud.enabled = process.env.MOPIDY_SOUNDCLOUD_ENABLED === '1' ? true : false; | ||
mopidy.soundcloud.auth_token = process.env.MOPIDY_SOUNDCLOUD_AUTH_TOKEN || "none"; | ||
// YouTube config | ||
mopidy.youtube.enabled = process.env.MOPIDY_YOUTUBE_ENABLED === '1' ? true : false; | ||
|
||
fs.writeFileSync('/etc/mopidy/mopidy.conf', ini.stringify(mopidy)); | ||
console.log(chalk.cyan('starting Mopidy - HTTP port:' + mopidy.http.port + ' (proxy on port 80); MPD port:' + mopidy.mpd.port)); | ||
display.init(() => { | ||
'use strict'; | ||
display.image(display.presets.splash); | ||
}); | ||
exec('systemctl start mopidy', (error, stdout, stderr) => { | ||
'use strict'; | ||
if (error) { | ||
console.log(chalk.red(`exec error: ${error}`)); | ||
return; | ||
} | ||
console.log(chalk.green(`stdout: ${stdout}`)); | ||
console.log(chalk.red(`stderr: ${stderr}`)); | ||
}); | ||
fs.writeFileSync('/etc/mopidy/mopidy.conf', ini.stringify(mopidy)); | ||
console.log(chalk.cyan('starting Mopidy - HTTP port:' + mopidy.http.port + ' (proxy on port 80); MPD port:' + mopidy.mpd.port)); | ||
display.init(() => { | ||
'use strict'; | ||
display.image(display.presets.splash); | ||
}); | ||
exec('systemctl start mopidy', (error, stdout, stderr) => { | ||
'use strict'; | ||
if (error) { | ||
console.log(chalk.red(`exec error: ${error}`)); | ||
return; | ||
} | ||
console.log(chalk.green(`stdout: ${stdout}`)); | ||
console.log(chalk.red(`stderr: ${stderr}`)); | ||
}); | ||
|
||
supervisor.start(500, () => { | ||
'use strict'; | ||
supervisor.on('status', (status) => { | ||
console.log(chalk.white('Supervisor status update: ' + status)); | ||
switch (status) { | ||
case "Idle": | ||
display.image(display.presets.smile); | ||
break; | ||
case "Installing": | ||
display.image(display.presets.busy); | ||
break; | ||
case "Downloading": | ||
display.image(display.presets.download); | ||
break; | ||
case "Starting": | ||
display.image(display.presets.fwd); | ||
break; | ||
case "Stopping": | ||
display.image(display.presets.stop); | ||
break; | ||
} | ||
}); | ||
supervisor.start(500, () => { | ||
'use strict'; | ||
supervisor.on('status', (status) => { | ||
console.log(chalk.white('Supervisor status update: ' + status)); | ||
switch (status) { | ||
case "Idle": | ||
display.image(display.presets.smile); | ||
break; | ||
case "Installing": | ||
display.image(display.presets.busy); | ||
break; | ||
case "Downloading": | ||
display.image(display.presets.download); | ||
break; | ||
case "Starting": | ||
display.image(display.presets.fwd); | ||
break; | ||
case "Stopping": | ||
display.image(display.presets.stop); | ||
break; | ||
} | ||
}); | ||
}); | ||
|
||
emoji.start(() => { | ||
'use strict'; | ||
emoji.on('emoji', (emoji) => { | ||
console.log(chalk.magenta('new emoji received! applying...')); | ||
display.image(emoji); | ||
}); | ||
emoji.on('reset', (emoji) => { | ||
console.log(chalk.magenta('emoji reset request received! applying...')); | ||
display.image(display.presets.smile); | ||
}); | ||
emoji.start(() => { | ||
'use strict'; | ||
emoji.on('emoji', (emoji) => { | ||
console.log(chalk.magenta('new emoji received! applying...')); | ||
display.image(emoji); | ||
}); | ||
emoji.on('reset', (emoji) => { | ||
console.log(chalk.magenta('emoji reset request received! applying...')); | ||
display.image(display.presets.smile); | ||
}); | ||
}); | ||
|
||
} |
Oops, something went wrong.