voluntary_music_metadata_enrichment 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +23 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/application.js +5 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/groups/show.js.coffee +14 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/library/index.js.coffee +19 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/library/year_in_review_releases/index_view.js.coffee +32 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/library/year_in_review_releases/new_view.js.coffee +31 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/library/year_in_review_tracks/index_view.js.coffee +32 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/library/year_in_review_tracks/new_view.js.coffee +31 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/library/years_in_review/index_view.js.coffee +36 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/tracks/show.js.coffee +2 -0
- data/app/assets/javascripts/voluntary_music_metadata_enrichment/videos/metadata.js.coffee +6 -0
- data/app/controllers/concerns/music_metadata_enrichment/artist_confirmation.rb +207 -0
- data/app/controllers/concerns/music_metadata_enrichment/base_controller.rb +17 -0
- data/app/controllers/concerns/music_metadata_enrichment/track_confirmation.rb +57 -0
- data/app/controllers/library/music/artists_controller.rb +26 -0
- data/app/controllers/library/music/year_in_review_releases_controller.rb +110 -0
- data/app/controllers/library/music/year_in_review_tracks_controller.rb +110 -0
- data/app/controllers/library/music/years_in_review_controller.rb +41 -0
- data/app/controllers/library/music_controller.rb +14 -0
- data/app/controllers/music_metadata_enrichment/application_controller.rb +11 -0
- data/app/controllers/music_metadata_enrichment/artists_controller.rb +93 -0
- data/app/controllers/music_metadata_enrichment/group_artist_connections_controller.rb +63 -0
- data/app/controllers/music_metadata_enrichment/groups_controller.rb +40 -0
- data/app/controllers/music_metadata_enrichment/releases_controller.rb +207 -0
- data/app/controllers/music_metadata_enrichment/tracks_controller.rb +82 -0
- data/app/controllers/music_metadata_enrichment/videos_controller.rb +133 -0
- data/app/controllers/product/music_metadata_enrichment_controller.rb +6 -0
- data/app/models/concerns/year_in_review_music_entry.rb +12 -0
- data/app/models/music_artist.rb +155 -0
- data/app/models/music_library_artist.rb +10 -0
- data/app/models/music_metadata_enrichment/group.rb +136 -0
- data/app/models/music_metadata_enrichment/group_artist_connection.rb +15 -0
- data/app/models/music_release.rb +278 -0
- data/app/models/music_track.rb +255 -0
- data/app/models/music_video.rb +87 -0
- data/app/models/product/music_metadata_enrichment.rb +2 -0
- data/app/models/year_in_review_music.rb +233 -0
- data/app/models/year_in_review_music_release.rb +24 -0
- data/app/models/year_in_review_music_track.rb +28 -0
- data/app/views/library/music/artists/destroy.js.erb +1 -0
- data/app/views/library/music/index.html.erb +46 -0
- data/app/views/library/music/year_in_review_releases/_collection.html.erb +51 -0
- data/app/views/library/music/year_in_review_releases/_form.html.erb +18 -0
- data/app/views/library/music/year_in_review_releases/_multiple_form.html.erb +44 -0
- data/app/views/library/music/year_in_review_releases/create.js.erb +11 -0
- data/app/views/library/music/year_in_review_releases/destroy.js.erb +2 -0
- data/app/views/library/music/year_in_review_releases/export.html.erb +13 -0
- data/app/views/library/music/year_in_review_releases/index.html.erb +22 -0
- data/app/views/library/music/year_in_review_releases/multiple_new.html.erb +1 -0
- data/app/views/library/music/year_in_review_releases/multiple_new.js.erb +7 -0
- data/app/views/library/music/year_in_review_releases/new.html.erb +1 -0
- data/app/views/library/music/year_in_review_tracks/_collection.html.erb +52 -0
- data/app/views/library/music/year_in_review_tracks/_form.html.erb +18 -0
- data/app/views/library/music/year_in_review_tracks/_multiple_form.html.erb +46 -0
- data/app/views/library/music/year_in_review_tracks/create.js.erb +11 -0
- data/app/views/library/music/year_in_review_tracks/destroy.js.erb +2 -0
- data/app/views/library/music/year_in_review_tracks/export.html.erb +13 -0
- data/app/views/library/music/year_in_review_tracks/index.html.erb +22 -0
- data/app/views/library/music/year_in_review_tracks/multiple_new.html.erb +1 -0
- data/app/views/library/music/year_in_review_tracks/multiple_new.js.erb +7 -0
- data/app/views/library/music/year_in_review_tracks/new.html.erb +1 -0
- data/app/views/library/music/years_in_review/_collection.html.erb +52 -0
- data/app/views/library/music/years_in_review/create.js.erb +6 -0
- data/app/views/library/music/years_in_review/index.html.erb +18 -0
- data/app/views/library/music/years_in_review/show.html.erb +20 -0
- data/app/views/music_metadata_enrichment/artists/_collection.html.erb +68 -0
- data/app/views/music_metadata_enrichment/artists/by_name.html.erb +3 -0
- data/app/views/music_metadata_enrichment/artists/index.html.erb +7 -0
- data/app/views/music_metadata_enrichment/artists/name_confirmation.html.erb +1 -0
- data/app/views/music_metadata_enrichment/artists/new.html.erb +1 -0
- data/app/views/music_metadata_enrichment/artists/show.html.erb +24 -0
- data/app/views/music_metadata_enrichment/group_artist_connections/import.html.erb +6 -0
- data/app/views/music_metadata_enrichment/group_artist_connections/index.html.erb +0 -0
- data/app/views/music_metadata_enrichment/group_artist_connections/name_confirmation.html.erb +1 -0
- data/app/views/music_metadata_enrichment/group_artist_connections/new.html.erb +1 -0
- data/app/views/music_metadata_enrichment/groups/index.html.erb +0 -0
- data/app/views/music_metadata_enrichment/groups/new.html.erb +7 -0
- data/app/views/music_metadata_enrichment/groups/show.html.erb +31 -0
- data/app/views/music_metadata_enrichment/releases/_collection.html.erb +53 -0
- data/app/views/music_metadata_enrichment/releases/announce.html.erb +10 -0
- data/app/views/music_metadata_enrichment/releases/artist_confirmation.html.erb +1 -0
- data/app/views/music_metadata_enrichment/releases/by_name.html.erb +24 -0
- data/app/views/music_metadata_enrichment/releases/export.html.erb +17 -0
- data/app/views/music_metadata_enrichment/releases/index.html.erb +8 -0
- data/app/views/music_metadata_enrichment/releases/name.html.erb +9 -0
- data/app/views/music_metadata_enrichment/releases/name_confirmation.html.erb +33 -0
- data/app/views/music_metadata_enrichment/releases/new.html.erb +1 -0
- data/app/views/music_metadata_enrichment/releases/show.html.erb +50 -0
- data/app/views/music_metadata_enrichment/shared/_artist_confirmation_form.html.erb +41 -0
- data/app/views/music_metadata_enrichment/shared/_new_artist_form.html.erb +10 -0
- data/app/views/music_metadata_enrichment/shared/_new_track_form.html.erb +9 -0
- data/app/views/music_metadata_enrichment/shared/_track_confirmation_form.html.erb +29 -0
- data/app/views/music_metadata_enrichment/tracks/_spotify_track_player.html.erb +3 -0
- data/app/views/music_metadata_enrichment/tracks/artist_confirmation.html.erb +1 -0
- data/app/views/music_metadata_enrichment/tracks/by_name.html.erb +26 -0
- data/app/views/music_metadata_enrichment/tracks/index.html.erb +8 -0
- data/app/views/music_metadata_enrichment/tracks/name.html.erb +1 -0
- data/app/views/music_metadata_enrichment/tracks/name_confirmation.html.erb +1 -0
- data/app/views/music_metadata_enrichment/tracks/new.html.erb +1 -0
- data/app/views/music_metadata_enrichment/tracks/show.html.erb +21 -0
- data/app/views/music_metadata_enrichment/videos/_collection.html.erb +25 -0
- data/app/views/music_metadata_enrichment/videos/artist_confirmation.html.erb +1 -0
- data/app/views/music_metadata_enrichment/videos/by_name.html.erb +3 -0
- data/app/views/music_metadata_enrichment/videos/index.html.erb +8 -0
- data/app/views/music_metadata_enrichment/videos/metadata.html.erb +25 -0
- data/app/views/music_metadata_enrichment/videos/new.html.erb +1 -0
- data/app/views/music_metadata_enrichment/videos/show.html.erb +9 -0
- data/app/views/music_metadata_enrichment/videos/track_confirmation.html.erb +1 -0
- data/app/views/music_metadata_enrichment/videos/track_name.html.erb +1 -0
- data/app/views/product/music_metadata_enrichment/index.html.erb +6 -0
- data/config/locales/en.yml +16 -0
- data/config/locales/resources/music_artists/en.yml +43 -0
- data/config/locales/resources/music_library/en.yml +8 -0
- data/config/locales/resources/music_metadata_enrichment_group_artist_connections/en.yml +19 -0
- data/config/locales/resources/music_metadata_enrichment_groups/en.yml +25 -0
- data/config/locales/resources/music_releases/en.yml +67 -0
- data/config/locales/resources/music_tracks/en.yml +45 -0
- data/config/locales/resources/music_videos/en.yml +56 -0
- data/config/locales/resources/year_in_review_music_releases/en.yml +19 -0
- data/config/locales/resources/year_in_review_music_tracks/en.yml +19 -0
- data/config/locales/resources/years_in_review_music/en.yml +21 -0
- data/config/main_music_metadata_enrichment_navigation.rb +3 -0
- data/config/routes.rb +121 -0
- data/db/migrate/20150106183434_add_product_music_metadata_enrichment.rb +96 -0
- data/db/migrate/20150120091801_create_music_metadata_enrichment_groups.rb +28 -0
- data/db/migrate/20150120221419_create_music_library_artists.rb +12 -0
- data/db/migrate/20150123082224_year_in_review_music_entries.rb +53 -0
- data/lib/tasks/voluntary_music_metadata_enrichment_tasks.rake +4 -0
- data/lib/voluntary_music_metadata_enrichment/ability.rb +27 -0
- data/lib/voluntary_music_metadata_enrichment/concerns/model/user/has_music_library.rb +101 -0
- data/lib/voluntary_music_metadata_enrichment/engine.rb +20 -0
- data/lib/voluntary_music_metadata_enrichment/navigation.rb +49 -0
- data/lib/voluntary_music_metadata_enrichment/version.rb +3 -0
- data/lib/voluntary_music_metadata_enrichment.rb +13 -0
- metadata +525 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'VoluntaryMusicMetadataEnrichment'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
@@ -0,0 +1,5 @@
|
|
1
|
+
//= require ./library/years_in_review/index_view
|
2
|
+
//= require ./library/year_in_review_releases/index_view
|
3
|
+
//= require ./library/year_in_review_releases/new_view
|
4
|
+
//= require ./library/year_in_review_tracks/index_view
|
5
|
+
//= require ./library/year_in_review_tracks/new_view
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$(document).ready ->
|
2
|
+
$(document.body).on "change", "select[name^=\"year\"]", ->
|
3
|
+
$.ajax(
|
4
|
+
url: "/music/groups/" + group_id + "/releases"
|
5
|
+
data:
|
6
|
+
year: $(this).val()
|
7
|
+
type: "GET"
|
8
|
+
dataType: "html"
|
9
|
+
).success (data) ->
|
10
|
+
$("#releases").empty()
|
11
|
+
$("#releases").append data
|
12
|
+
return
|
13
|
+
|
14
|
+
new window.Likes.List()
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$(document).ready ->
|
2
|
+
$(document.body).on "change", "select[name^=\"year\"]", ->
|
3
|
+
$.ajax(
|
4
|
+
url: "/users/" + user_id + "/library/music/releases"
|
5
|
+
data:
|
6
|
+
year: $(this).val()
|
7
|
+
type: "GET"
|
8
|
+
dataType: "html"
|
9
|
+
).success (data) ->
|
10
|
+
$("#releases").empty()
|
11
|
+
$("#releases").append data
|
12
|
+
return
|
13
|
+
|
14
|
+
$(document.body).on "ajax:beforeSend", ".destroy_music_library_artist_link", ->
|
15
|
+
$(this).find('.ajax_spinner').show()
|
16
|
+
|
17
|
+
new window.VoluntaryMusicMetadataEnrichment.Library.YearsInReview.IndexView(true)
|
18
|
+
new window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases.IndexView()
|
19
|
+
new window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks.NewView()
|
@@ -0,0 +1,32 @@
|
|
1
|
+
window.VoluntaryMusicMetadataEnrichment or= {}; window.VoluntaryMusicMetadataEnrichment.Library or= {}
|
2
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases or= {}
|
3
|
+
|
4
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases.IndexView = class IndexView
|
5
|
+
constructor: ->
|
6
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases.IndexView.makeCollectionSortable()
|
7
|
+
|
8
|
+
$(document.body).on "ajax:beforeSend", ".destroy_music_year_in_review_top_release_link", ->
|
9
|
+
$(this).find('.ajax_spinner').show()
|
10
|
+
|
11
|
+
new window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases.NewView()
|
12
|
+
|
13
|
+
@makeCollectionSortable: ->
|
14
|
+
$('#year_in_review_music_releases').sortable
|
15
|
+
start: (event, ui) =>
|
16
|
+
window.first_position = $('#year_in_review_music_releases li:first').data('position')
|
17
|
+
window.last_position = $('#year_in_review_music_releases li:last').data('position')
|
18
|
+
|
19
|
+
update: (event, ui) =>
|
20
|
+
source_item = $(ui.item).closest('li')
|
21
|
+
current_position = window.first_position
|
22
|
+
previous_element = null
|
23
|
+
|
24
|
+
$.each $('#year_in_review_music_releases li'), (index, element) ->
|
25
|
+
$(element).data('position', current_position)
|
26
|
+
$('#year_in_review_music_release_position_' + $(element).data('id')).html(current_position)
|
27
|
+
|
28
|
+
if $(element).data('id') == $(source_item).data('id')
|
29
|
+
$.post '/users/current/library/music/year_in_review_music_releases/' + $(element).data('id') + '/move', { _method: 'put', position: current_position }
|
30
|
+
|
31
|
+
previous_element = $(element)
|
32
|
+
current_position += 1
|
@@ -0,0 +1,31 @@
|
|
1
|
+
window.VoluntaryMusicMetadataEnrichment or= {}; window.VoluntaryMusicMetadataEnrichment.Library or= {}
|
2
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases or= {}
|
3
|
+
|
4
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases.NewView = class NewView
|
5
|
+
constructor: ->
|
6
|
+
$(document.body).on "keyup.autocomplete", "#year_in_review_music_release_artist_name", ->
|
7
|
+
$(this).autocomplete
|
8
|
+
source: $(this).data('source')
|
9
|
+
minLength: 2
|
10
|
+
appendTo: '#year_in_review_music_release_artist_name_suggestions'
|
11
|
+
select: (event, ui) ->
|
12
|
+
$(this).val(ui.item.value)
|
13
|
+
$('#year_in_review_music_release_artist_id').val(ui.item.id)
|
14
|
+
|
15
|
+
return false;
|
16
|
+
|
17
|
+
$(document.body).on "keyup.autocomplete", "#year_in_review_music_release_release_name", (event) ->
|
18
|
+
if $('#year_in_review_music_release_artist_id').val()
|
19
|
+
$(this).autocomplete
|
20
|
+
source: '/music/artists/' + $('#year_in_review_music_release_artist_id').val() + '/releases/autocomplete'
|
21
|
+
minLength: 2
|
22
|
+
appendTo: '#year_in_review_music_release_release_name_suggestions'
|
23
|
+
select: (event, ui) ->
|
24
|
+
$(this).val(ui.item.value)
|
25
|
+
$('#year_in_review_music_release_release_id').val(ui.item.id)
|
26
|
+
|
27
|
+
return false;
|
28
|
+
else
|
29
|
+
alert 'Please select an artist!'
|
30
|
+
event.preventDefault()
|
31
|
+
return false
|
@@ -0,0 +1,32 @@
|
|
1
|
+
window.VoluntaryMusicMetadataEnrichment or= {}; window.VoluntaryMusicMetadataEnrichment.Library or= {}
|
2
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks or= {}
|
3
|
+
|
4
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks.IndexView = class IndexView
|
5
|
+
constructor: ->
|
6
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks.IndexView.makeCollectionSortable()
|
7
|
+
|
8
|
+
$(document.body).on "ajax:beforeSend", ".destroy_music_year_in_review_top_track_link", ->
|
9
|
+
$(this).find('.ajax_spinner').show()
|
10
|
+
|
11
|
+
new window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks.NewView()
|
12
|
+
|
13
|
+
@makeCollectionSortable: ->
|
14
|
+
$('#year_in_review_music_tracks').sortable
|
15
|
+
start: (event, ui) =>
|
16
|
+
window.first_position = $('#year_in_review_music_tracks li:first').data('position')
|
17
|
+
window.last_position = $('#year_in_review_music_tracks li:last').data('position')
|
18
|
+
|
19
|
+
update: (event, ui) =>
|
20
|
+
source_item = $(ui.item).closest('li')
|
21
|
+
current_position = window.first_position
|
22
|
+
previous_element = null
|
23
|
+
|
24
|
+
$.each $('#year_in_review_music_tracks li'), (index, element) ->
|
25
|
+
$(element).data('position', current_position)
|
26
|
+
$('#year_in_review_music_track_position_' + $(element).data('id')).html(current_position)
|
27
|
+
|
28
|
+
if $(element).data('id') == $(source_item).data('id')
|
29
|
+
$.post '/users/current/library/music/year_in_review_music_tracks/' + $(element).data('id') + '/move', { _method: 'put', position: current_position }
|
30
|
+
|
31
|
+
previous_element = $(element)
|
32
|
+
current_position += 1
|
@@ -0,0 +1,31 @@
|
|
1
|
+
window.VoluntaryMusicMetadataEnrichment or= {}; window.VoluntaryMusicMetadataEnrichment.Library or= {}
|
2
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks or= {}
|
3
|
+
|
4
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks.NewView = class NewView
|
5
|
+
constructor: ->
|
6
|
+
$(document.body).on "keyup.autocomplete", "#year_in_review_music_track_artist_name", ->
|
7
|
+
$(this).autocomplete
|
8
|
+
source: $(this).data('source')
|
9
|
+
minLength: 2
|
10
|
+
appendTo: '#year_in_review_music_track_artist_name_suggestions'
|
11
|
+
select: (event, ui) ->
|
12
|
+
$(this).val(ui.item.value)
|
13
|
+
$('#year_in_review_music_track_artist_id').val(ui.item.id)
|
14
|
+
|
15
|
+
return false;
|
16
|
+
|
17
|
+
$(document.body).on "keyup.autocomplete", "#year_in_review_music_track_track_name", (event) ->
|
18
|
+
if $('#year_in_review_music_track_artist_id').val()
|
19
|
+
$(this).autocomplete
|
20
|
+
source: '/music/artists/' + $('#year_in_review_music_track_artist_id').val() + '/tracks/autocomplete'
|
21
|
+
minLength: 2
|
22
|
+
appendTo: '#year_in_review_music_track_track_name_suggestions'
|
23
|
+
select: (event, ui) ->
|
24
|
+
$(this).val(ui.item.value)
|
25
|
+
$('#year_in_review_music_track_track_id').val(ui.item.id)
|
26
|
+
|
27
|
+
return false;
|
28
|
+
else
|
29
|
+
alert 'Please select an artist!'
|
30
|
+
event.preventDefault()
|
31
|
+
return false
|
@@ -0,0 +1,36 @@
|
|
1
|
+
window.VoluntaryMusicMetadataEnrichment or= {}; window.VoluntaryMusicMetadataEnrichment.Library or= {}
|
2
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearsInReview or= {}
|
3
|
+
|
4
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearsInReview.IndexView = class IndexView
|
5
|
+
constructor: (withAjaxLinks) ->
|
6
|
+
if withAjaxLinks
|
7
|
+
$(document.body).on "click", ".year_in_review_music_releases_link", (event) ->
|
8
|
+
$this = $(this)
|
9
|
+
$this.find('.ajax_spinner').show()
|
10
|
+
|
11
|
+
$.ajax(url: $this.attr('href'), type: "GET", dataType: "html").done((data) =>
|
12
|
+
$this.find('.ajax_spinner').hide()
|
13
|
+
$($this.data("replace")).html(data)
|
14
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewReleases.IndexView.makeCollectionSortable()
|
15
|
+
).fail((data) =>
|
16
|
+
$this.find('.ajax_spinner').hide()
|
17
|
+
alert 'Failed to load top releases!'
|
18
|
+
)
|
19
|
+
event.preventDefault()
|
20
|
+
|
21
|
+
$(document.body).on "click", ".year_in_review_music_tracks_link", (event) ->
|
22
|
+
$this = $(this)
|
23
|
+
$this.find('.ajax_spinner').show()
|
24
|
+
|
25
|
+
$.ajax(url: $this.attr('href'), type: "GET", dataType: "html").done((data) =>
|
26
|
+
$this.find('.ajax_spinner').hide()
|
27
|
+
$($this.data("replace")).html(data)
|
28
|
+
window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks.IndexView.makeCollectionSortable()
|
29
|
+
).fail((data) =>
|
30
|
+
$this.find('.ajax_spinner').hide()
|
31
|
+
alert 'Failed to load top tracks!'
|
32
|
+
)
|
33
|
+
event.preventDefault()
|
34
|
+
|
35
|
+
$(document.body).on "ajax:beforeSend", "#new_music_year_in_review_form", ->
|
36
|
+
$("#years_in_review_spinner").show()
|
@@ -0,0 +1,207 @@
|
|
1
|
+
module MusicMetadataEnrichment
|
2
|
+
module ArtistConfirmation
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def confirm_artist(from)
|
8
|
+
build_artist
|
9
|
+
|
10
|
+
if @artist.mbid.present?
|
11
|
+
musicbrainz_artist = MusicBrainz::Artist.find(@artist.mbid)
|
12
|
+
|
13
|
+
if musicbrainz_artist
|
14
|
+
@artist.mbid = musicbrainz_artist.id
|
15
|
+
@artist.name = musicbrainz_artist.name
|
16
|
+
artist = nil
|
17
|
+
|
18
|
+
if ['new_release', 'new_track', 'new_video'].include?(from) && (artist = MusicArtist.where(mbid: @artist.mbid).first) && artist.active?
|
19
|
+
working_params = {}
|
20
|
+
|
21
|
+
if params[:group_id].present?
|
22
|
+
MusicMetadataEnrichment::GroupArtistConnection.create(group_id: params[:group_id], artist_id: artist.id)
|
23
|
+
working_params[:group_id] = params[:group_id]
|
24
|
+
elsif params[:user_id].present?
|
25
|
+
MusicLibraryArtist.create(user_id: params[:user_id], artist_id: artist.id)
|
26
|
+
end
|
27
|
+
|
28
|
+
case from
|
29
|
+
when 'new_release' then redirect_to name_music_releases_path(working_params.merge(music_release: { artist_id: artist.id }))
|
30
|
+
when 'new_track' then redirect_to name_music_tracks_path(music_track: { artist_id: artist.id })
|
31
|
+
when 'new_video'
|
32
|
+
redirect_to track_name_music_tracks_path(working_params.merge(music_track: { artist_id: artist.id }))
|
33
|
+
end
|
34
|
+
elsif artist && from == 'new_group_artist_connection'
|
35
|
+
redirect_to creation_music_group_artists_path(
|
36
|
+
group_artist_connection: { group_id: params[:group_id], artist_id: artist.id }
|
37
|
+
)
|
38
|
+
elsif artist
|
39
|
+
flash[:notice] = I18n.t('music_releases.select_artist.wait_until_artist_metadata_import_completed')
|
40
|
+
|
41
|
+
if params[:group_id].present?
|
42
|
+
MusicMetadataEnrichment::GroupArtistConnection.create(group_id: params[:group_id], artist_id: artist.id)
|
43
|
+
redirect_to music_group_path(params[:group_id])
|
44
|
+
elsif params[:user_id].present?
|
45
|
+
MusicLibraryArtist.create(user_id: params[:user_id], artist_id: artist.id)
|
46
|
+
redirect_to user_music_library_path(params[:user_id])
|
47
|
+
else
|
48
|
+
redirect_to music_path
|
49
|
+
end
|
50
|
+
elsif @artist.save
|
51
|
+
if from == 'new_artist'
|
52
|
+
flash[:notice] = I18n.t('music_artists.name_confirmation.scheduled_metadata_import')
|
53
|
+
elsif ['new_release', 'new_track', 'new_video'].include?(from)
|
54
|
+
flash[:notice] = I18n.t('music_releases.artist_confirmation.artist_import_scheduled')
|
55
|
+
end
|
56
|
+
|
57
|
+
if params[:group_id].present?
|
58
|
+
MusicMetadataEnrichment::GroupArtistConnection.create(group_id: params[:group_id], artist_id: @artist.id)
|
59
|
+
redirect_to music_group_path(params[:group_id])
|
60
|
+
elsif params[:user_id].present?
|
61
|
+
MusicLibraryArtist.create(user_id: params[:user_id], artist_id: @artist.id)
|
62
|
+
redirect_to user_music_library_path(params[:user_id])
|
63
|
+
elsif ['new_artist', 'new_release', 'new_track', 'new_video'].include?(from)
|
64
|
+
redirect_to music_path
|
65
|
+
elsif from == 'new_group_artist_connection'
|
66
|
+
redirect_to creation_music_group_artists_path(
|
67
|
+
group_artist_connection: { group_id: params[:group_id], artist_id: @artist.id }
|
68
|
+
)
|
69
|
+
end
|
70
|
+
else
|
71
|
+
render :new
|
72
|
+
end
|
73
|
+
else
|
74
|
+
flash[:alert] = I18n.t('music_artists.new.mbid_invalid')
|
75
|
+
|
76
|
+
if from == 'new_artist'
|
77
|
+
if params[:user_id].present?
|
78
|
+
redirect new_user_music_library_artist_path(params[:user_id])
|
79
|
+
else
|
80
|
+
redirect_to new_music_artist_path
|
81
|
+
end
|
82
|
+
elsif from == 'new_release'
|
83
|
+
if params[:group_id].present?
|
84
|
+
redirect_to new_music_group_release_path(params[:group_id])
|
85
|
+
else
|
86
|
+
redirect_to new_music_release_path
|
87
|
+
end
|
88
|
+
elsif from == 'new_track'
|
89
|
+
redirect_to new_music_track_path
|
90
|
+
elsif from == 'new_video'
|
91
|
+
if params[:group_id].present?
|
92
|
+
new_music_group_video_path(params[:group_id])
|
93
|
+
else
|
94
|
+
redirect_to new_music_video_path
|
95
|
+
end
|
96
|
+
elsif from == 'new_group_artist_connection'
|
97
|
+
redirect_to new_music_group_artist_path(params[:group_id])
|
98
|
+
end
|
99
|
+
end
|
100
|
+
elsif @artist.name.present?
|
101
|
+
3.times do
|
102
|
+
@artists = MusicBrainz::Artist.search(@artist.name)
|
103
|
+
|
104
|
+
if @artists.nil?
|
105
|
+
sleep 5
|
106
|
+
else
|
107
|
+
break
|
108
|
+
end
|
109
|
+
end
|
110
|
+
else
|
111
|
+
render :new
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def create_artist(from, name_and_mbid)
|
116
|
+
@artist = MusicArtist.where(mbid: name_and_mbid.split(';').last).first
|
117
|
+
|
118
|
+
if @artist
|
119
|
+
if params[:group_id].present?
|
120
|
+
flash[:notice] = I18n.t('music_artists.create.group_connection_successful')
|
121
|
+
MusicMetadataEnrichment::GroupArtistConnection.create(group_id: params[:group_id], artist_id: @artist.id)
|
122
|
+
redirect_to music_group_path(params[:group_id])
|
123
|
+
elsif params[:user_id].present?
|
124
|
+
flash[:notice] = I18n.t('music_artists.create.library_addition_successful')
|
125
|
+
MusicLibraryArtist.create(user_id: params[:user_id], artist_id: @artist.id)
|
126
|
+
redirect_to user_music_library_path(params[:user_id])
|
127
|
+
else
|
128
|
+
flash[:notice] = I18n.t('music_artists.create.already_created')
|
129
|
+
redirect_to music_artist_path(@artist.id)
|
130
|
+
end
|
131
|
+
else
|
132
|
+
@artist = MusicArtist.create(name: name_and_mbid.split(';').first, mbid: name_and_mbid.split(';').last)
|
133
|
+
|
134
|
+
if @artist.valid?
|
135
|
+
if from == 'new_artist'
|
136
|
+
flash[:notice] = I18n.t('music_artists.create.scheduled_artist_for_import')
|
137
|
+
elsif ['new_release', 'new_track', 'new_video'].include? from
|
138
|
+
flash[:notice] = I18n.t('music_releases.select_artist.scheduled_artist_for_import')
|
139
|
+
end
|
140
|
+
|
141
|
+
if ['new_artist', 'new_release', 'new_track', 'new_video'].include? from
|
142
|
+
if params[:group_id].present?
|
143
|
+
MusicMetadataEnrichment::GroupArtistConnection.create(group_id: params[:group_id], artist_id: @artist.id)
|
144
|
+
redirect_to music_group_path(params[:group_id])
|
145
|
+
else
|
146
|
+
redirect_to music_path
|
147
|
+
end
|
148
|
+
elsif from == 'new_group_artist_connection'
|
149
|
+
redirect_to creation_music_group_artists_path(
|
150
|
+
group_artist_connection: { group_id: params[:group_id], artist_id: @artist.id }
|
151
|
+
)
|
152
|
+
end
|
153
|
+
else
|
154
|
+
params[:music_artist][:name] = @artist.name
|
155
|
+
params[:music_artist][:mbid] = @artist.mbid
|
156
|
+
render :new
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def artist_selection(from)
|
162
|
+
params[:music_artist] ||= {}
|
163
|
+
name_and_mbid = params[:music_artist].delete(:name_and_mbid)
|
164
|
+
artist = MusicArtist.where(mbid: name_and_mbid.split(';').last).first
|
165
|
+
|
166
|
+
if artist && from == 'new_group_artist_connection'
|
167
|
+
redirect_to creation_music_group_artists_path(
|
168
|
+
group_artist_connection: { group_id: params[:group_id], artist_id: artist.id }
|
169
|
+
)
|
170
|
+
elsif artist && artist.active?
|
171
|
+
if params[:group_id].present?
|
172
|
+
MusicMetadataEnrichment::GroupArtistConnection.create(group_id: params[:group_id], artist_id: artist.id)
|
173
|
+
end
|
174
|
+
|
175
|
+
if from == 'new_release'
|
176
|
+
redirect_to name_music_releases_path(
|
177
|
+
(params[:group_id].present? ? {group_id: params[:group_id]} : {}).merge(music_release: { artist_id: artist.id })
|
178
|
+
)
|
179
|
+
elsif from == 'new_track'
|
180
|
+
redirect_to name_music_tracks_path(music_track: { artist_id: artist.id })
|
181
|
+
elsif from == 'new_video'
|
182
|
+
redirect_to track_name_music_videos_path(
|
183
|
+
(params[:group_id].present? ? {group_id: params[:group_id]} : {}).merge(music_track: { artist_id: artist.id })
|
184
|
+
)
|
185
|
+
end
|
186
|
+
elsif artist
|
187
|
+
flash[:notice] = I18n.t('music_releases.select_artist.wait_until_artist_metadata_import_completed')
|
188
|
+
|
189
|
+
if params[:group_id].present?
|
190
|
+
MusicMetadataEnrichment::GroupArtistConnection.create(group_id: params[:group_id], artist_id: @artist.id)
|
191
|
+
redirect_to music_group_path(params[:group_id])
|
192
|
+
else
|
193
|
+
redirect_to music_path
|
194
|
+
end
|
195
|
+
else
|
196
|
+
create_artist(from, name_and_mbid)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def build_artist
|
201
|
+
params[:music_artist] ||= {}
|
202
|
+
@artist = MusicArtist.new
|
203
|
+
@artist.name = params[:music_artist][:name]
|
204
|
+
@artist.mbid = params[:music_artist][:mbid]
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module MusicMetadataEnrichment
|
2
|
+
module BaseController
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
def application_navigation
|
6
|
+
:main_music_metadata_enrichment
|
7
|
+
end
|
8
|
+
|
9
|
+
def navigation_product_path
|
10
|
+
music_metadata_enrichment_product_path
|
11
|
+
end
|
12
|
+
|
13
|
+
def navigation_product_name
|
14
|
+
'Music Metadata Enrichment'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module MusicMetadataEnrichment
|
2
|
+
module TrackConfirmation
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def track_creation(from)
|
8
|
+
name_and_mbid = params[:music_track].delete(:name_and_mbid)
|
9
|
+
@track.name = MusicTrack.format_name(name_and_mbid.split(';').first)
|
10
|
+
|
11
|
+
if track = MusicTrack.where("artist_id = :artist_id AND LOWER(name) = :name", artist_id: @track.artist_id, name: @track.name.downcase.strip).first
|
12
|
+
if from == 'new_track'
|
13
|
+
flash[:alert] = I18n.t('music_tracks.create.already_exist')
|
14
|
+
redirect_to music_track_path(track.id)
|
15
|
+
elsif from == 'new_video'
|
16
|
+
redirect_to metadata_music_videos_path(
|
17
|
+
(params[:group_id].present? ? {group_id: params[:group_id]} : {}).merge(music_video: { track_id: track.id })
|
18
|
+
)
|
19
|
+
end
|
20
|
+
else
|
21
|
+
if @track.is_bonus_track?
|
22
|
+
@track.create_bonus_track(name_and_mbid.split(';').last)
|
23
|
+
flash[:notice] = I18n.t('music_tracks.create.successfully_creation')
|
24
|
+
|
25
|
+
if from == 'new_track'
|
26
|
+
redirect_to music_track_path(@track.id)
|
27
|
+
elsif from == 'new_video'
|
28
|
+
redirect_to metadata_music_videos_path(
|
29
|
+
(params[:group_id].present? ? {group_id: params[:group_id]} : {}).merge(music_video: { track_id: @track.id })
|
30
|
+
)
|
31
|
+
end
|
32
|
+
elsif @track.release_name.present?
|
33
|
+
release = MusicRelease.create(artist_id: @track.artist_id, name: @track.release_name)
|
34
|
+
|
35
|
+
if release.valid?
|
36
|
+
flash[:notice] = I18n.t('music_tracks.create.scheduled_release_for_import')
|
37
|
+
else
|
38
|
+
flash[:alert] = release.errors.full_messages.join('. ')
|
39
|
+
end
|
40
|
+
|
41
|
+
if params[:group_id].present?
|
42
|
+
redirect_to music_group_path(params[:group_id])
|
43
|
+
else
|
44
|
+
redirect_to music_path
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_track
|
51
|
+
params[:music_track] ||= {}
|
52
|
+
@track = MusicTrack.new
|
53
|
+
@track.name = MusicTrack.format_name(params[:music_track][:name]) if params[:music_track][:name].present?
|
54
|
+
@track.artist_id = params[:music_track][:artist_id]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Library::Music::ArtistsController < ::MusicMetadataEnrichment::ApplicationController
|
2
|
+
include ::MusicMetadataEnrichment::BaseController
|
3
|
+
include Applicat::Mvc::Controller::Resource
|
4
|
+
|
5
|
+
before_action :find_resource, only: [:destroy]
|
6
|
+
authorize_resource class: 'MusicLibraryArtist'
|
7
|
+
|
8
|
+
def destroy
|
9
|
+
@music_library_artist.destroy!
|
10
|
+
@artists = User.find(@music_library_artist.user_id).music_artists.order('name ASC').paginate(per_page: 10, page: params[:page] || 1)
|
11
|
+
|
12
|
+
if @artists.any?
|
13
|
+
@music_library_artists = current_user.music_library_artists.where('music_library_artists.artist_id IN(?)', @artists.map(&:id)).index_by(&:artist_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
params[:user_id] = @music_library_artist.user_id
|
17
|
+
@pagination_params = { user_id: params[:user_id] }
|
18
|
+
render layout: false
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def find_resource
|
24
|
+
@music_library_artist = current_user.music_library_artists.where('music_library_artists.id = ?', params[:id]).first
|
25
|
+
end
|
26
|
+
end
|