home_page_music 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/music/home_controller.rb +17 -0
- data/app/controllers/music/videos_controller.rb +26 -0
- data/app/controllers/music/year_in_reviews_controller.rb +1 -1
- data/app/views/apis/lastfm/_chart_image_settings.html.erb +21 -0
- data/app/views/apis/lastfm/_settings.html.erb +28 -0
- data/app/views/music/artists/_collection.html.erb +19 -0
- data/app/views/music/home/index.html.erb +56 -0
- data/app/views/music/releases/_collection.html.erb +19 -0
- data/app/views/music/tracks/_collection.html.erb +33 -0
- data/app/views/music/tracks/_recent_chart_image.html.erb +7 -0
- data/app/views/music/videos/index.html.erb +14 -0
- data/app/views/music/year_in_reviews/_collection.html.erb +2 -2
- data/app/views/settings/plugins/home_page_music/_panel.html.erb +30 -0
- data/config/initializers/default_settings.rb +17 -0
- data/config/locales/resources/general/en.yml +6 -0
- data/config/locales/resources/music/en.yml +13 -1
- data/config/locales/resources/music_videos/en.yml +6 -0
- data/config/locales/resources/setting/en.yml +28 -0
- data/config/routes.rb +2 -0
- data/lib/home_page_music.rb +3 -0
- data/lib/home_page_music/api/lastfm_request.rb +51 -0
- data/lib/home_page_music/navigation.rb +4 -2
- data/lib/home_page_music/version.rb +1 -1
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8382dd28fcd3538340e2bc7ab7b235017ba13f29
|
4
|
+
data.tar.gz: 1dc85aed65a165059e5f8c85668ba962fbd6e3d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13ae8aca474c625c24b3bbbf8ef94bcd0e2124f2eaac994741dfea415211d09e36e2d55579c25a58907af74415b9a54973aed709f869f4e2a3e50da856938715
|
7
|
+
data.tar.gz: 6360c0416d8547d270e895d9826e821aa6cff8a2f87ed156dfc04c3ffa694cf1c8abf9cb45b5ff62788796766bc1e894e6e87407437dcf6f5fd7131a6a8964ec
|
@@ -1,4 +1,21 @@
|
|
1
1
|
class Music::HomeController < ApplicationController
|
2
2
|
def index
|
3
|
+
@home_page_stylesheets = ['home_page/application', 'vendors/keen/dashboards']
|
4
|
+
@body_class = 'application'
|
5
|
+
@user_name = Setting['home_page.apis.providers.lastfm.user_name']
|
6
|
+
@recent_tracks = HomePageMusic::Api::LastfmRequest.new(
|
7
|
+
:user, :get_recent_tracks, nil, user: @user_name, limit: 4, extended: 1
|
8
|
+
).response
|
9
|
+
@artists = HomePageMusic::Api::LastfmRequest.new(
|
10
|
+
:user, :get_top_artists, nil, user: @user_name, limit: 10
|
11
|
+
).response
|
12
|
+
@releases = HomePageMusic::Api::LastfmRequest.new(
|
13
|
+
:user, :get_top_albums, nil, user: @user_name, limit: 10
|
14
|
+
).response
|
15
|
+
@tracks = HomePageMusic::Api::LastfmRequest.new(
|
16
|
+
:user, :get_top_tracks, nil, user: @user_name, limit: 10
|
17
|
+
).response
|
18
|
+
|
19
|
+
render layout: 'fluid/without_rows'
|
3
20
|
end
|
4
21
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Music::VideosController < ApplicationController
|
2
|
+
before_filter :show_breadcrumbs
|
3
|
+
|
4
|
+
def index
|
5
|
+
host = HomePage::ApiProviderHost.new('volontariat', Rails.env).to_s
|
6
|
+
user_id = Setting['home_page.apis.providers.volontariat.user_id']
|
7
|
+
|
8
|
+
begin
|
9
|
+
@videos = JSON.parse(
|
10
|
+
HTTParty.get("#{host}/api/v1/users/#{user_id}/library/music/videos.json?page=#{params[:page]}").body
|
11
|
+
)
|
12
|
+
rescue JSON::ParserError
|
13
|
+
end
|
14
|
+
|
15
|
+
if @videos.nil?
|
16
|
+
flash[:alert] = I18n.t('general.apis.request_failed', provider: 'Volontari.at')
|
17
|
+
@videos = { 'entries' => [] }
|
18
|
+
else
|
19
|
+
@pagination = HomePage::PaginationMetadata.new(@videos)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def resource
|
24
|
+
@video
|
25
|
+
end
|
26
|
+
end
|
@@ -10,7 +10,7 @@ class Music::YearInReviewsController < ApplicationController
|
|
10
10
|
end
|
11
11
|
|
12
12
|
if @year_in_reviews.nil?
|
13
|
-
flash[:alert] = I18n.t('general.
|
13
|
+
flash[:alert] = I18n.t('general.apis.request_failed', provider: 'Volontari.at')
|
14
14
|
@year_in_reviews = { 'entries' => [] }
|
15
15
|
else
|
16
16
|
@pagination = HomePage::PaginationMetadata.new(@year_in_reviews)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div role="tabpanel">
|
2
|
+
<ul class="nav nav-tabs" role="tablist">
|
3
|
+
<li role="presentation" class="active">
|
4
|
+
<a
|
5
|
+
href="#home_page_music_settings_apis_lastfm_recent_tracks_chart_image"
|
6
|
+
aria-controls="home_page_music_settings_apis_lastfm_recent_tracks_chart_image" role="tab" data-toggle="tab"
|
7
|
+
>
|
8
|
+
<%= t('settings.index.plugins.home_page_music.tabs.apis.lastfm.chart_images.recent_tracks.title') %>
|
9
|
+
</a>
|
10
|
+
</li>
|
11
|
+
</ul>
|
12
|
+
<div class="tab-content">
|
13
|
+
<div role="tabpanel" class="tab-pane active" id="home_page_music_settings_apis_lastfm_recent_tracks_chart_image">
|
14
|
+
<p>
|
15
|
+
<%= setting_input f, 'home_page.apis.providers.lastfm.charts.types.recent_tracks.is_image' %>
|
16
|
+
<%= setting_input f, 'home_page.apis.providers.lastfm.charts.types.recent_tracks.design' %>
|
17
|
+
<%= setting_input f, 'home_page.apis.providers.lastfm.charts.types.recent_tracks.tracks_count' %>
|
18
|
+
</p>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<div role="tabpanel">
|
2
|
+
<ul class="nav nav-tabs" role="tablist">
|
3
|
+
<li role="presentation" class="active">
|
4
|
+
<a href="#home_page_music_settings_apis_lastfm_general" aria-controls="home_page_music_settings_apis_lastfm_general" role="tab" data-toggle="tab">
|
5
|
+
<%= t('settings.index.plugins.home_page.tabs.general.title') %>
|
6
|
+
</a>
|
7
|
+
</li>
|
8
|
+
<li role="presentation">
|
9
|
+
<a href="#home_page_music_settings_apis_lastfm_chart_images" aria-controls="home_page_music_settings_apis_lastfm_chart_images" role="tab" data-toggle="tab">
|
10
|
+
<%= t('settings.index.plugins.home_page_music.tabs.apis.lastfm.chart_images.title') %>
|
11
|
+
</a>
|
12
|
+
</li>
|
13
|
+
</ul>
|
14
|
+
<div class="tab-content">
|
15
|
+
<div role="tabpanel" class="tab-pane active" id="home_page_music_settings_apis_lastfm_general">
|
16
|
+
<p>
|
17
|
+
<%= setting_input f, 'home_page.apis.providers.lastfm.user_name', label: t('general.apis.user_name'), required: true %>
|
18
|
+
<%= setting_input f, 'home_page.apis.providers.lastfm.key', label: t('general.apis.key'), required: true %>
|
19
|
+
<%= setting_input f, 'home_page.apis.providers.lastfm.secret', label: t('general.apis.secret'), required: true %>
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
<div role="tabpanel" class="tab-pane" id="home_page_music_settings_apis_lastfm_chart_images">
|
23
|
+
<p>
|
24
|
+
<%= render partial: 'apis/lastfm/chart_image_settings', locals: { f: f } %>
|
25
|
+
</p>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% if (@artists || []).none? %>
|
2
|
+
<p><%= t('music.index.top_artists.none') %></p>
|
3
|
+
<% else %>
|
4
|
+
<table class="table table-striped">
|
5
|
+
<tbody>
|
6
|
+
<% @artists.each do |artist| %>
|
7
|
+
<tr class="<%= cycle('odd', 'even') %>">
|
8
|
+
<td style="width:70px; text-align:right;">
|
9
|
+
<%= image_tag (artist['image'] || []).select{|i| i['size'] == 'medium' }.first['content'] %>
|
10
|
+
</td>
|
11
|
+
<td style="width: 50px; text-align:right;"><%= artist['rank'] %></td>
|
12
|
+
<td style="width: 100%;">
|
13
|
+
<%= link_to artist['name'], artist['url'] %>
|
14
|
+
</td>
|
15
|
+
<td style="width: 50px; text-align:right;"><%= artist['playcount'] %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
</table>
|
19
|
+
<% end %>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-sm-12">
|
3
|
+
<div class="chart-wrapper">
|
4
|
+
<div class="chart-title">
|
5
|
+
<%= t('music.index.recent_tracks.title') %>
|
6
|
+
</div>
|
7
|
+
<div class="chart-stage">
|
8
|
+
<%= render partial: 'music/tracks/collection', locals: { tracks: @recent_tracks, recent: true } %>
|
9
|
+
</div>
|
10
|
+
<div class="chart-notes" style="text-align:center;">
|
11
|
+
<%= link_to t('general.more'), "http://www.last.fm/user/#{@user_name}/tracks" %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="row">
|
17
|
+
<div class="col-sm-6 col-md-4">
|
18
|
+
<div class="chart-wrapper">
|
19
|
+
<div class="chart-title">
|
20
|
+
<%= t('music.index.top_artists.title') %>
|
21
|
+
</div>
|
22
|
+
<div class="chart-stage">
|
23
|
+
<%= render partial: 'music/artists/collection' %>
|
24
|
+
</div>
|
25
|
+
<div class="chart-notes" style="text-align:center;">
|
26
|
+
<%= link_to t('general.more'), "http://www.last.fm/user/#{@user_name}/charts?rangetype=overall&subtype=artists" %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<div class="col-sm-6 col-md-4">
|
31
|
+
<div class="chart-wrapper">
|
32
|
+
<div class="chart-title">
|
33
|
+
<%= t('music.index.top_releases.title') %>
|
34
|
+
</div>
|
35
|
+
<div class="chart-stage">
|
36
|
+
<%= render partial: 'music/releases/collection' %>
|
37
|
+
</div>
|
38
|
+
<div class="chart-notes" style="text-align:center;">
|
39
|
+
<%= link_to t('general.more'), "http://www.last.fm/user/#{@user_name}/charts?rangetype=overall&subtype=albums" %>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
<div class="col-sm-6 col-md-4">
|
44
|
+
<div class="chart-wrapper">
|
45
|
+
<div class="chart-title">
|
46
|
+
<%= t('music.index.top_tracks.title') %>
|
47
|
+
</div>
|
48
|
+
<div class="chart-stage">
|
49
|
+
<%= render partial: 'music/tracks/collection', locals: { tracks: @tracks } %>
|
50
|
+
</div>
|
51
|
+
<div class="chart-notes" style="text-align:center;">
|
52
|
+
<%= link_to t('general.more'), "http://www.last.fm/user/#{@user_name}/charts?rangetype=overall&subtype=tracks" %>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% if (@releases || []).none? %>
|
2
|
+
<p><%= t('music.index.top_releases.none') %></p>
|
3
|
+
<% else %>
|
4
|
+
<table class="table table-striped">
|
5
|
+
<tbody>
|
6
|
+
<% @releases.each do |release| %>
|
7
|
+
<tr class="<%= cycle('odd', 'even') %>">
|
8
|
+
<td style="width:70px; text-align:right;">
|
9
|
+
<%= image_tag (release['image'] || []).select{|i| i['size'] == 'medium' }.first['content'] %>
|
10
|
+
</td>
|
11
|
+
<td style="width: 50px; text-align:right;"><%= release['rank'] %></td>
|
12
|
+
<td style="width: 100%;">
|
13
|
+
<%= link_to release['artist']['name'], release['artist']['url'] %> – <%= link_to release['name'], release['url'] %>
|
14
|
+
</td>
|
15
|
+
<td style="width: 50px; text-align:right;"><%= release['playcount'] %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
</table>
|
19
|
+
<% end %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% recent ||= false %>
|
2
|
+
|
3
|
+
<% if (tracks || []).none? %>
|
4
|
+
<p><%= t('music.index.top_tracks.none') %></p>
|
5
|
+
<% else %>
|
6
|
+
<table class="table table-striped">
|
7
|
+
<tbody>
|
8
|
+
<% tracks.each do |track| %>
|
9
|
+
<tr class="<%= cycle('odd', 'even') %>">
|
10
|
+
<% if recent %>
|
11
|
+
<td style="width:70px; text-align:right;">
|
12
|
+
<%= image_tag (track['image'] || []).select{|i| i['size'] == 'medium' }.first['content'] %>
|
13
|
+
</td>
|
14
|
+
<% else %>
|
15
|
+
<td style="width:50px; text-align:right;"><%= track['rank'] %></td>
|
16
|
+
<% end %>
|
17
|
+
<td style="width:100%;">
|
18
|
+
<%= link_to track['artist']['name'], track['artist']['url'] %> – <%= link_to track['name'], track['url'] %>
|
19
|
+
</td>
|
20
|
+
<td style="width:50px; text-align:right;"><%= track['playcount'] %></td>
|
21
|
+
<% if recent %>
|
22
|
+
<td style="width:100px; text-align:center; white-space:nowrap;">
|
23
|
+
<% if track['nowplaying'] %>
|
24
|
+
<%= t('music.index.recent_tracks.listening_now') %>
|
25
|
+
<% else %>
|
26
|
+
<%= DateTime.parse(track['date']['content']).strftime('%d.%m.%Y %H:%M') %>
|
27
|
+
<% end %>
|
28
|
+
</td>
|
29
|
+
<% end %>
|
30
|
+
</tr>
|
31
|
+
<% end %>
|
32
|
+
</table>
|
33
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<a href="http://www.last.fm/user/<%= Setting['home_page.apis.providers.lastfm.user_name'] %>/tracks">
|
2
|
+
<img src="<%=
|
3
|
+
"http://imagegen.last.fm/#{Setting['home_page.apis.providers.lastfm.charts.types.recent_tracks.design']}/" +
|
4
|
+
"recenttracks/#{Setting['home_page.apis.providers.lastfm.charts.types.recent_tracks.tracks_count']}/" +
|
5
|
+
"#{Setting['home_page.apis.providers.lastfm.user_name']}.gif"
|
6
|
+
%>" border="0" />
|
7
|
+
</a>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% content_for :title do %><%= t('music_videos.index.title') %><% end %>
|
2
|
+
|
3
|
+
<% if @videos['entries'].none? %>
|
4
|
+
<p><%= t('music_videos.index.empty_collection') %></p>
|
5
|
+
<% else %>
|
6
|
+
<% @videos['entries'].each do |video| %>
|
7
|
+
<h5><%= link_to(
|
8
|
+
"#{video['artist_name']} – #{video['track_name']} (#{video['status']})",
|
9
|
+
"#{Volontariat::HOSTS[Rails.env.to_s.to_sym]}/music/videos/#{video['id']}"
|
10
|
+
) %> <%= t('general.liked_at') %> <%= DateTime.parse(video['liked_at']).strftime('%d.%m.%Y %H:%M:%S') %></h4>
|
11
|
+
<p><%= markdown video['url'] %></p>
|
12
|
+
<% end %>
|
13
|
+
<%= will_paginate @pagination, renderer: BootstrapPagination::Rails %>
|
14
|
+
<% end %>
|
@@ -18,13 +18,13 @@
|
|
18
18
|
<td>
|
19
19
|
<%= link_to(
|
20
20
|
t('music_year_in_reviews.show.top_albums.short_title'),
|
21
|
-
|
21
|
+
top_albums_music_year_in_review_path(year_in_review['year'])
|
22
22
|
) %>
|
23
23
|
</td>
|
24
24
|
<td>
|
25
25
|
<%= link_to(
|
26
26
|
t('music_year_in_reviews.show.top_songs.short_title'),
|
27
|
-
|
27
|
+
top_songs_music_year_in_review_path(year_in_review['year'])
|
28
28
|
) %>
|
29
29
|
</td>
|
30
30
|
</tr>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<div class="panel panel-default">
|
2
|
+
<div class="panel-heading" role="tab" id="heading<%= index + 1 %>">
|
3
|
+
<h4 class="panel-title">
|
4
|
+
<a data-toggle="collapse" data-parent="#settings_accordion" href="#home_page_music_settings" aria-expanded="true" aria-controls="home_page_music_settings">
|
5
|
+
<%= t('settings.index.plugins.home_page_music.index.title') %>
|
6
|
+
</a>
|
7
|
+
</h4>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div id="home_page_music_settings" class="panel-collapse collapse<% if index == 0 %> in<% end %>" role="tabpanel" aria-labelledby="heading<%= index + 1 %>">
|
11
|
+
<div class="panel-body">
|
12
|
+
<div role="tabpanel">
|
13
|
+
<ul class="nav nav-tabs" role="tablist">
|
14
|
+
<li role="presentation" class="active">
|
15
|
+
<a href="#home_page_music_settings_general" aria-controls="home_page_music_settings_general" role="tab" data-toggle="tab">
|
16
|
+
<%= t('settings.index.plugins.home_page.tabs.general.title') %>
|
17
|
+
</a>
|
18
|
+
</li>
|
19
|
+
</ul>
|
20
|
+
<div class="tab-content">
|
21
|
+
<div role="tabpanel" class="tab-pane active" id="home_page_music_settings_general">
|
22
|
+
<p>
|
23
|
+
<%= t('general.todo') %>
|
24
|
+
</p>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
if Setting.table_exists? && !Setting['home_page.general.plugins'].include?('home_page_music')
|
2
|
+
Setting['home_page.general.plugins'] = Setting['home_page.general.plugins'] + ['home_page_music']
|
3
|
+
end
|
4
|
+
|
5
|
+
Setting.defaults['home_page_music.general.available_apis'] = ['lastfm']
|
6
|
+
|
7
|
+
# cannot be set to false yet for the time being without text logic
|
8
|
+
Setting.defaults['home_page.apis.providers.lastfm.user_name'] = ''
|
9
|
+
Setting.defaults['home_page.apis.providers.lastfm.charts.types.recent_tracks.is_image'] = true
|
10
|
+
Setting.defaults['home_page.apis.providers.lastfm.charts.types.recent_tracks.design'] = 'TBM-RecentTracks2'
|
11
|
+
Setting.defaults['home_page.apis.providers.lastfm.charts.types.recent_tracks.tracks_count'] = 6
|
12
|
+
Setting.defaults['home_page.apis.providers.lastfm.key'] = ''
|
13
|
+
Setting.defaults['home_page.apis.providers.lastfm.secret'] = ''
|
14
|
+
|
15
|
+
Setting.defaults['home_page_music.general.partial_paths'] = [
|
16
|
+
'music/tracks/recent_chart_image'
|
17
|
+
]
|
@@ -2,7 +2,19 @@ en:
|
|
2
2
|
music:
|
3
3
|
index:
|
4
4
|
title: Music
|
5
|
-
|
5
|
+
recent_tracks:
|
6
|
+
title: Recently Listened Tracks
|
7
|
+
listening_now: Listening now
|
8
|
+
top_artists:
|
9
|
+
title: Top Artists
|
10
|
+
none: No top artists available.
|
11
|
+
top_releases:
|
12
|
+
title: Top Releases
|
13
|
+
none: No top releases available.
|
14
|
+
top_tracks:
|
15
|
+
title: Top Tracks
|
16
|
+
none: No top tracks available.
|
17
|
+
|
6
18
|
general:
|
7
19
|
music_artist:
|
8
20
|
short: Artist
|
@@ -0,0 +1,28 @@
|
|
1
|
+
en:
|
2
|
+
settings:
|
3
|
+
index:
|
4
|
+
plugins:
|
5
|
+
home_page_music:
|
6
|
+
index:
|
7
|
+
title: Music
|
8
|
+
tabs:
|
9
|
+
general:
|
10
|
+
title: General
|
11
|
+
apis:
|
12
|
+
lastfm:
|
13
|
+
chart_images:
|
14
|
+
title: Chart Images
|
15
|
+
recent_tracks:
|
16
|
+
title: Recent Tracks
|
17
|
+
|
18
|
+
vars:
|
19
|
+
home_page_music:
|
20
|
+
apis:
|
21
|
+
providers:
|
22
|
+
lastfm:
|
23
|
+
charts:
|
24
|
+
types:
|
25
|
+
recent_tracks:
|
26
|
+
is_image: Is image?
|
27
|
+
design: Design
|
28
|
+
tracks_count: Tracks Count
|
data/config/routes.rb
CHANGED
data/lib/home_page_music.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
module HomePageMusic
|
2
|
+
module Api
|
3
|
+
class LastfmRequest
|
4
|
+
attr_reader :response
|
5
|
+
|
6
|
+
def initialize(resource, method, error_message_reqexp, params = {})
|
7
|
+
lastfm = ::Lastfm.new(
|
8
|
+
Setting['home_page.apis.providers.lastfm.key'],
|
9
|
+
Setting['home_page.apis.providers.lastfm.secret']
|
10
|
+
)
|
11
|
+
@response = nil
|
12
|
+
raise_if_response_is_just_nil = params.delete(:raise_if_response_is_just_nil)
|
13
|
+
raise_parse_exception = params.delete(:raise_parse_exception)
|
14
|
+
i = 1
|
15
|
+
|
16
|
+
3.times do
|
17
|
+
begin
|
18
|
+
@response = lastfm.send(resource).send(method, params)
|
19
|
+
|
20
|
+
raise 'last.fm response is just nil without exceptions' if @response.nil? && raise_if_response_is_just_nil
|
21
|
+
|
22
|
+
break
|
23
|
+
rescue Timeout::Error, EOFError => e
|
24
|
+
puts "lastfm: #{e.class.name} for ##{i} time"
|
25
|
+
sleep 60
|
26
|
+
rescue ArgumentError => e
|
27
|
+
if e.message.match('File does not exist')
|
28
|
+
puts "lastfm: 'File does not exist' sleep 60 seconds for ##{i} time ..."
|
29
|
+
sleep 60
|
30
|
+
else
|
31
|
+
raise e
|
32
|
+
end
|
33
|
+
rescue ::Lastfm::ApiError => e
|
34
|
+
if error_message_reqexp.nil? || e.message.match(error_message_reqexp).nil?
|
35
|
+
if e.message.match(/Operation failed - Something else went wrong/)
|
36
|
+
puts "lastfm: operation failed - something else went wrong for ##{i} time ..."
|
37
|
+
sleep 60
|
38
|
+
else
|
39
|
+
raise e
|
40
|
+
end
|
41
|
+
end
|
42
|
+
rescue REXML::ParseException => e
|
43
|
+
raise e if raise_parse_exception
|
44
|
+
end
|
45
|
+
|
46
|
+
i += 1
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -2,10 +2,10 @@ module HomePageMusic
|
|
2
2
|
module Navigation
|
3
3
|
def self.menu_code(resource)
|
4
4
|
case resource
|
5
|
-
when
|
5
|
+
when 'music'
|
6
6
|
Proc.new do |primary, options|
|
7
7
|
primary.item :music, I18n.t('music.index.title'), music_path do |music|
|
8
|
-
music.item :year_in_reviews, I18n.t('music_year_in_reviews.index.
|
8
|
+
music.item :year_in_reviews, I18n.t('music_year_in_reviews.index.short_title'), music_year_in_reviews_path do |year_in_reviews|
|
9
9
|
if @year_in_review.present?
|
10
10
|
year_in_reviews.item :show, @year_in_review['year'], music_year_in_review_path(@year_in_review['year']) do |year_in_review|
|
11
11
|
year_in_review.item :top_albums, I18n.t('music_year_in_reviews.show.top_albums.short_title'), top_albums_music_year_in_review_path(@year_in_review['year'])
|
@@ -13,6 +13,8 @@ module HomePageMusic
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
music.item :videos, I18n.t('music_videos.index.short_title'), music_videos_path
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: home_page_music
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Gawlista
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: home_page
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: lastfm
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.26.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.26.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: mysql2
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,7 +52,7 @@ dependencies:
|
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
|
-
description: Music
|
55
|
+
description: 'Music plugin for #Rails CMS http://Home-Page.Software - changes: http://bit.ly/home-page-music-0-0-2'
|
42
56
|
email:
|
43
57
|
- gawlista@gmail.com
|
44
58
|
executables: []
|
@@ -49,17 +63,31 @@ files:
|
|
49
63
|
- README.rdoc
|
50
64
|
- Rakefile
|
51
65
|
- app/controllers/music/home_controller.rb
|
66
|
+
- app/controllers/music/videos_controller.rb
|
52
67
|
- app/controllers/music/year_in_reviews_controller.rb
|
68
|
+
- app/views/apis/lastfm/_chart_image_settings.html.erb
|
69
|
+
- app/views/apis/lastfm/_settings.html.erb
|
70
|
+
- app/views/music/artists/_collection.html.erb
|
53
71
|
- app/views/music/home/index.html.erb
|
72
|
+
- app/views/music/releases/_collection.html.erb
|
73
|
+
- app/views/music/tracks/_collection.html.erb
|
74
|
+
- app/views/music/tracks/_recent_chart_image.html.erb
|
75
|
+
- app/views/music/videos/index.html.erb
|
54
76
|
- app/views/music/year_in_reviews/_collection.html.erb
|
55
77
|
- app/views/music/year_in_reviews/index.html.erb
|
56
78
|
- app/views/music/year_in_reviews/show.html.erb
|
57
79
|
- app/views/music/year_in_reviews/top_albums.html.erb
|
58
80
|
- app/views/music/year_in_reviews/top_songs.html.erb
|
81
|
+
- app/views/settings/plugins/home_page_music/_panel.html.erb
|
82
|
+
- config/initializers/default_settings.rb
|
83
|
+
- config/locales/resources/general/en.yml
|
59
84
|
- config/locales/resources/music/en.yml
|
85
|
+
- config/locales/resources/music_videos/en.yml
|
60
86
|
- config/locales/resources/music_year_in_reviews/en.yml
|
87
|
+
- config/locales/resources/setting/en.yml
|
61
88
|
- config/routes.rb
|
62
89
|
- lib/home_page_music.rb
|
90
|
+
- lib/home_page_music/api/lastfm_request.rb
|
63
91
|
- lib/home_page_music/engine.rb
|
64
92
|
- lib/home_page_music/navigation.rb
|
65
93
|
- lib/home_page_music/version.rb
|