-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d4b7f95
Showing
98 changed files
with
13,776 additions
and
0 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,21 @@ | ||
.DS_Store | ||
|
||
.sass-cache | ||
|
||
css/app.css | ||
|
||
.idea | ||
|
||
js/* | ||
!js/vendor | ||
|
||
node_modules/ | ||
|
||
build/ | ||
|
||
npm-debug.log | ||
|
||
node-webkit/ | ||
|
||
website/releases/ | ||
*.swp |
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,145 @@ | ||
module.exports = (grunt) -> | ||
buildPlatforms = parseBuildPlatforms(grunt.option('platforms')) | ||
packageJson = grunt.file.readJSON('package.json') | ||
_VERSION = packageJson.version | ||
grunt.log.writeln 'Building ' + packageJson.version | ||
|
||
|
||
grunt.initConfig | ||
clean: ['build/releases/**'] | ||
|
||
coffee: | ||
compileBare: | ||
options: | ||
bare: true | ||
files: | ||
'js/app.js': ['coffee/-*.coffee', 'coffee/app.coffee', 'coffee/_*.coffee'] | ||
|
||
compass: | ||
dist: | ||
options: | ||
cssDir: 'css' | ||
files: | ||
'css/app.css': 'sass/app.sass' | ||
|
||
uglify: | ||
target: | ||
files: | ||
'js/app.js': 'js/app.js' | ||
|
||
cssmin: | ||
minify: | ||
files: | ||
'css/app.css': 'css/app.css' | ||
|
||
shell: | ||
runnw: | ||
options: | ||
stdout: true | ||
command: [ | ||
'./build/cache/mac/0.9.2/node-webkit.app/Contents/MacOS/node-webkit . --debug' | ||
, | ||
'.\\build\\cache\\win\\0.9.2\\nw.exe . --debug' | ||
].join('&') | ||
create_dmg: | ||
options: | ||
stdout: true | ||
command: './dist/mac/yoursway-create-dmg/create-dmg --volname "Atraci ' + _VERSION + '" --background ./dist/mac/background.png --window-size 480 540 --icon-size 128 --app-drop-link 240 370 --icon "Atraci" 240 110 ./build/releases/Atraci/mac/Atraci-' + _VERSION + '.dmg ./build/releases/Atraci/mac/' | ||
|
||
'regex-replace': | ||
windows_installer: | ||
src: ['dist/win/windows-installer.iss'] | ||
actions: | ||
name: 'version' | ||
search: '#define AppVersion "[\.0-9]+"' | ||
replace: '#define AppVersion "' + _VERSION + '"' | ||
|
||
nodewebkit: | ||
options: | ||
build_dir: './build' | ||
mac_icns: './images/icon.icns' | ||
mac: buildPlatforms.mac | ||
win: buildPlatforms.win | ||
linux32: buildPlatforms.linux32 | ||
linux64: buildPlatforms.linux64 | ||
src: ['./css/**', './fonts/**', './images/**', './js/**', './node_modules/**', '!./node_modules/grunt*/**', './index.html', './package.json'] | ||
|
||
copy: | ||
main: | ||
files: [ | ||
src: 'libraries/win/ffmpegsumo.dll' | ||
dest: 'build/releases/Atraci/win/Atraci/ffmpegsumo.dll' | ||
flatten: true | ||
, | ||
src: 'libraries/win/ffmpegsumo.dll' | ||
dest: 'build/cache/win/<%= nodewebkit.options.version %>/ffmpegsumo.dll' | ||
flatten: true | ||
, | ||
src: 'libraries/mac/ffmpegsumo.so' | ||
dest: 'build/releases/Atraci/mac/Atraci.app/Contents/Frameworks/node-webkit Framework.framework/Libraries/ffmpegsumo.so' | ||
flatten: true | ||
, | ||
src: 'libraries/mac/ffmpegsumo.so' | ||
dest: 'build/cache/mac/<%= nodewebkit.options.version %>/node-webkit.app/Contents/Frameworks/node-webkit Framework.framework/Libraries/ffmpegsumo.so' | ||
flatten: true | ||
, | ||
src: 'libraries/linux64/libffmpegsumo.so' | ||
dest: 'build/releases/Atraci/linux64/Atraci/libffmpegsumo.so' | ||
flatten: true | ||
, | ||
src: 'libraries/linux64/libffmpegsumo.so' | ||
dest: 'build/cache/linux64/<%= nodewebkit.options.version %>/libffmpegsumo.so' | ||
flatten: true | ||
] | ||
compress: | ||
linux32: | ||
options: | ||
mode: 'tgz' | ||
archive: 'build/releases/Atraci/linux32/Atraci-' + _VERSION + '.tgz' | ||
expand: true | ||
cwd: 'build/releases/Atraci/linux32/' | ||
src: '**' | ||
linux64: | ||
options: | ||
mode: 'tgz' | ||
archive: 'build/releases/Atraci/linux64/Atraci-' + _VERSION + '.tgz' | ||
expand: true | ||
cwd: 'build/releases/Atraci/linux64/' | ||
src: '**' | ||
|
||
|
||
|
||
grunt.loadNpmTasks 'grunt-contrib-clean' | ||
grunt.loadNpmTasks 'grunt-contrib-coffee' | ||
grunt.loadNpmTasks 'grunt-contrib-compass' | ||
grunt.loadNpmTasks 'grunt-contrib-uglify' | ||
grunt.loadNpmTasks 'grunt-contrib-cssmin' | ||
grunt.loadNpmTasks 'grunt-contrib-copy' | ||
grunt.loadNpmTasks 'grunt-shell' | ||
grunt.loadNpmTasks 'grunt-regex-replace' | ||
grunt.loadNpmTasks 'grunt-node-webkit-builder' | ||
grunt.loadNpmTasks 'grunt-contrib-compress' | ||
|
||
grunt.registerTask 'default', ['compass', 'coffee'] | ||
grunt.registerTask 'obfuscate', ['uglify', 'cssmin'] | ||
grunt.registerTask 'nodewkbuild', ['nodewebkit', 'copy'] | ||
grunt.registerTask 'run', ['default', 'shell:runnw'] | ||
grunt.registerTask 'build', ['default', 'obfuscate', 'clean', 'regex-replace', 'nodewkbuild', 'shell:create_dmg', 'compress'] | ||
|
||
parseBuildPlatforms = (argumentPlatform) -> | ||
|
||
# this will make it build no platform when the platform option is specified | ||
# without a value which makes argumentPlatform into a boolean | ||
inputPlatforms = argumentPlatform or process.platform + ';' + process.arch | ||
|
||
# Do some scrubbing to make it easier to match in the regexes bellow | ||
inputPlatforms = inputPlatforms.replace('darwin', 'mac') | ||
inputPlatforms = inputPlatforms.replace(/;ia|;x|;arm/, '') | ||
buildAll = /^all$/.test(inputPlatforms) | ||
buildPlatforms = | ||
mac: /mac/.test(inputPlatforms) or buildAll | ||
win: /win/.test(inputPlatforms) or buildAll | ||
linux32: /linux32/.test(inputPlatforms) or buildAll | ||
linux64: /linux64/.test(inputPlatforms) or buildAll | ||
|
||
buildPlatforms |
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,19 @@ | ||
The MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,64 @@ | ||
#Atraci [![Dependency Status](https://david-dm.org/Atraciapp/Atraci.svg?theme=shields.io)](https://david-dm.org/Atraciapp/Atraci) | ||
|
||
![screenshot](http://getAtraci.net/images/github_screenshot.png) | ||
|
||
## How does it work? | ||
|
||
When searching, the app will use iTunes and Last.fm to display song results (with cover, title, artist). It will then try to find the best match for this song on Youtube and stream the **highest quality audio stream**. | ||
|
||
No torrents, completely decentralized. | ||
|
||
## Contribute | ||
|
||
Join us on IRC at `#Atraciapp` on freenode ([web access](http://webchat.freenode.net/?channels=Atraciapp)). | ||
|
||
## Dependencies | ||
|
||
You will need nodejs and grunt: | ||
|
||
$ npm install -g grunt-cli | ||
|
||
And ruby with compass to build the stylesheets. Read [this](http://thesassway.com/beginner/getting-started-with-sass-and-compass) for more information. | ||
|
||
## Running and debugging | ||
|
||
Run at least once to install dependencies and generate JS and CSS files. | ||
|
||
$ npm install | ||
$ grunt | ||
|
||
Run node-webkit from the build/cache directory (--debug always on). Note that grunt build has to be done at least once before this. | ||
|
||
$ grunt run | ||
|
||
## Build | ||
|
||
Build with: | ||
|
||
$ grunt build | ||
|
||
By default it will build for your current platform however you can control that | ||
by specifying a comma separated list of platforms in the `platforms` option to | ||
grunt: | ||
|
||
$ grunt build --platforms=linux32,linux64,mac,win | ||
|
||
You can also build for all platforms with: | ||
|
||
$ grunt build --platforms=all | ||
|
||
## Release | ||
|
||
_Note: should add some grunt automation here_ | ||
|
||
1. Update `version` in `/package.json` | ||
|
||
2. `$ grunt build --platforms=mac` or just `$ grunt build` if you're on a Mac (the generated `Atraci.app` will be available in `/build/releases/Atraci/mac/`) | ||
|
||
3. Download latest Windows version of [rogerwang/node-webkit#downloads](https://github.com/rogerwang/node-webkit#downloads) and put all files in `/node-webkit/win/*` | ||
|
||
4. Open and Build `/dist/windows/windows-installer.iss` in a Windows environment (requires [Inno Setup](http://www.jrsoftware.org/isdl.php#stable) installed), this will generate `/dist/windows/Install Atraci x.x.x.exe`. You have your Windows installer! | ||
|
||
5. Upload both files to `http://download.getAtraci.net/releases/x.x.x/[mac|win]/` | ||
|
||
6. Update `/misc/update.json` accordingly and upload to `http://getAtraci.net/update.json` (*ONLY* when both releases are available for download) |
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,11 @@ | ||
Settings = | ||
get: (variable) -> | ||
localStorage['settings_' + variable] | ||
set: (variable, newValue) -> | ||
localStorage.setItem 'settings_' + variable, newValue | ||
|
||
init: -> | ||
@set('updateUrl', 'http://getatraci.net/update.json') if not @get('updateUrl') | ||
|
||
|
||
Settings.init() |
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,32 @@ | ||
# Init preparation (should be improved later) | ||
db.transaction (tx) -> | ||
tx.executeSql 'CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)' | ||
|
||
class History | ||
|
||
@clear: (success) -> | ||
db.transaction (tx) -> | ||
tx.executeSql 'DROP TABLE history' | ||
success?() | ||
|
||
@addTrack: (artist, title, cover_url_medium, cover_url_large) -> | ||
unix_timestamp = Math.round((new Date()).getTime() / 1000) | ||
db.transaction (tx) -> | ||
tx.executeSql 'CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)' | ||
tx.executeSql 'DELETE FROM history WHERE artist = ? and title = ?', [artist, title] | ||
tx.executeSql 'INSERT INTO history (artist, title, cover_url_medium, cover_url_large, last_played) VALUES (?, ?, ?, ?, ?)', [artist, title, cover_url_medium, cover_url_large, unix_timestamp] | ||
|
||
@getTracks: (success) -> | ||
tracks = [] | ||
db.transaction (tx) -> | ||
tx.executeSql 'SELECT * FROM history ORDER BY last_played DESC LIMIT 150', [], (tx, results) -> | ||
i = 0 | ||
while i < results.rows.length | ||
tracks.push results.rows.item(i) | ||
i++ | ||
success? tracks | ||
|
||
@countTracks: (success) -> | ||
db.transaction (tx) -> | ||
tx.executeSql 'SELECT COUNT(*) AS cnt FROM history', [], (tx, results) -> | ||
success? results.rows.item(0).cnt |
Empty file.
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,60 @@ | ||
# Init preparation (should be improved later) | ||
db.transaction (tx) -> | ||
tx.executeSql 'CREATE TABLE IF NOT EXISTS playlists (name, created)' | ||
|
||
__playlists = [] | ||
|
||
class Playlists | ||
|
||
@clear = (success) -> | ||
db.transaction (tx) -> | ||
tx.executeSql 'DROP TABLE playlist_tracks' | ||
tx.executeSql 'DROP TABLE playlists' | ||
success?() | ||
|
||
@addTrack: (artist, title, cover_url_medium, cover_url_large, playlist) -> | ||
unix_timestamp = Math.round((new Date()).getTime() / 1000) | ||
db.transaction (tx) -> | ||
tx.executeSql 'CREATE TABLE IF NOT EXISTS playlist_tracks (artist, title, cover_url_medium, cover_url_large, playlist, added)' | ||
tx.executeSql 'DELETE FROM playlist_tracks WHERE artist = ? and title = ? and playlist = ?', [artist, title, playlist] | ||
tx.executeSql 'INSERT INTO playlist_tracks (artist, title, cover_url_medium, cover_url_large, playlist, added) VALUES (?, ?, ?, ?, ?, ?)', [artist, title, cover_url_medium, cover_url_large, playlist, unix_timestamp] | ||
|
||
@removeTrack: (artist, title, playlist) -> | ||
db.transaction (tx) -> | ||
tx.executeSql 'DELETE FROM playlist_tracks WHERE artist = ? and title = ? and playlist = ?', [artist, title, playlist] | ||
|
||
@create: (name) -> | ||
unix_timestamp = Math.round((new Date()).getTime() / 1000) | ||
db.transaction (tx) -> | ||
tx.executeSql 'DELETE FROM playlists WHERE name = ?', [name] | ||
tx.executeSql 'INSERT INTO playlists (name, created) VALUES (?, ?)', [name, unix_timestamp] | ||
|
||
@delete: (name) -> | ||
db.transaction (tx) -> | ||
tx.executeSql 'DELETE FROM playlists WHERE name = ?', [name] | ||
tx.executeSql 'DELETE FROM playlist_tracks WHERE playlist = ?', [name] | ||
|
||
@getAll = (success) -> | ||
playlists = [] | ||
db.transaction (tx) -> | ||
tx.executeSql 'SELECT * FROM playlists ORDER BY created ASC', [], (tx, results) -> | ||
i = 0 | ||
while i < results.rows.length | ||
playlists.push results.rows.item(i) | ||
i++ | ||
__playlists = playlists | ||
success? playlists | ||
|
||
@getTracksForPlaylist = (playlist, success) -> | ||
tracks = [] | ||
db.transaction (tx) -> | ||
tx.executeSql 'SELECT * FROM playlist_tracks WHERE playlist = ? ORDER BY added DESC', [playlist], (tx, results) -> | ||
i = 0 | ||
while i < results.rows.length | ||
tracks.push results.rows.item(i) | ||
i++ | ||
success? tracks | ||
|
||
@rename: (name, new_name) -> | ||
db.transaction (tx) -> | ||
tx.executeSql 'UPDATE playlists SET name = ? WHERE name = ?', [new_name, name] |
Oops, something went wrong.