Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GuskiS committed Aug 8, 2017
0 parents commit 04dc089
Show file tree
Hide file tree
Showing 69 changed files with 8,564 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

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

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

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

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

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

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

dist
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.9.0
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
osx_image: xcode8.3

dist: trusty
sudo: false

language: node_js
node_js: "7.9.0"

env:
global:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder

os:
- linux
- osx

cache:
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- $HOME/.npm/_prebuilds

addons:
apt:
packages:
- libsecret-1-0

install:
- yarn

script:
- yarn run release:linux

before_cache:
- rm -rf $HOME/.cache/electron-builder/wine

branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# StarFM.lv Radio Player
Built with Electron 1.6.11 and Angular 4.3.3
30 changes: 30 additions & 0 deletions app/angular/.angular-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "starfm"
},
"apps": [
{
"name": "desktop",
"root": "desktop",
"outDir": "../electron/assets/desktop",
"assets": ["assets"],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"tsconfig": "tsconfig.app.json",
"prefix": "app",
"styles": [],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"defaults": {
"styleExt": "sass",
"component": {}
}
}
5 changes: 5 additions & 0 deletions app/angular/desktop/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<md-sidenav-container class="container" [class.blurred]="electron.settings.blurred">
<header header-component></header>
<main main-component></main>
<footer footer-component></footer>
</md-sidenav-container>
6 changes: 6 additions & 0 deletions app/angular/desktop/app/app.component.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../theme"

.container
transition: opacity 0.3s
&.blurred
opacity: 0.5
16 changes: 16 additions & 0 deletions app/angular/desktop/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Component, ViewEncapsulation, OnDestroy } from "@angular/core"
import { ElectronService } from "./../shared/services"

@Component({
selector: "app-root",
styleUrls: ["./app.component.sass"],
templateUrl: "./app.component.html",
encapsulation: ViewEncapsulation.None
})
export class AppComponent implements OnDestroy {
constructor(public electron: ElectronService) {}

ngOnDestroy(): void {
this.electron.clean()
}
}
16 changes: 16 additions & 0 deletions app/angular/desktop/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NgModule } from "@angular/core"
import { BrowserModule } from "@angular/platform-browser"
import { HttpClientModule } from "@angular/common/http"

import { AppComponent } from "./app.component"
import { ALL_COMPONENTS, ALL_MODULES, ALL_SERVICES } from "./../shared"

import "./rxjs"

@NgModule({
declarations: [AppComponent, ALL_COMPONENTS],
imports: [BrowserModule, HttpClientModule, ALL_MODULES],
providers: [ALL_SERVICES],
bootstrap: [AppComponent]
})
export class AppModule {}
4 changes: 4 additions & 0 deletions app/angular/desktop/app/rxjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import "rxjs/add/observable/timer"
import "rxjs/add/operator/mergeMap"
import "rxjs/add/operator/repeat"
import "rxjs/add/operator/share"
Empty file.
3 changes: 3 additions & 0 deletions app/angular/desktop/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: true
}
8 changes: 8 additions & 0 deletions app/angular/desktop/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.

export const environment = {
production: false
};
18 changes: 18 additions & 0 deletions app/angular/desktop/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<base href="./">

<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.gstatic.com/s/materialicons/v27/2fcrYFNaTjcS6g4U3t-Y5ZjZjT5FdEJ140U2DJYC3mY.woff2" type="font/woff2" rel="preload" as="font" crossorigin>
<script>
const { remote } = require("electron")
window.__electron = remote.getGlobal("electron")
</script>

</head>
<body style="background-color:#303030">
<app-root></app-root>
</body>
</html>
12 changes: 12 additions & 0 deletions app/angular/desktop/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { enableProdMode } from "@angular/core"
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"

import "hammerjs"
import { AppModule } from "./app/app.module"
import { environment } from "./environments/environment"

if (environment.production) {
enableProdMode()
}

platformBrowserDynamic().bootstrapModule(AppModule)
67 changes: 67 additions & 0 deletions app/angular/desktop/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/

/***************************************************************************************************
* BROWSER POLYFILLS
*/

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.

/** Evergreen browsers require these. **/
import "core-js/es6/reflect"
import "core-js/es7/reflect"

/**
* Required to support Web Animations `@angular/animation`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.

/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import "zone.js/dist/zone" // Included with Angular CLI.

/***************************************************************************************************
* APPLICATION IMPORTS
*/

/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
// import 'intl/locale-data/jsonp/en';
10 changes: 10 additions & 0 deletions app/angular/desktop/shared/components/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<audio #player>
<source src="https://live.advailo.com/audio/mp3/icecast.audio" type="audio/mpeg">
</audio>

<button md-icon-button type="button" (click)="click()">
<md-icon *ngIf="settings.paused">play_circle_outline</md-icon>
<md-icon *ngIf="!settings.paused">pause_circle_filled</md-icon>
</button>

<md-slider min="0.01" max="1" step="0.005" [value]="player.volume" color="primary" (change)="volumeChange($event)" (input)="volumeSlide($event)"></md-slider>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
\:host::ng-deep
display: flex
align-items: center
.mat-slider
width: 100%
margin-right: 6px
57 changes: 57 additions & 0 deletions app/angular/desktop/shared/components/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { Component, ViewChild, ElementRef, OnInit } from "@angular/core"
import { ElectronService } from "./../../services"

@Component({
selector: "[footer-component]",
styleUrls: ["./footer.component.sass"],
templateUrl: "./footer.component.html"
})
export class FooterComponent implements OnInit {
settings: AppInterface
@ViewChild("player") player: ElementRef

constructor(public electron: ElectronService) {
this.settings = this.electron.settings
this.electron.observable.subscribe(settings => {
if (settings.paused !== this.settings.paused) {
this.pauseOrUnpause(settings.paused)
}

this.settings = settings
})
}

ngOnInit(): void {
const player = this.player.nativeElement
const { volume, paused } = this.electron.settings

player.autoplay = true
player.volume = volume
if (paused) {
player.pause()
}
}

click(): void {
this.electron.app.set("paused", !this.settings.paused)
}

pauseOrUnpause(paused: boolean): void {
const player = this.player.nativeElement

if (paused) {
player.pause()
} else {
player.load()
player.play()
}
}

volumeSlide({ value }: { value: number }): void {
this.player.nativeElement.volume = value
}

volumeChange({ value }: { value: number }): void {
this.electron.app.set("volume", value)
}
}
Loading

0 comments on commit 04dc089

Please sign in to comment.