-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Soundcloud #50
base: master
Are you sure you want to change the base?
Soundcloud #50
Changes from 7 commits
a72adf1
271afb6
52958a0
6bbe657
a3182c8
21690b6
59ce56d
9e7edaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
web: bundle exec rails server Puma | ||
worker: bundle exec sidekiq -q push,5 -q indexing,2 -q archiving,1 -c 10 | ||
push: bundle exec thin start -R push/faye.ru -p 9292 -e production | ||
search: bundle exec springboard -c config/elasticsearch -f | ||
search: bundle exec springboard -c config/elasticsearch -f | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Get rid of the changes in this file: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="breadcrumbs"> | ||
<a href="/" data-relative="true">Sources</a> | ||
» | ||
<span class="current">SoundCloud</span> | ||
</div> | ||
|
||
<h2>SoundCloud</h2> | ||
|
||
<input type="text" id="soundcloud_query"/> | ||
<a href="#" class="button" id="soundcloud_search">Search</a> | ||
|
||
<div id="soundcloud_search_results"></div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<audio class="scpreview-player" controls="controls" src="{{url}}" type="audio/mp3" autoplay /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<ul> | ||
{{#results}} | ||
<li> | ||
<a href="#" class="entry" data-id="{{index}}"> | ||
<img src="{{thumbnail}}" class="thumbnail" /> | ||
<div class="title">{{title}}</div> | ||
<div class="author">{{author}}</div> | ||
</a> | ||
<div class="scpreview" data-soundcloud="{{url}}"><a href='#'>preview</a></div> | ||
</li> | ||
{{/results}} | ||
</ul> | ||
|
||
{{#if hasPrev}} | ||
<a href="#" class="paging button" id="previous_results"> | ||
<span class="pictos">[</span> | ||
Previous | ||
</a> | ||
{{/if}} | ||
|
||
{{#if hasNext}} | ||
<a href="#" class="paging button" id="next_results"> | ||
Next | ||
<span class="pictos">]</span> | ||
</a> | ||
{{/if}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#= require ui/application/panes/pane | ||
#= require templates/soundcloud | ||
#= require templates/soundcloud_results | ||
#= require templates/soundcloud_preview | ||
|
||
# TODO: proper controller routes for pages and queries | ||
class Warble.SoundcloudSearchView extends Warble.PaneView | ||
SOUNDCLOUD_CLIENT_ID = "<%= ENV['SOUNDCLOUD_CLIENT_ID'] %>" | ||
SOUNDCLOUD_SEARCH_URL = "https://api.soundcloud.com/tracks" | ||
|
||
template: window.JST['templates/soundcloud'] | ||
searchResultsTemplate: window.JST['templates/soundcloud_results'] | ||
|
||
events: | ||
'click #soundlcoud_search' : 'search' | ||
'keypress input' : 'handleEnter' | ||
'click a.entry' : 'queueSong' | ||
'click .scpreview a' : 'previewAudio' | ||
'click a#previous_results' : 'previousPage' | ||
'click a#next_results' : 'nextPage' | ||
|
||
initialize: -> | ||
@searchData = null | ||
@query = '' | ||
@pageSize = 10 | ||
@startIndex = 0 | ||
|
||
activate: -> | ||
@$('#soundcloud_query').focus() | ||
|
||
handleEnter: (event) -> | ||
if event.which == 13 | ||
this.search event | ||
|
||
previewAudio: (event) -> | ||
preview_el = @$(event.currentTarget) | ||
preview_el.parent('div').parent('li').addClass('show-preview') | ||
preview_el.parent('div').html window.JST['templates/soundcloud_preview'] | ||
url: preview_el.parent('div').data('soundcloud') | ||
this | ||
|
||
previousPage: (event) -> | ||
@startIndex -= @pageSize + 1 | ||
this.search event | ||
|
||
nextPage: (event) -> | ||
@startIndex += @pageSize + 1 | ||
this.search event | ||
|
||
search: (event) -> | ||
window.workspace.showSpinner() | ||
q = @$('#soundcloud_query').val() | ||
|
||
#reset the search start-index if it's a new search | ||
if @query != q | ||
@startIndex = 1 | ||
@query = q | ||
|
||
search_params = | ||
q: @query | ||
'limit': @pageSize | ||
'offset': @startIndex if @startIndex >= @pageSize | ||
'client_id': SOUNDCLOUD_CLIENT_ID | ||
|
||
$.getJSON SOUNDCLOUD_SEARCH_URL, search_params, (data) => | ||
# extract results into a saner object array | ||
@data = _.map data, (entry, index) -> | ||
index: index | ||
soundcloud_id: entry.id | ||
title: entry.title | ||
thumbnail: entry.artwork_url | ||
author: entry.user.username | ||
url: entry.stream_url + "?client_id=" + SOUNDCLOUD_CLIENT_ID | ||
|
||
$('#soundcloud_search_results').html @searchResultsTemplate | ||
results: @data | ||
hasPrev: @startIndex > 1 | ||
hasNext: true #Fix this. Need total number of results from soundcloud. | ||
|
||
@$el.scrollTop 0 | ||
window.workspace.hideSpinner() | ||
event.preventDefault() | ||
|
||
queueSong: (event) -> | ||
console.log @data[$(event.currentTarget).attr('data-id')] | ||
window.workspace.showSpinner() | ||
|
||
$.ajax '/jukebox/playlist', | ||
type: 'POST' | ||
data: | ||
soundcloud: @data[$(event.currentTarget).attr('data-id')] | ||
success: => | ||
window.workspace.hideSpinner() | ||
error: -> | ||
window.workspace.navigate '/', true | ||
window.workspace.hideSpinner() | ||
|
||
event.preventDefault() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class Pandora::BaseController < ApplicationController | ||
before_filter :check_pandora_credentials! | ||
|
||
|
||
private | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Get rid of the changes in this file: |
||
|
||
def check_pandora_credentials! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,6 @@ | |
|
||
match 'hype' => 'hype#index' | ||
|
||
|
||
### ------------------------ ADMINISTRATIVE ROUTES --------------------------- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Get rid of the changes in this file: |
||
|
||
mount Sidekiq::Web => '/sidekiq' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
0 info it worked if it ends with ok | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Get rid of this file: |
||
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run-script', 'start' ] | ||
2 info using [email protected] | ||
3 info using [email protected] | ||
4 verbose node symlink /usr/local/bin/node | ||
5 verbose read json /Users/tsucho/rails/warble/package.json | ||
6 error Error: ENOENT, open '/Users/tsucho/rails/warble/package.json' | ||
7 error If you need help, you may report this log at: | ||
7 error <http://github.com/isaacs/npm/issues> | ||
7 error or email it to: | ||
7 error <[email protected]> | ||
8 error System Darwin 12.2.0 | ||
9 error command "node" "/usr/local/bin/npm" "run-script" "start" | ||
10 error cwd /Users/tsucho/rails/warble | ||
11 error node -v v0.8.10 | ||
12 error npm -v 1.1.62 | ||
13 error path /Users/tsucho/rails/warble/package.json | ||
14 error code ENOENT | ||
15 error errno 34 | ||
16 verbose exit [ 34, true ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of the changes in this file:
git checkout master Gemfile.lock