
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (29)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (6407)
-
ffmpeg - Compare 2 AVFrames data
17 mai 2016, par zet vooI have 2 AVFrame pointers
float compareFrame(AVFrame* firstFrame, AVFrame* secondFrame)
{
int i,j;
const size_t image_size = height * width;
size_t diffbytes = 0;
for (i=0; i < height; i++)
{
for (j=0; j < width; j++) {
size_t coord = firstFrame->linesize[0]*i + j;
diffbytes += !!(firstFrame->data[0][coord] ^ secondFrame->data[0][coord]);
}
}
const float percent_diff = (diffbytes / (float)image_size)*100.0;
return percent_diff;
}But it seems not correct when compare the 2 same AVFrames. How to determine two AVFrames have exactly the same data or not ?
-
Adding C64 SID Music
1er novembre 2012, par Multimedia Mike — GeneralI have been working on adding support for SID files — the music format for the Commodore 64 — to the game music website for awhile. I feel a bit out of my element since I’m not that familiar with the C64. But why should I let that slow me down ? Allow me to go through the steps I have previously outlined in order to make this happen.
I need to know what picture should represent the system in the search results page. The foregoing picture should be fine, but I’m getting way ahead of myself.
Phase 1 is finding adequate player software. The most venerable contender in this arena is libsidplay, or so I first thought. It turns out that there’s libsidplay (originally hosted at Geocities, apparently, and no longer on the net) and also libsidplay2. Both are kind of old (libsidplay2 was last updated in 2004). I tried to compile libsidplay2 and the C++ didn’t agree with current version of g++.
However, a recent effort named libsidplayfp is carrying on the SID emulation tradition. It works rather well, notwithstanding the fact that compiling the entire library has a habit of apparently hanging the Linux VM where I develop this stuff.
Phase 2 is to develop a testbench app around the playback library. With the help of the libsidplayfp library maintainers, I accomplished this. The testbench app consistently requires about 15% of a single core of a fairly powerful Core i7. So I look forward to recommendations that I port that playback library to pure JavaScript.
Phase 3 is plug into the web player. I haven’t worked on this yet. I’m confident that this will work since phase 2 worked (plus, I have a plan to combine phases 2 and 3).
One interesting issue that has arisen is that proper operation of libsidplayfp requires that 3 C64 ROM files be present (the, ahem, KERNAL, BASIC interpreter, and character generator). While these are copyrighted ROMs, they are easily obtainable on the internet. The goal of my project is to eliminate as much friction as possible for enjoying these old tunes. To that end, I will just bake the ROM files directly into the player.
Phase 4 is collecting a SID song corpus. This is the simplest part of the whole process thanks to the remarkable curation efforts of the High Voltage SID Collection (HVSC). Anyone can download a giant archive of every known SID file. So that’s a done deal.
Or is it ? One small issue is that I was hoping that the first iteration of my game music website would focus on, well, game music. There is a lot of music in the HVSC that are original compositions or come from demos. The way that the archive is organized makes it difficult to automatically discern whether a particular SID file comes from a game or not.
Phase 5 is munging the metadata. The good news here is that the files have the metadata built in. The not-so-great news is that there isn’t quite as much as I might like. Each file is tagged with title, author, and publisher/copyright. If there is more than one song in a file, they all have the same metadata. Fortunately, if I can import them all into my game music database, there is an opportunity to add a lot more metadata.
Further, there is no play length metadata for these files. This means I will need to set each to a default length like 2 minutes and do something like I did before in order to automatically determine if any songs terminate sooner.
Oddly, the issue I’m most concerned about is character encoding. This is the first project for which I’m making certain that I understand character encoding since I can’t reasonably get away with assuming that everything is ASCII. So far, based on the random sampling of SID files I have checked, there is a good chance of encountering metadata strings with characters that are not in the lower ASCII set. From what I have observed, these characters map to Unicode code points. So I finally get to learn about manipulating strings in such a way that it preserves the character encoding. At the very least, I need Python to rip the strings out of the binary SID files and make sure the Unicode remains intact while being inserted into an SQLite3 database.
-
How do I get videos to upload using ruby on rails carrierwave-video ?
9 juillet 2016, par EricUpdated as of July 9, 2016
I tried to follow the instructions on the github website for the video uploader process using carrierwave-video gem but get an error that says the file or directory mmpeg -i doesn’t exist.
The upload path for images functions correctly, just not the video one.
I have added all of the following code necessary to help solve the error and minified as much as i possibly could.
Video uploader code using carrierwave
class VideoUploader < CarrierWave::Uploader::Base
include CarrierWave::Video
storage :file
version :mp4 do
process :encode_video => [:mp4, resolution: "100x100"]
end
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
endHere is the movie controller code that handles uploading of videos
class MoviesController < ApplicationController
include MoviesHelper
def index
mode "index"
end
def show
mode "show"
end
def new
mode "new"
end
def edit
mode "edit"
end
def create
mode "create"
end
def update
mode "update"
end
def destroy
mode "destroy"
end
def review
mode "review"
end
def approve
mode "approve"
end
def deny
mode "deny"
end
endHere is the model data for the movie that goes with it
class Movie < ActiveRecord::Base
attr_accessible :created_on, :description, :maintenance, :reviewed, :subplaylist_id, :title, :user_id, :video, :remote_video_url
belongs_to :user
belongs_to :subplaylist
mount_uploader :video, VideoUploader
endHere is where the movie is supposed to be displayed but it is not working
<% provide(:title, "Movie: Where movies are made!") %>
<% provide(:keywords, "movies, video") %>
<% provide(:description, "This is the place where users showcase their wonderful video talent.") %>
<p><%= notice %></p>
<h1 class="pageheader"><%= @movie.title %></h1>
<br />
<p class="pagetext"><%= video_tag(@movie.video_url.to_s, controls: true, class: "imagebox") %></p>
<p class="pagetext"><%= @movie.description %></p>
<p class="pagetext">Created on: <%= @movie.created_on.strftime("%B-%d-%Y") %></p>
<p class="pagetext">Owner: <%= getType(@movie.user) %><%= link_to @movie.user.vname, user_path(@movie.user) %></p>
<br />
<p class="pagetext"><%= link_to 'Back', mainplaylist_subplaylist_path(@subplaylist.mainplaylist, @movie.subplaylist) %></p>Here is where the movie new action is
<% provide(:title, "Movie: Create new movies here!") %>
<% provide(:description, "New movies are uploaded only to the site when the movie gets approved.") %>
<h1 class="pagetextheader">New movie</h1>
<%= render 'form' %>
<p class="pagetext"><%= link_to 'Back', mainplaylist_subplaylist_path(@subplaylist.mainplaylist, @subplaylist) %></p>Here is where the movies forum parameters are
<%= form_for([@subplaylist, @movie], :html=>{:multipart => true}) do |f| %>
<% if @movie.errors.any? %>
<div>
<h2><%= pluralize(@movie.errors.count, "error") %> prohibited this movie from being saved:</h2>
<ul>
<% @movie.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<br />
<div class="pagetext">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="pagetext">
<%= f.file_field :video %>
</div>
<div class="pagetext">
<%= f.label :remote_video_url, "or video URL" %><br />
<%= f.text_field :remote_video_url %>
</div>
<div class="pagetext">
<%= f.label :description %><br />
<%= f.text_area :description %>
</div>
<div class="pagetext">
<%= f.submit %>
</div>
<br />
<% end %>Here is the movies helper code
module MoviesHelper
def mode(type)
code = auto_logout
if(code == true)
sign_out
redirect_to root_path
else
#Check if Maintenance is turned_on
allmode = Maintenancemode.find_by_id(1)
moviemode = Maintenancemode.find_by_id(19)
mode_turned_on = (allmode.maintenance_on || moviemode.maintenance_on)
#Determine if any maintenance is on
if(mode_turned_on)
#Determine if we are a regular user
regularUser = (!current_user || !current_user.admin?)
if(regularUser)
#Determine which maintenance mode is on
if(allmode.maintenance_on)
redirect_to maintenance_path
else
redirect_to movies_maintenance_path
end
else
switch type
end
else
switch type
end
end
end
private
def getType(user)
if(user.admin)
value = "$"
else
typeFound = Usertype.find_by_user_id(user.id)
if(typeFound)
type = typeFound.privilege
if(type == "Reviewer")
value = "^"
elsif(type == "Banned")
value = "!"
else
value = "~"
end
else
value = "~"
end
end
return value
end
def movieApproved
movieFound = Movie.find_by_id(params[:movie_id])
if(movieFound)
movieFound.reviewed = true
pouch = Pouch.find_by_user_id(movieFound.user_id)
pointsForMovie = 10
pouch.amount += pointsForMovie
@pouch = pouch
@pouch.save
@movie = movieFound
@movie.save
# MovieMailer.movie_approved(@movie, pointsForMovie).deliver
redirect_to movies_review_path
else
render "public/404"
end
end
def movieDenied
movieFound = Movie.find_by_id(params[:movie_id])
if(movieFound)
#Retrieve the user who owns this pet first
#userEmail = petFound.user.email
#Send mail to user with link to edit the pet they sent
@movie = movieFound
MovieMailer.movie_denied(@movie).deliver
redirect_to movies_review_path
else
render "public/404"
end
end
def createMovie(subplaylistFound)
newMovie = subplaylistFound.movies.new
@subplaylist = subplaylistFound
@movie = newMovie
end
def saveMovie(subplaylistFound, logged_in)
newMovie = subplaylistFound.movies.new(params[:movie])
newMovie.user_id = logged_in.id
currentTime = Time.now
newMovie.created_on = currentTime
@movie = newMovie
if(@movie.save)
@subplaylist = subplaylistFound
# MovieMailer.review_movie(@movie).deliver
flash[:success] = "#{@movie.title} is currently being reviewed please check back later."
redirect_to subplaylist_movie_path(@subplaylist, @movie)
else
render "new"
end
end
def switch(type)
if(type == "index") #Admin only
logged_in = current_user
if(logged_in)
if(logged_in.admin)
allMovies = Movies.order("created_on desc").page(params[:page]).per(10)
@movies = allMovies
else
redirect_to root_path
end
else
redirect_to root_path
end
elsif(type == "show")
movieFound = Movie.find_by_id(params[:id])
if(movieFound)
subplaylistFound = Subplaylist.find_by_id(params[:subplaylist_id])
if(subplaylistFound)
if(movieFound.reviewed)
@subplaylist = subplaylistFound
@movie = movieFound
else
logged_in = current_user
if(logged_in)
userMatch = ((logged_in.id == movieFound.user_id) || logged_in.admin)
if(userMatch)
@subplaylist = subplaylistFound
@movie = movieFound
else
redirect_to root_path
end
else
redirect_to root_path
end
end
else
redirect_to root_path
end
else
render "public/404"
end
elsif(type == "new")
logged_in = current_user
if(logged_in)
subplaylistFound = Subplaylist.find_by_id(params[:subplaylist_id])
if(subplaylistFound)
if(subplaylistFound.collab_mode)
createMovie(subplaylistFound)
else
userMatch = (logged_in.id == subplaylistFound.user_id)
if(userMatch)
createMovie(subplaylistFound)
else
redirect_to root_path
end
end
else
render "public/404"
end
else
redirect_to root_path
end
elsif(type == "create")
logged_in = current_user
if(logged_in)
subplaylistFound = Subplaylist.find_by_id(params[:subplaylist_id])
if(subplaylistFound)
if(subplaylistFound.collab_mode)
saveMovie(subplaylistFound, logged_in)
else
userMatch = (logged_in.id == subplaylistFound.user_id)
if(userMatch)
saveMovie(subplaylistFound, logged_in)
else
redirect_to root_path
end
end
else
render "public/404"
end
else
redirect_to root_path
end
elsif(type == "edit")
logged_in = current_user
if(logged_in)
movieFound = Movie.find_by_id(params[:id])
if(movieFound)
userMatch = (logged_in.id == movieFound.user_id)
if(userMatch)
subplaylistFound = Subplaylist.find_by_id(movieFound.subplaylist_id)
if(subplaylistFound)
@subplaylist = subplaylistFound
@movie = movieFound
else
render "public/404"
end
else
redirect_to root_path
end
else
render "public/404"
end
else
redirect_to root_path
end
elsif(type == "update")
logged_in = current_user
if(logged_in)
movieFound = Movie.find_by_id(params[:id])
if(movieFound)
userMatch = (logged_in.id == movieFound.user_id)
if(userMatch)
subplaylistFound = Subplaylist.find_by_id(movieFound.subplaylist_id)
if(subplaylistFound)
@movie = movieFound
if(@movie.update_attributes(params[:movie]))
@subplaylist = subplaylistFound
flash[:success] = 'Movie was successfully updated.'
redirect_to subplaylist_movie_path(@subplaylist, @movie)
else
render "edit"
end
else
render "public/404"
end
else
redirect_to root_path
end
else
render "public/404"
end
else
redirect_to root_path
end
elsif(type == "destroy")
logged_in = current_user
if(logged_in)
movieFound = Movie.find_by_id(params[:id]) #Need to move this below the admin section to protect it
if(movieFound)
if(logged_in.admin)
subplaylistFound = Subplaylist.find_by_id(movieFound.subplaylist_id)
if(subplaylistFound)
@movie = movieFound
@subplaylist = subplaylistFound
@movie.destroy
redirect_to mainplaylist_subplaylist_path(@subplaylist.mainplaylist, @subplaylist)
else
render "public/404"
end
else
redirect_to root_path
end
else
render "public/404"
end
else
redirect_to root_path
end
elsif(type == "review") #Admin
logged_in = current_user
if(logged_in)
if(logged_in.admin)
allMovies = Movie.all
moviesToReview = allMovies.select{|movie| !movie.reviewed}
@movies = Kaminari.paginate_array(moviesToReview).page(params[:page]).per(10)
else
typeFound = Usertype.find_by_user_id(logged_in.id)
if(typeFound.privilege == "Reviewer")
allMovies = Movie.all
moviesToReview = allMovies.select{|movie| !movie.reviewed}
@movies = Kaminari.paginate_array(moviesToReview).page(params[:page]).per(10)
else
redirect_to root_path
end
end
else
redirect_to root_path
end
elsif(type == "approve") #Admin
logged_in = current_user
if(logged_in)
if(logged_in.admin)
movieApproved
else
typeFound = Usertype.find_by_user_id(logged_in.id)
if(typeFound.privilege == "Reviewer")
movieApproved
else
redirect_to root_path
end
end
else
redirect_to root_path
end
elsif(type == "deny") #Admin
logged_in = current_user
if(logged_in)
if(logged_in.admin)
movieDenied
else
typeFound = Usertype.find_by_user_id(logged_in.id)
if(typeFound.privilege == "Reviewer")
movieDenied
else
redirect_to root_path
end
end
else
redirect_to root_path
end
end
end
endHere is the subplaylists show code
<% provide(:title, "Subplaylist: The place where users videos gets uploaded to!") %>
<% provide(:keywords, "user, video, uploaded") %>
<% provide(:description, "Allows the categorization of various videos that the user submitted successfully.") %>
<p><%= notice %></p>
<h1 class="pageheader"><%= @subplaylist.title %></h1>
<br />
<p class="pagetext"><%= @subplaylist.description %></p>
<br />
<div class="pagebox"><%= paginate @movies %></div>
<br />
<div class="pagetext">
<% @movies.each_with_index do |movie, index| %>
<div class="container">
<div class="inner">
<div class="inner"><%= link_to movie.title, subplaylist_movie_path(@subplaylist, movie) %></div>
<% if current_user && (current_user.id == movie.user_id || current_user.admin? )%>
<div class="inner"><%= button_to 'Edit', edit_subplaylist_movie_path(@subplaylist, movie), method: :get %></div>
<div class="inner"><%= button_to 'Destroy', [@subplaylist, movie], method: :delete, data: { confirm: 'Are you sure?' } %></div>
<% end %>
<p><%= video_tag movie.video_url(:thumb).to_s, controls: true %></p>
</div>
<br />
<p>Created on: <%= movie.created_on.strftime("%B-%d-%Y") %></p>
<p>Owner: <%= getType(movie.user) %><%= link_to movie.user.vname, user_path(movie.user) %></p>
</div>
<% if ((index + 1) % 3) == 0 %>
<br />
<br />
<% end %>
<% end %>
</div>
<br />
<% if current_user %>
<p class="pagetext"><%= link_to "New Movie", new_subplaylist_movie_path(@subplaylist) %></p>
<br />
<% end %>
<p class="pagetext"><%= link_to 'Back', user_mainplaylist_path(@mainplaylist.user.vname, @subplaylist.mainplaylist.title) %></p>Here is the subplaylists model
class Subplaylist < ActiveRecord::Base
attr_accessible :title, :description, :collab_mode
belongs_to :user
belongs_to :mainplaylist
has_many :movies, :foreign_key => "subplaylist_id", :dependent => :destroy
VALID_NAME = /\A[A-Za-z][A-Za-z1-9][A-Za-z1-9 ]+\z/
validates :title, presence: true, format: {with: VALID_NAME}
validates :description, presence: true
endHere is the subplaylists controller code
class SubplaylistsController < ApplicationController
include SubplaylistsHelper
def index
mode "index"
end
def show
mode "show"
end
def new
mode "new"
end
def edit
mode "edit"
end
def create
mode "create"
end
def update
mode "update"
end
def destroy
mode "destroy"
end
endHere is the subplaylist helper code
module SubplaylistsHelper
def mode(type)
code = auto_logout
if(code == true)
sign_out
redirect_to root_path
else
#Check if Maintenance is turned_on
allmode = Maintenancemode.find_by_id(1)
subplaylistmode = Maintenancemode.find_by_id(18)
mode_turned_on = (allmode.maintenance_on || subplaylistmode.maintenance_on)
#Determine if any maintenance is on
if(mode_turned_on)
#Determine if we are a regular user
regularUser = (!current_user || !current_user.admin?)
if(regularUser)
#Determine which maintenance mode is on
if(allmode.maintenance_on)
redirect_to maintenance_path
else
redirect_to subplaylists_maintenance_path
end
else
switch type
end
else
switch type
end
end
end
private
def getType(user)
if(user.admin)
value = "$"
else
typeFound = Usertype.find_by_user_id(user.id)
if(typeFound)
type = typeFound.privilege
if(type == "Reviewer")
value = "^"
elsif(type == "Banned")
value = "!"
else
value = "~"
end
else
value = "~"
end
end
return value
end
def switch(type)
if(type == "show")
subplaylistFound = Subplaylist.find_by_id(params[:id])
if(subplaylistFound)
mainplaylistFound = Mainplaylist.find_by_title(params[:mainplaylist_id])
if(mainplaylistFound)
playlistMatch = (subplaylistFound.mainplaylist_id == mainplaylistFound.id)
if(playlistMatch)
@mainplaylist = mainplaylistFound
@subplaylist = subplaylistFound
subplaylistMovies = @subplaylist.movies.all
reviewedMovies = subplaylistMovies
if(subplaylistMovies.count > 0)
reviewedMovies = subplaylistMovies.select{|movie| movie.reviewed}
end
@movies = Kaminari.paginate_array(reviewedMovies).page(params[:page]).per(10)
else
redirect_to root_path
end
else
render "public/404"
end
else
redirect_to root_path
end
elsif(type == "destroy")
logged_in = current_user
if(logged_in)
subplaylistFound = Subplaylist.find_by_id(params[:id]) #Need to move this below the admin section to protect it
if(subplaylistFound)
if(logged_in.admin)
mainplaylistFound = Mainplaylist.find_by_id(subplaylistFound.mainplaylist_id)
if(mainplaylistFound)
@subplaylist = subplaylistFound
@mainplaylist = mainplaylistFound
@subplaylist.destroy
redirect_to mainplaylist_subplaylists_path(@mainplaylist)
else
render "public/404"
end
else
redirect_to root_path
end
else
render "public/404"
end
else
redirect_to root_path
end
end
end
endHere is the User model
class User < ActiveRecord::Base
attr_accessible :email, :first_name, :last_name, :login_id, :vname, :password, :password_confirmation, :avatar
has_secure_password
mount_uploader :avatar, AvatarUploader
before_save { |user| user.email = user.email.downcase }
before_save { |user| user.first_name = user.first_name.humanize }
#key
has_one :sessionkey, :foreign_key => "user_id", :dependent => :destroy
has_one :usertype, :foreign_key => "user_id", :dependent => :destroy
#Video section
has_many :mainplaylists, :foreign_key => "user_id", :dependent => :destroy
has_many :subplaylists, :foreign_key => "user_id", :dependent => :destroy
has_many :movies, :foreign_key => "user_id", :dependent => :destroy
#validates :first_name, presence: true
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
VALID_NAME_REGEX = /\A[a-z][a-z][a-z]+\z/i
VALID_VNAME_REGEX = /\A[A-Za-z][A-Za-z][A-Za-z][A-Za-z0-9 ]+([-][A-Za-z0-9 ]+)?\z/
VALID_PASSWORD_REGEX = /\A[A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!][A-Za-z0-9!]+\z/
validates :first_name, presence: true, format: { with: VALID_NAME_REGEX}
validates :last_name, presence: true, format: { with: VALID_NAME_REGEX}
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX}
validates :login_id, presence: true, format: { with: VALID_VNAME_REGEX}, uniqueness: { case_sensitive: false}
validates :vname, presence: true, format: { with: VALID_VNAME_REGEX}, uniqueness: { case_sensitive: false}
validates :password, length: {minimum: 6}#, format: { with: VALID_PASSWORD_REGEX}
validates :password_confirmation, presence: true #, format: { with: VALID_PASSWORD_REGEX}
def to_param
vname
end
endHere is the sessionkey model
class Sessionkey < ActiveRecord::Base
belongs_to :user
endHere is the usertype model
class Usertype < ActiveRecord::Base
attr_accessible :privilege, :user_id #Only priviledge will be changeable
belongs_to :user
endError message
No such file or directory - ffmpeg -i /home/eric/Projects/Local/Lduelingpets/Trial/public/uploads/tmp/1466811951-3149-2702/mp4_TrialMovies.mp4