Dummy html, moved demo page, import fix
This commit is contained in:
parent
48b885e7b2
commit
5140ebfe92
|
@ -3,7 +3,10 @@ class ImportController < ApplicationController
|
|||
# Get artist from MB
|
||||
mb_artist = MusicBrainzArtist.getByName(name)
|
||||
# # Save artist
|
||||
artist_xml = open('http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=04fda005dbf61a50af5abc3e90f111f2&artist='+ URI.escape(name)).read
|
||||
artist_xml = open(
|
||||
'http://ws.audioscrobbler.com/2.0/'+
|
||||
'?method=artist.getinfo&api_key=04fda005dbf61a50af5abc3e90f111f2'+
|
||||
'&artist='+ URI.escape(name)).read
|
||||
artist = Artist.new
|
||||
artist.name = mb_artist.name
|
||||
artist.desc = artist_xml.scan(/<summary><\!\[CDATA\[?(.*)\]\]><\/summary>/m)[0][0]
|
||||
|
@ -12,60 +15,68 @@ class ImportController < ApplicationController
|
|||
# Get albums from MB
|
||||
mb_albums = MusicBrainzAlbum.where('artist_id = ? AND release_type = 1', mb_artist.id).order('year ASC, id ASC')
|
||||
mb_albums.each do |mb_album|
|
||||
# Saving album
|
||||
album_xml = open('http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=04fda005dbf61a50af5abc3e90f111f2&artist='+ URI.escape(name) +'&album='+ URI.escape(mb_album.name)).read
|
||||
album = Album.new
|
||||
album.name = mb_album.name
|
||||
album.year = mb_album.year
|
||||
album.artist_id = artist.id
|
||||
album.status = 1
|
||||
album.pic_url = album_xml.scan(/<image\ssize=\"extralarge\">?(.*)<\/image>/)[0][0]
|
||||
album.save
|
||||
# Get album releases from MB
|
||||
mb_releases = MusicBrainzRelease.where('album_id = ? AND release_type = 1', mb_album.id).order('date ASC, id ASC')
|
||||
# Get tracks from the first release and then exclude release
|
||||
mb_main_tracks = MusicBrainzTrack.where('release_id IN (?)', mb_releases.shift.id).order('position ASC')
|
||||
# Creating hashed array for matching
|
||||
mb_main_tracks_hashed = []
|
||||
mb_main_tracks.each do |mb_track|
|
||||
mb_main_tracks_hashed << mb_track.name.downcase.scan(/[a-z0-9]*/).join
|
||||
end
|
||||
# Getting other releases ids
|
||||
release_ids = []
|
||||
mb_releases.each do |mb_release|
|
||||
release_ids << mb_release.id
|
||||
end
|
||||
# Searching for tracks in other releases
|
||||
mb_other_tracks = MusicBrainzTrack.where('release_id IN (?)', release_ids).order('position ASC')
|
||||
mb_bonus_tracks = []
|
||||
mb_other_tracks.each do |mb_track|
|
||||
unless mb_main_tracks_hashed.include? mb_track.name.downcase.scan(/[a-z0-9]*/).join
|
||||
mb_bonus_tracks << mb_track
|
||||
end
|
||||
end
|
||||
# Saving tracks
|
||||
mb_main_tracks.each do |mb_track|
|
||||
track = Track.new
|
||||
track.name = mb_track.name
|
||||
track.album_id = album.id
|
||||
track.position = mb_track.position
|
||||
track.length = mb_track.length
|
||||
track.bonus = 0
|
||||
track.live = mb_track.name.downcase.include? 'live'
|
||||
track.acoustic = mb_track.name.downcase.include? 'acoustic'
|
||||
track.save
|
||||
end
|
||||
mb_bonus_tracks.each do |mb_track|
|
||||
track = Track.new
|
||||
track.name = mb_track.name
|
||||
track.album_id = album.id
|
||||
track.position = mb_track.position
|
||||
track.length = mb_track.length
|
||||
track.bonus = 1
|
||||
track.live = mb_track.name.downcase.include? 'live'
|
||||
track.acoustic = mb_track.name.downcase.include? 'acoustic'
|
||||
track.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
unless mb_releases.empty?
|
||||
# Get tracks from the first release and then exclude release
|
||||
mb_main_tracks = MusicBrainzTrack.where('release_id IN (?)', mb_releases.shift.id).order('position ASC')
|
||||
unless mb_main_tracks.empty?
|
||||
# Saving album
|
||||
album_xml = open(
|
||||
'http://ws.audioscrobbler.com/2.0/'+
|
||||
'?method=album.getinfo&api_key=04fda005dbf61a50af5abc3e90f111f2'+
|
||||
'&artist='+ URI.escape(name).gsub(/\&/, '%26').gsub(/\?/, '%3F')+
|
||||
'&album='+ URI.escape(mb_album.name).gsub(/\&/, '%26').gsub(/\?/, '%3F')).read
|
||||
album = Album.new
|
||||
album.name = mb_album.name
|
||||
album.year = mb_album.year
|
||||
album.artist_id = artist.id
|
||||
album.status = 1
|
||||
album.pic_url = album_xml.scan(/<image\ssize=\"extralarge\">?(.*)<\/image>/)[0][0]
|
||||
album.save
|
||||
# Creating hashed array for matching
|
||||
mb_main_tracks_hashed = []
|
||||
mb_main_tracks.each do |mb_track|
|
||||
mb_main_tracks_hashed << mb_track.name.downcase.scan(/[a-z0-9]*/).join
|
||||
end
|
||||
# Getting other releases ids
|
||||
release_ids = []
|
||||
mb_releases.each do |mb_release|
|
||||
release_ids << mb_release.id
|
||||
end
|
||||
# Searching for tracks in other releases
|
||||
mb_other_tracks = MusicBrainzTrack.where('release_id IN (?)', release_ids).order('position ASC')
|
||||
mb_bonus_tracks = []
|
||||
mb_other_tracks.each do |mb_track|
|
||||
unless mb_main_tracks_hashed.include? mb_track.name.downcase.scan(/[a-z0-9]*/).join
|
||||
mb_bonus_tracks << mb_track
|
||||
end
|
||||
end # mb_other_tracks.each do |mb_track|
|
||||
# Saving tracks
|
||||
mb_main_tracks.each do |mb_track|
|
||||
track = Track.new
|
||||
track.name = mb_track.name
|
||||
track.album_id = album.id
|
||||
track.position = mb_track.position
|
||||
track.length = mb_track.length
|
||||
track.bonus = 0
|
||||
track.live = mb_track.name.downcase.include? 'live'
|
||||
track.acoustic = mb_track.name.downcase.include? 'acoustic'
|
||||
track.save
|
||||
end #mb_main_tracks.each do |mb_track|
|
||||
mb_bonus_tracks.each do |mb_track|
|
||||
track = Track.new
|
||||
track.name = mb_track.name
|
||||
track.album_id = album.id
|
||||
track.position = mb_track.position
|
||||
track.length = mb_track.length
|
||||
track.bonus = 1
|
||||
track.live = mb_track.name.downcase.include? 'live'
|
||||
track.acoustic = mb_track.name.downcase.include? 'acoustic'
|
||||
track.save
|
||||
end # mb_bonus_tracks.each do |mb_track|
|
||||
end # unless mb_main_tracks.empty?
|
||||
end # unless mb_releases.empty?
|
||||
end # mb_albums.each do |mb_album|
|
||||
end # def self.importArtist name
|
||||
end
|
|
@ -3,7 +3,7 @@ require 'open-uri'
|
|||
namespace :db do
|
||||
desc 'Imports data from MusicBrainz database'
|
||||
task :import => :environment do
|
||||
ati = ['Foo Fighters']
|
||||
ati = ['Jet']
|
||||
ati.each do |name|
|
||||
ImportController.importArtist(name)
|
||||
end
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/Users/chez/Sites/Progress/
|
|
@ -3,19 +3,19 @@
|
|||
<head>
|
||||
<title>BetaHaven</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/layout.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/misc.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/player.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/albums.css" />
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/jquery.scroll.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/layout.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/ajax.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/pages.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/audio.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/player.js"></script>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/layout.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/misc.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/player.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/albums.css" />
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/jquery.min.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/jquery.scroll.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/layout.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/ajax.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/pages.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/audio.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/player.js"></script>
|
||||
<script type="text/javascript" charset="windows-1251" src="http://vkontakte.ru/js/api/openapi.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="javascripts/vkontakte.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/javascripts/vkontakte.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
Before Width: | Height: | Size: 27 KiB |
Binary file not shown.
Before Width: | Height: | Size: 81 KiB |
Binary file not shown.
Before Width: | Height: | Size: 29 KiB |
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
|
@ -1,239 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Ruby on Rails: Welcome aboard</title>
|
||||
<style type="text/css" media="screen">
|
||||
body {
|
||||
margin: 0;
|
||||
margin-bottom: 25px;
|
||||
padding: 0;
|
||||
background-color: #f0f0f0;
|
||||
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
a {color: #03c}
|
||||
a:hover {
|
||||
background-color: #03c;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
#page {
|
||||
background-color: #f0f0f0;
|
||||
width: 750px;
|
||||
margin: 0;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
#content {
|
||||
float: left;
|
||||
background-color: white;
|
||||
border: 3px solid #aaa;
|
||||
border-top: none;
|
||||
padding: 25px;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
float: right;
|
||||
width: 175px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
|
||||
#header, #about, #getting-started {
|
||||
padding-left: 75px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
|
||||
#header {
|
||||
background-image: url("images/rails.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left;
|
||||
height: 64px;
|
||||
}
|
||||
#header h1, #header h2 {margin: 0}
|
||||
#header h2 {
|
||||
color: #888;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
|
||||
#about h3 {
|
||||
margin: 0;
|
||||
margin-bottom: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#about-content {
|
||||
background-color: #ffd;
|
||||
border: 1px solid #fc0;
|
||||
margin-left: -55px;
|
||||
margin-right: -10px;
|
||||
}
|
||||
#about-content table {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 11px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
#about-content td {
|
||||
padding: 10px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
#about-content td.name {color: #555}
|
||||
#about-content td.value {color: #000}
|
||||
|
||||
#about-content ul {
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#about-content.failure {
|
||||
background-color: #fcc;
|
||||
border: 1px solid #f00;
|
||||
}
|
||||
#about-content.failure p {
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
#getting-started {
|
||||
border-top: 1px solid #ccc;
|
||||
margin-top: 25px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
#getting-started h1 {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
}
|
||||
#getting-started h2 {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
color: #333;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
#getting-started ol {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
#getting-started li {
|
||||
font-size: 18px;
|
||||
color: #888;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
#getting-started li h2 {
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
#getting-started li p {
|
||||
color: #555;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
#sidebar ul {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
#sidebar ul h3 {
|
||||
margin-top: 25px;
|
||||
font-size: 16px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
#sidebar li {
|
||||
list-style-type: none;
|
||||
}
|
||||
#sidebar ul.links li {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function about() {
|
||||
info = document.getElementById('about-content');
|
||||
if (window.XMLHttpRequest)
|
||||
{ xhr = new XMLHttpRequest(); }
|
||||
else
|
||||
{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
|
||||
xhr.open("GET","rails/info/properties",false);
|
||||
xhr.send("");
|
||||
info.innerHTML = xhr.responseText;
|
||||
info.style.display = 'block'
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div id="sidebar">
|
||||
<ul id="sidebar-items">
|
||||
<li>
|
||||
<h3>Browse the documentation</h3>
|
||||
<ul class="links">
|
||||
<li><a href="http://api.rubyonrails.org/">Rails API</a></li>
|
||||
<li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
|
||||
<li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
|
||||
<li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<div id="header">
|
||||
<h1>Welcome aboard</h1>
|
||||
<h2>You’re riding Ruby on Rails!</h2>
|
||||
</div>
|
||||
|
||||
<div id="about">
|
||||
<h3><a href="rails/info/properties" onclick="about(); return false">About your application’s environment</a></h3>
|
||||
<div id="about-content" style="display: none"></div>
|
||||
</div>
|
||||
|
||||
<div id="getting-started">
|
||||
<h1>Getting started</h1>
|
||||
<h2>Here’s how to get rolling:</h2>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
<h2>Use <code>rails generate</code> to create your models and controllers</h2>
|
||||
<p>To see all available options, run it without parameters.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<h2>Set up a default route and remove or rename this file</h2>
|
||||
<p>Routes are set up in config/routes.rb.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<h2>Create your database</h2>
|
||||
<p>Run <code>rake db:migrate</code> to create your database. If you're not using SQLite (the default), edit <code>config/database.yml</code> with your username and password.</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer"> </div>
|
||||
</div>
|
||||
</body>
|
||||
<head>
|
||||
<title>BeatHaven</title>
|
||||
<style type="text/css" media="screen">
|
||||
#whoaaa {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 700px;
|
||||
height: 350px;
|
||||
margin: -300px 0 0 -350px;
|
||||
text-align: center;
|
||||
font: 36px Georgia;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="whoaaa">
|
||||
<h1>None shall pass!</h1>
|
||||
<img src="/images/black_knight.jpg" alt="Cumming soon (:">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue