Skip to content

Commit 2634c71

Browse files
committed
Initinal Code add on first commit
Current Version: Beta 0.1.0
0 parents  commit 2634c71

35 files changed

+54548
-0
lines changed

README-Files/screen.png

41.7 KB
Loading

README-Files/struct.png

443 KB
Loading

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#YouTube Audio Player - Simple
2+
3+
![Image Screenshot](./README-Files/screen.png)
4+
5+
It is a small nice distraction-free YouTube Audio Player
6+
7+
## Features
8+
9+
- Search Musik on YouTube
10+
- Play your Playlists
11+
- Create new Playlists
12+
- Add new Musik to Playlists
13+
- Login on Google/YouTube over Google API
14+
15+
## Development:
16+
17+
### getting started
18+
19+
```
20+
npm install
21+
sudo npm install
22+
sudo npm install electron-prebuilt -g
23+
npm run build
24+
npm run electron
25+
```
26+
27+
### set in development
28+
run translater: `npm run watch`
29+
run application: `npm run electron`
30+
31+
## Build:
32+
linux x64:
33+
```
34+
electron-packager . YTplayer --platform=linux --arch=x64 --version=0.36.4 --overwrite --ignore="node_modules/(electron-packager|electron-prebuilt)" --ignore=release
35+
```
36+
OR `electron-packager-interactive`
37+
38+
39+
## How it works
40+
41+
![Struct](./README-Files/struct.png)

app/GoAuth.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var http = require('http');
2+
3+
// YouTube Audio Player - only for development
4+
var ClientID = '381192082009-l8t89vtuinh2qjint5lmohcm0tvl7l20.apps.googleusercontent.com';
5+
var ApiKey = 'AIzaSyBT42EqbWvSYTSKC0mkV1liDY1aR7Dj9NA';
6+
var ClientSecret = '3thinlyfW5DOYQ8TBKUn1uos';
7+
var RedirectUrl = 'urn:ietf:wg:oauth:2.0:oob';
8+
9+
10+
var GoAuth = function() {
11+
12+
var GetKey = function(callback) {
13+
callback({
14+
CLIENT_ID : ClientID,
15+
API_KEY : ApiKey,
16+
CLIENT_SECRET : ClientSecret,
17+
REDIRECT_URL : RedirectUrl,
18+
});
19+
}
20+
21+
return {
22+
getKey: GetKey
23+
}
24+
}();
25+
26+
module.exports = GoAuth;

app/app.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import {bootstrap} from 'angular2/platform/browser';
2+
import {Component, View, NgZone} from 'angular2/core';
3+
import {NgFor} from 'angular2/common';
4+
import {Resultlist} from './components/resultlist/resultlist';
5+
import {Search} from './components/search/search';
6+
import {Player} from './components/player/player';
7+
import {Sidebar} from './components/sidebar/sidebar';
8+
import {ResultService} from './components/resultlist/resultservice';
9+
import {SysCom} from './components/syscom';
10+
import {PlaylistService} from './components/sidebar/sidebarservice';
11+
12+
const electron = require('electron');
13+
const ipc = electron.ipcRenderer;
14+
15+
@Component({
16+
selector: 'app'
17+
})
18+
@View({
19+
directives: [Search, Resultlist, Player, Sidebar],
20+
template: `
21+
<div id="SearchAndResult" flex="80">
22+
<search></search>
23+
<resultlist></resultlist>
24+
</div>
25+
<sidebar id="SidebarMain" flex=20></sidebar>
26+
<player id="PlayerMain"></player>
27+
` ,
28+
styles: [`
29+
#SearchAndResult {
30+
height: calc(100% - 90px);
31+
}
32+
#SidebarMain {
33+
/*max-height: 270px;*/
34+
height: calc(100% - 90px);
35+
}
36+
#PlayerMain {
37+
margin: 5px;
38+
height: 80px;
39+
}
40+
`]
41+
})
42+
43+
export class App {
44+
45+
constructor() {}
46+
}
47+
48+
bootstrap(App, [ResultService, SysCom, PlaylistService]);

app/components/mainservice.ts_old

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import {Injectable, EventEmitter} from 'angular2/core';
2+
3+
const electron = require('electron');
4+
const ipc = electron.ipcRenderer;
5+
6+
/*export interface Result {
7+
videoId: string;
8+
title: string;
9+
thumbnail: string;
10+
channel: string;
11+
}*/
12+
13+
@Injectable()
14+
export class MainService{
15+
16+
_remitter : EventEmitter<any>;
17+
resultlistcontent : Object[] = [];
18+
19+
_pemitter : EventEmitter<any>;
20+
toplay : Object;
21+
22+
constructor() {
23+
24+
this._remitter = new EventEmitter();
25+
this._remitter.emit(null);
26+
27+
this._pemitter = new EventEmitter();
28+
this._pemitter.emit(null);
29+
30+
//this.resultlistcontent.push({videoId: '', title: 'Resultlist...', thumbnail: '', channel: 'test'});
31+
//this.resultlistcontent.push({videoId: "ZTVNgzvxoV0", title: "The Best Of Vocal Deep House Chill Out Music 2015",
32+
//thumbnail: "https://i.ytimg.com/vi/ZTVNgzvxoV0/default.jpg", channel: 'test'});
33+
34+
ipc.on('search-result', (event, arg) => {
35+
this.resultlistcontent = [];
36+
for (var i = 0; i < arg.pageInfo.resultsPerPage; i ++) {
37+
var tmpid = arg.items[i].id;
38+
var tmpsnip = arg.items[i].snippet;
39+
var titlelong = tmpsnip.title;
40+
if (titlelong.length > 40) {
41+
titlelong = titlelong.substring(0, 37) + '...';
42+
}
43+
this.resultlistcontent.push( { videoId: tmpid.videoId,
44+
title: titlelong,
45+
thumbnail: tmpsnip.thumbnails.default.url,
46+
channel: tmpsnip.channelTitle});
47+
}
48+
this._remitter.next({"id": "yresult", "data" : this.resultlistcontent});
49+
})
50+
}
51+
52+
getList(){
53+
return this.resultlistcontent;
54+
}
55+
56+
playAudio() {
57+
console.log("mainservice: " + this.toplay);
58+
this._remitter.next({"id": "playaudio", "data" : this.toplay});
59+
}
60+
61+
}

app/components/player/player.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<div style="height: 70px; width: 100%; bottom: 0px;">
2+
3+
<div *ngIf="playeraktive">
4+
5+
<button md-button (click)="jumpbackward()" class="md-icon-button md-primary"
6+
aria-label="Settings" data-toggle="tooltip" title="Replay 30s">
7+
<i class="material-icons">replay_30</i>
8+
</button>
9+
10+
<button md-button *ngIf="!playstop" (click)="play()" class="md-icon-button md-primary"
11+
aria-label="Settings" data-toggle="tooltip" title="Play">
12+
<i class="material-icons">play_circle_filled</i>
13+
</button>
14+
<button md-button *ngIf="playstop" (click)="pause()" class="md-icon-button md-primary"
15+
aria-label="Settings" data-toggle="tooltip" title="Pause">
16+
<i class="material-icons">pause_circle_filled</i>
17+
</button>
18+
<button md-button (click)="jumpforward()" class="md-icon-button md-primary"
19+
aria-label="Settings" data-toggle="tooltip" title="Jump 30s forward">
20+
<i class="material-icons">forward_30</i>
21+
</button>
22+
23+
<button md-button *ngIf="playlist" (click)="prev()" class="md-icon-button md-primary"
24+
aria-label="Settings" data-toggle="tooltip" title="Play previous">
25+
<i class="material-icons">skip_previous</i>
26+
</button>
27+
<button md-button *ngIf="playlist" (click)="next()" class="md-icon-button md-primary"
28+
aria-label="Settings" data-toggle="tooltip" title="Play next">
29+
<i class="material-icons">skip_next</i>
30+
</button>
31+
<button md-button *ngIf="!shuffle && playlist" (click)="shufflePlaylist()" class="md-icon-button md-primary"
32+
aria-label="Settings" data-toggle="tooltip" title="Shuffle Playlist">
33+
<i class="material-icons">shuffle</i>
34+
</button>
35+
<button md-button *ngIf="shuffle && playlist" (click)="shufflePlaylist()" class="md-icon-button md-primary"
36+
aria-label="Settings" data-toggle="tooltip" title="Undo Shuffle Playlist">
37+
<i class="material-icons">shuffle</i>
38+
</button>
39+
40+
|
41+
<button md-button *ngIf="!mute" (click)="volmute()" class="md-icon-button md-primary"
42+
aria-label="Settings" data-toggle="tooltip" title="Mute volume">
43+
<i class="material-icons">volume_up</i>
44+
</button>
45+
<button md-button *ngIf="mute" (click)="unvolmute()" class="md-icon-button md-primary"
46+
aria-label="Settings" data-toggle="tooltip" title="Unmute volume">
47+
<i class="material-icons">volume_mute</i>
48+
</button>
49+
50+
<button md-button (click)="setVolumeDown()" class="md-icon-button md-primary"
51+
aria-label="Settings" data-toggle="tooltip" title="Set volume down">
52+
<i class="material-icons">remove_circle</i>
53+
</button>
54+
<button md-button (click)="setVolumeUp()" class="md-icon-button md-primary"
55+
aria-label="Settings" data-toggle="tooltip" title="Set volume up">
56+
<i class="material-icons">add_circle</i>
57+
</button>
58+
59+
60+
<div *ngIf="!errorbox" id="contentplaybox">
61+
<img id="currentplay" [src]="thumbnail" class="md-avatar"/>
62+
<div id="playtitle">{{title}}</div>
63+
</div>
64+
<div *ngIf="errorbox" id="contentplaybox">
65+
{{errorcontent}}
66+
</div>
67+
68+
</div>
69+
70+
<div id="ytcontent" style="display: none; margin-top: 30px;">
71+
</div>
72+
</div>

0 commit comments

Comments
 (0)