concerto_audio 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5668bd19e2ef2c322aa53fbd27940131053f4557
4
+ data.tar.gz: 819962024e19133d9d191c50681d73b52ef7616e
5
+ SHA512:
6
+ metadata.gz: 383b868fb838bb945d53d8cb45c60f5205950461cb276590c574afda6387184af18c470374c1f6eb9eb4cd0bebf2edfb74cf1913a846d11a3a84e5fc79cdc95a
7
+ data.tar.gz: 96fc9314499ab31c03c6f6cd628c72b5d56efe8dae899e40068e4dc630d9db18e562ddef077cb9fc91e885f86ad58164de80be2894d642a0c403d8cee861ccc7
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2013 Concerto Authors
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Concerto 2 Audio Plugin
2
+ This plugin provides support to add audio content in Concerto 2, such as shoutcast.
3
+
4
+ 1. Add to your Gemfile: ```gem 'concerto_audio'```
5
+ 2. ```bundle install```
6
+ 3. ```./script/rails generate concerto_audio:install install```
7
+ 4. To use it, you have to add a field Dynamic to your template (you can leave the positioning as all zeros), and then subscribe it. Audio content has a hard-coded duration of 24 hours.
8
+
9
+ The third step produces a lot of output because it recompiles the frontend js files.
10
+
11
+ Concerto 2 Audio is licensed under the Apache License, Version 2.0.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'ConcertoAudio'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1 @@
1
+ //= require_tree .
@@ -0,0 +1,16 @@
1
+
2
+ var ConcertoAudioHandlerInitialized = false;
3
+
4
+ function initializeConcertoAudioHandler() {
5
+ if (!ConcertoAudioHandlerInitialized) {
6
+ $('input#audio_config_url').on("keyup", function (e) {
7
+ var a = $('<audio>', { controls: 'controls', preload: 'none', src: $('input#audio_config_url').val() });
8
+ $("#preview_div").empty().append(a);
9
+ });
10
+
11
+ ConcertoAudioHandlerInitialized = true;
12
+ }
13
+ }
14
+
15
+ $(document).ready(initializeConcertoAudioHandler);
16
+ $(document).on('page:change', initializeConcertoAudioHandler);
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ .woeid-info tbody td:hover {
2
+ cursor: pointer;
3
+ }
@@ -0,0 +1,4 @@
1
+ module ConcertoAudio
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ConcertoAudio
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,46 @@
1
+ class Audio < Content
2
+ DISPLAY_NAME = 'Audio'
3
+ after_initialize :set_kind, :create_config
4
+
5
+ after_find :load_config
6
+ before_validation :save_config
7
+
8
+ attr_accessor :config
9
+
10
+ # Automatically set the kind for the content
11
+ # if it is new. We use this hidden type that no fields
12
+ # render so Dynamic Content meta content never gets displayed.
13
+ def set_kind
14
+ return unless new_record?
15
+ self.kind = Kind.where(:name => 'Dynamic').first
16
+ end
17
+
18
+ # Create a new configuration hash if one does not already exist.
19
+ # Called during `after_initialize`, where a config may or may not exist.
20
+ def create_config
21
+ self.config = {} if !self.config
22
+ end
23
+
24
+ # Load a configuration hash.
25
+ # Converts the JSON data stored for the content into the configuration.
26
+ # Called during `after_find`.
27
+ def load_config
28
+ self.config = JSON.load(self.data)
29
+ end
30
+
31
+ # Prepare the configuration to be saved.
32
+ # Compress the config hash back into JSON to be stored in the database.
33
+ # Called during `before_valication`.
34
+ def save_config
35
+ self.data = JSON.dump(self.config)
36
+ end
37
+
38
+ def self.form_attributes
39
+ attributes = super()
40
+ attributes.concat([:config => [:url]])
41
+ end
42
+
43
+ def render_details
44
+ { :path => self.config['url'] }
45
+ end
46
+ end
@@ -0,0 +1,22 @@
1
+ <fieldset>
2
+ <legend><span><%=t('contents.provide_details')%></span></legend>
3
+ <div class="row-fluid">
4
+ <div class="span6">
5
+ <div class="clearfix">
6
+ <%= form.label :name %>
7
+ <%= form.text_field :name, :style => "width: 85%;" %>
8
+ </div>
9
+
10
+ <%= render :partial => 'contents/form_elements/dates', :locals => {:form => form} %>
11
+ </div>
12
+ <%= form.hidden_field :duration, :value => ConcertoConfig[:max_content_duration] %>
13
+ </div>
14
+
15
+ </fieldset>
16
+
17
+ <fieldset>
18
+ <legend><span><%=t('contents.submit_to_feeds')%></span></legend>
19
+ <div class="clearfix">
20
+ <%= render :partial => 'contents/form_elements/feeds' %>
21
+ </div>
22
+ </fieldset>
@@ -0,0 +1,14 @@
1
+ <%= javascript_include_tag "concerto_audio/application" %>
2
+ <%= stylesheet_link_tag "concerto_audio/application" %>
3
+
4
+ <fieldset>
5
+ <legend><span>Audio</span></legend>
6
+ <%= form.fields_for :config do |config| %>
7
+ <div class="clearfix">
8
+ <%= config.label :url, "URL" %>
9
+ <div class="input">
10
+ <%= config.text_field :url, :placeholder => 'http://69.166.45.47:8000/;?topspeed=on&0.09971104841679335', :class => "input-xxlarge", :value => @content.config['url'] %>
11
+ </div>
12
+ </div>
13
+ <% end %>
14
+ </fieldset>
@@ -0,0 +1,9 @@
1
+ <h1>Audio - <%= content.name %></h1>
2
+ <dl>
3
+ <dt>Source</dt>
4
+ <dd><%= content.config['url'] %></dd>
5
+ </dl>
6
+
7
+ <div>
8
+ <audio controls src="<%= content.config['url']%>"/>
9
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="grid-item with-shadow">
2
+ <i class="icon-music icon-4x"></i>
3
+ </div>
@@ -0,0 +1,4 @@
1
+ <h1>Audio - <%= content.name %></h1>
2
+ <p>
3
+ <%= content.config['url'] %>
4
+ </p>
@@ -0,0 +1 @@
1
+ <i class="icon-music"></i>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ConcertoAudio</title>
5
+ <%= stylesheet_link_tag "concerto_audio/application", :media => "all" %>
6
+ <%= javascript_include_tag "concerto_audio/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ resources :audios, :controller => :contents, :except => [:index, :show], :path => "content"
3
+ end
@@ -0,0 +1,10 @@
1
+ module ConcertoAudio
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ConcertoAudio
4
+
5
+ initializer "register content type" do |app|
6
+ app.config.content_types << Audio
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module ConcertoAudio
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "concerto_audio/engine"
2
+
3
+ module ConcertoAudio
4
+ end
@@ -0,0 +1,31 @@
1
+ require 'rails/generators'
2
+
3
+ module ConcertoAudio
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../../../../', __FILE__)
6
+
7
+ desc 'Copy the Audio JavaScript to the frontend and register it.'
8
+
9
+ def install
10
+ copy_js
11
+ register
12
+ recompile
13
+ end
14
+
15
+ private
16
+ def copy_js
17
+ copy_file 'public/frontend_js/contents/audio.js', 'public/frontend_js/contents/audio.js'
18
+ end
19
+
20
+ def register
21
+ append_file 'public/frontend_js/content_types.js', "goog.require('concerto.frontend.Content.Audio');\n"
22
+ end
23
+
24
+ def recompile
25
+ inside 'public/frontend_js' do
26
+ run('/bin/bash compile.sh', {:verbose => true})
27
+ end
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :concerto_audio do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: concerto_audio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marvin Frederickson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.12
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.12
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Add streaming audio such as shoutcast to Concerto 2.
42
+ email:
43
+ - marvin.frederickson@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - app/assets/javascripts/concerto_audio/application.js
49
+ - app/assets/javascripts/concerto_audio/audio.js
50
+ - app/assets/stylesheets/concerto_audio/application.css
51
+ - app/assets/stylesheets/concerto_audio/weather.css.scss
52
+ - app/controllers/concerto_audio/application_controller.rb
53
+ - app/helpers/concerto_audio/application_helper.rb
54
+ - app/models/audio.rb
55
+ - app/views/contents/audio/_form_middle.html.erb
56
+ - app/views/contents/audio/_form_top.html.erb
57
+ - app/views/contents/audio/_render_default.html.erb
58
+ - app/views/contents/audio/_render_grid.html.erb
59
+ - app/views/contents/audio/_render_tile.html.erb
60
+ - app/views/contents/audio/_tab_icon.html.erb
61
+ - app/views/layouts/concerto_audio/application.html.erb
62
+ - config/routes.rb
63
+ - lib/concerto_audio/engine.rb
64
+ - lib/concerto_audio/version.rb
65
+ - lib/concerto_audio.rb
66
+ - lib/generators/concerto_audio/install_generator.rb
67
+ - lib/tasks/concerto_weather_tasks.rake
68
+ - LICENSE
69
+ - Rakefile
70
+ - README.md
71
+ homepage: https://github.com/mfrederickson/concerto-audio
72
+ licenses:
73
+ - Apache 2.0
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.0.3
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Audio plugin for Concerto 2.
95
+ test_files: []