Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shanev committed Mar 16, 2009
0 parents commit d420fd6
Show file tree
Hide file tree
Showing 367 changed files with 55,899 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,18 @@
log/*.log
tmp/**/*
.DS_Store
doc/api
doc/app
doc/guides/
doc/plugins
doc/models.svg
doc/controllers.svg
doc/machines.svg
db/test.sqlite3
db/development.sqlite3
vendor/gems/*/doc/
vendor/gems/*/rdoc/
vendor/rails
coverage
tags
config/database.yml
3 changes: 3 additions & 0 deletions Capfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
require 'capistrano/version'
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'config/deploy'
43 changes: 43 additions & 0 deletions README
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,43 @@
YouCast™ is an open source Ruby on Rails video sharing application that you host on your own servers. It can be rebranded easily for your company or used as is. It is similar to a very simplified YouTube. Upload videos in any format and view them in the included Flash player. It doesn't do background processing of video yet.

Main features:

Upload videos, images, and music via web or mobile phone via SMS/MMS attachment
Create a playlist of your videos, images, and music
Play your media in a Flash player
Get the code for the player to embed in any site (myspace, blog, etc)
Generates thumbnails for videos
Multi-user support with user login and user management
Export your playlist in XSPF/Spiff format

Tech specs:

Ruby on Rails application designed with RESTful methodology
Supports all major video and image formats, and mp3 for music
Encodes all video to Flash
Uses MMS2R for mobile media processing
XSPF/Spiff format used for playlists for maximum portability

What can you do with YouCast™?

Create an internal video sharing site for your company or small business
Use it as a base for your own video-related site
Merge it with your existing site to add video and mobile media support
Re-create YouTube to impress your friends

How much does it cost?

YouCast™ is free, but please consider donating to the project via GitHub.

Installing ffmpeg
-----------------
http://www.thisismobility.com/blog/?p=156
ffmpeg sources + AMR 3gpp files: /vendors/ffmpeg
http://vexxhost.com/blog/2007/03/03/installing-ffmpeg-ffmpeg-php-mplayer-mencoder-flv2tool-lame-mp3-encoder-libogg-%E2%80%93-the-easy-way/

# Install LAME
# compile ffmpeg from source in vendor/ffmpeg
# copy files for amr from 3gp site (included in vendor/ffmpeg)
# copy amr files into libavcodec (included in vendor/ffmpeg)
# compile with gmake
# ./configure --enable-shared --enable-libmp3lame --enable-amr-nb --enable-amr-wb --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'
11 changes: 11 additions & 0 deletions app/controllers/application.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,11 @@
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
include AuthenticatedSystem
before_filter :login_from_cookie

# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_upload2_session_id'

end
50 changes: 50 additions & 0 deletions app/controllers/clips_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,50 @@
class ClipsController < ApplicationController
before_filter :login_required
before_filter :find_playlist

# GET /clips
# GET /clips.xml
def index
@clips = Clip.find_all_by_user_id(current_user.id)

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clips }
end
end

# GET /clips/new
# GET /clips/new.xml
def new
@clip = Clip.new
@your_email = "#{current_user.login}@#{DOMAIN}"

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @clip }
end
end

# POST /clips
# POST /clips.xml
def create
@clip = Clip.new(params[:clip])
@clip.user_id = current_user.id

respond_to do |format|
if @clip.save
flash[:notice] = 'Clip was successfully created.'
format.html { redirect_to home_url }
format.xml { render :xml => @clip, :status => :created, :location => @clip }
else
format.html { render :action => "new" }
format.xml { render :xml => @clip.errors }
end
end
end

def find_playlist
@playlist = Playlist.find_by_user_id(current_user.id)
end

end
50 changes: 50 additions & 0 deletions app/controllers/featured_clips_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,50 @@
class FeaturedClipsController < ApplicationController
before_filter :login_required
before_filter :find_playlist

# GET /clips
# GET /clips.xml
def index
@clips = Clip.find_all_by_user_id_and_featured(current_user.id, true)

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clips }
end
end

# GET /clips/new
# GET /clips/new.xml
def new
@clip = Clip.new
@your_email = "#{current_user.login}@filmprmail.com"

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @clip }
end
end

# POST /clips
# POST /clips.xml
def create
@clip = Clip.new(params[:clip])
@clip.user_id = current_user.id

respond_to do |format|
if @clip.save
flash[:notice] = 'Clip was successfully created.'
format.html { redirect_to home_url }
format.xml { render :xml => @clip, :status => :created, :location => @clip }
else
format.html { render :action => "new" }
format.xml { render :xml => @clip.errors }
end
end
end

def find_playlist
@playlist = Playlist.find_by_user_id(current_user.id)
end

end
9 changes: 9 additions & 0 deletions app/controllers/homes_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,9 @@
class HomesController < ApplicationController
before_filter :login_required

# GET /home
def show
@url_for_media_player =
@playlist = Playlist.find_or_create_by_user_id(current_user.id)
end
end
24 changes: 24 additions & 0 deletions app/controllers/playlists_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,24 @@
class PlaylistsController < ApplicationController

# GET /clips/1
# GET /clips/1.xml
def show
@playlist = Playlist.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @playlist }
end
end

# add a clip (:id) to a playlist as a track
# POST /playlist/add/:id
def add
clip = Clip.find(params[:id])
playlist = Playlist.find_by_user_id(current_user.id)
playlist.tracks << Track.create!(:title => clip.title, :location => clip.location)
flash[:notice] = 'Track was successfully created.'

redirect_to clips_url
end
end
30 changes: 30 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,30 @@
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController

# render new.rhtml
def new
end

def create
self.current_user = User.authenticate(params[:login], params[:password])
if logged_in?
if params[:remember_me] == "1"
self.current_user.remember_me
cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
end
redirect_back_or_default('/')
flash[:notice] = "Logged in successfully"
else
flash[:warn] = "Error logging in, check your password."
render :action => 'new'
end
end

def destroy
self.current_user.forget_me if logged_in?
cookies.delete :auth_token
reset_session
flash[:notice] = "You have been logged out."
redirect_back_or_default('/')
end
end
85 changes: 85 additions & 0 deletions app/controllers/tracks_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,85 @@
class TracksController < ApplicationController
# GET /tracks
# GET /tracks.xml
def index
@tracks = Track.find(:all)

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @tracks }
end
end

# GET /tracks/1
# GET /tracks/1.xml
def show
@track = Track.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @track }
end
end

# GET /tracks/new
# GET /tracks/new.xml
def new
@track = Track.new
@track.playlist = current_user.playlist

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @track }
end
end

# GET /tracks/1/edit
def edit
@track = Track.find(params[:id])
end

# POST /playlist/1/tracks
def create
@track = Track.new(params[:track])

respond_to do |format|
if @track.save
flash[:notice] = 'Track was successfully created.'
format.html { redirect_to clips_url }
format.xml { render :xml => @track, :status => :created, :location => @track }
else
format.html { render :action => "new" }
format.xml { render :xml => @track.errors }
end
end
end

# PUT /tracks/1
# PUT /tracks/1.xml
def update
@track = Track.find(params[:id])

respond_to do |format|
if @track.update_attributes(params[:track])
flash[:notice] = 'Track was successfully updated.'
format.html { redirect_to playlist_track_url(@track.playlist.id, @track) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @track.errors }
end
end
end

# DELETE /tracks/1
# DELETE /tracks/1.xml
def destroy
@track = Track.find(params[:id])
@track.destroy

respond_to do |format|
format.html { redirect_to(tracks_url) }
format.xml { head :ok }
end
end
end
26 changes: 26 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,26 @@
class UsersController < ApplicationController

# render new.rhtml
def new
end

def create
@user = User.new(params[:user])
@user.save!
self.current_user = @user
redirect_back_or_default('/')
flash[:notice] = "Thanks for signing up!"
rescue ActiveRecord::RecordInvalid
render :action => 'new'
end

def activate
self.current_user = User.find_by_activation_code(params[:id])
if logged_in? && !current_user.activated?
current_user.activate
flash[:notice] = "Signup complete!"
end
redirect_back_or_default('/')
end

end
3 changes: 3 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
2 changes: 2 additions & 0 deletions app/helpers/clips_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
module ClipsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/featured_clips_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
module FeaturedClipsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/home_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
module HomeHelper
end
7 changes: 7 additions & 0 deletions app/helpers/playlists_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
module PlaylistsHelper

def render_thumbnail(track)
thumb = File.basename(track.location, File.extname(track.location)).concat("_80x80.jpg")
image_tag(File.join("/clips", thumb))
end
end
2 changes: 2 additions & 0 deletions app/helpers/sessions_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
module SessionsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/tracks_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
module TracksHelper
end
Loading

0 comments on commit d420fd6

Please sign in to comment.