acme-smileage 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -17
  3. data/.travis.yml +3 -3
  4. data/Gemfile +4 -4
  5. data/LICENSE.txt +22 -22
  6. data/README.md +215 -215
  7. data/Rakefile +9 -9
  8. data/acme-smileage.gemspec +29 -29
  9. data/bin/smileage +3 -3
  10. data/lib/acme/smileage.rb +55 -55
  11. data/lib/acme/smileage/blog/ameblo.rb +49 -49
  12. data/lib/acme/smileage/blog/ameblo_downloader.rb +171 -171
  13. data/lib/acme/smileage/blog/entry.rb +51 -51
  14. data/lib/acme/smileage/commands.rb +16 -16
  15. data/lib/acme/smileage/commands/base.rb +10 -10
  16. data/lib/acme/smileage/commands/oricon.rb +47 -47
  17. data/lib/acme/smileage/commands/soundscan.rb +18 -18
  18. data/lib/acme/smileage/discography.rb +101 -101
  19. data/lib/acme/smileage/discography/albums.rb +28 -28
  20. data/lib/acme/smileage/discography/albums/2009/I001_amanojaku.rb +35 -35
  21. data/lib/acme/smileage/discography/albums/2009/I002_asuha_date_nanoni_imasugu_koe_ga_kikitai.rb +35 -35
  22. data/lib/acme/smileage/discography/albums/2009/I003_sukichan.rb +35 -35
  23. data/lib/acme/smileage/discography/albums/2010/A001_waru_gaki_(1).rb +50 -50
  24. data/lib/acme/smileage/discography/albums/2010/D001_yumemiru_15sai_(pax_japonica_groove_remix).rb +35 -35
  25. data/lib/acme/smileage/discography/albums/2010/D002_gambaranakutemo_eenende_(topnude_remix_version_01).rb +35 -35
  26. data/lib/acme/smileage/discography/albums/2010/D003_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama_(remix_type1).rb +35 -35
  27. data/lib/acme/smileage/discography/albums/2010/I004_otona_ni_narutte_muzukashii.rb +35 -35
  28. data/lib/acme/smileage/discography/albums/2010/S001_yumemiru_15sai.rb +42 -42
  29. data/lib/acme/smileage/discography/albums/2010/S002_gambaranakutemo_eenende.rb +47 -47
  30. data/lib/acme/smileage/discography/albums/2010/S003_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama.rb +46 -46
  31. data/lib/acme/smileage/discography/albums/2011/D004_shortcut_(remixver).rb +35 -35
  32. data/lib/acme/smileage/discography/albums/2011/D005_uchouten_love_rocketman_mix.rb +35 -35
  33. data/lib/acme/smileage/discography/albums/2011/S004_shortcut.rb +51 -51
  34. data/lib/acme/smileage/discography/albums/2011/S005_koi_ni_booing_boo.rb +51 -51
  35. data/lib/acme/smileage/discography/albums/2011/S006_uchouten_love.rb +51 -51
  36. data/lib/acme/smileage/discography/albums/2011/S007_tachiagirl.rb +56 -56
  37. data/lib/acme/smileage/discography/albums/2011/S008_please_minisuka_post_woman.rb +52 -52
  38. data/lib/acme/smileage/discography/albums/2012/A002_smleage_best_album_complete_(1).rb +54 -54
  39. data/lib/acme/smileage/discography/albums/2012/S009_choto_mate_kudasai.rb +52 -52
  40. data/lib/acme/smileage/discography/albums/2012/S010_dotbikini.rb +51 -51
  41. data/lib/acme/smileage/discography/albums/2012/S011_sukiyo_junjou_hankouki.rb +50 -50
  42. data/lib/acme/smileage/discography/albums/2012/S012_samuine.rb +50 -50
  43. data/lib/acme/smileage/discography/albums/2013/A003_(2)_smile_sensation.rb +48 -48
  44. data/lib/acme/smileage/discography/albums/2013/S013_tabidachi_no_haru_ga_kita.rb +50 -50
  45. data/lib/acme/smileage/discography/albums/2013/S014_atarashii_watashini_nare_yattaruchan.rb +50 -50
  46. data/lib/acme/smileage/discography/albums/2013/S015_eeka_iiyatsu.rb +50 -50
  47. data/lib/acme/smileage/discography/albums/2014/S016_mystery_night_eighteen_emotion.rb +56 -54
  48. data/lib/acme/smileage/discography/albums/base.rb +37 -37
  49. data/lib/acme/smileage/discography/hello_project_music_award.rb +22 -22
  50. data/lib/acme/smileage/discography/lyrics_downloader.rb +48 -48
  51. data/lib/acme/smileage/discography/sales.rb +43 -43
  52. data/lib/acme/smileage/discography/tracks.rb +65 -65
  53. data/lib/acme/smileage/discography/tracks/2009/001_amanojaku.rb +57 -57
  54. data/lib/acme/smileage/discography/tracks/2009/002_asuha_date_nanoni_imasugu_koe_ga_kikitai.rb +57 -57
  55. data/lib/acme/smileage/discography/tracks/2009/003_sukichan.rb +57 -57
  56. data/lib/acme/smileage/discography/tracks/2010/004_otona_ni_narutte_muzukashii.rb +57 -57
  57. data/lib/acme/smileage/discography/tracks/2010/005_yumemiru_15sai.rb +77 -77
  58. data/lib/acme/smileage/discography/tracks/2010/006_thank_you_creme_brulee_no_yuujou.rb +37 -37
  59. data/lib/acme/smileage/discography/tracks/2010/007_yumemiru_15sai_(pax_japonica_groove_remix).rb +38 -38
  60. data/lib/acme/smileage/discography/tracks/2010/008_gambaranakutemo_eenende.rb +85 -85
  61. data/lib/acme/smileage/discography/tracks/2010/009_gambaranakutemo_iindayo.rb +44 -44
  62. data/lib/acme/smileage/discography/tracks/2010/010_smile_bijin.rb +36 -36
  63. data/lib/acme/smileage/discography/tracks/2010/011_gambaranakutemo_eenende_(topnude_remix_version_01).rb +38 -38
  64. data/lib/acme/smileage/discography/tracks/2010/012_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama.rb +85 -85
  65. data/lib/acme/smileage/discography/tracks/2010/013_chokotto_love.rb +38 -38
  66. data/lib/acme/smileage/discography/tracks/2010/014_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama_(remix_type1).rb +38 -38
  67. data/lib/acme/smileage/discography/tracks/2010/015_odorouyo.rb +36 -36
  68. data/lib/acme/smileage/discography/tracks/2010/016_onna_bakari_no_nichiyoubi.rb +36 -36
  69. data/lib/acme/smileage/discography/tracks/2010/017_shooting_star.rb +36 -36
  70. data/lib/acme/smileage/discography/tracks/2010/018_gakkyuu_iinchou.rb +36 -36
  71. data/lib/acme/smileage/discography/tracks/2010/019_shikkari_shiteyo_mou.rb +36 -36
  72. data/lib/acme/smileage/discography/tracks/2011/020_shortcut.rb +69 -69
  73. data/lib/acme/smileage/discography/tracks/2011/021_panyasan_no_arbeit.rb +36 -36
  74. data/lib/acme/smileage/discography/tracks/2011/022_otome_pasta_ni_kandou.rb +38 -38
  75. data/lib/acme/smileage/discography/tracks/2011/023_koi_ni_booing_boo.rb +69 -69
  76. data/lib/acme/smileage/discography/tracks/2011/024_hatukoi_no_anatahe.rb +36 -36
  77. data/lib/acme/smileage/discography/tracks/2011/025_koi_wo_shichaimashita.rb +38 -38
  78. data/lib/acme/smileage/discography/tracks/2011/026_uchouten_love.rb +77 -77
  79. data/lib/acme/smileage/discography/tracks/2011/027_jitensha_chiririn.rb +36 -36
  80. data/lib/acme/smileage/discography/tracks/2011/028_chu_natsu_party.rb +38 -38
  81. data/lib/acme/smileage/discography/tracks/2011/029_shortcut_(remixver).rb +37 -37
  82. data/lib/acme/smileage/discography/tracks/2011/030_uchouten_love_rocketman_mix.rb +38 -38
  83. data/lib/acme/smileage/discography/tracks/2011/031_tachiagirl.rb +73 -73
  84. data/lib/acme/smileage/discography/tracks/2011/032_smile_ondon.rb +35 -35
  85. data/lib/acme/smileage/discography/tracks/2011/033_boogie_train11.rb +38 -38
  86. data/lib/acme/smileage/discography/tracks/2011/034_smileage_singles_gekimoe_remix.rb +35 -35
  87. data/lib/acme/smileage/discography/tracks/2011/035_please_minisuka_post_woman.rb +45 -45
  88. data/lib/acme/smileage/discography/tracks/2011/036_konnichiwa_konbanwa.rb +36 -36
  89. data/lib/acme/smileage/discography/tracks/2011/037_smileage_singles_gekiyaba_remix.rb +35 -35
  90. data/lib/acme/smileage/discography/tracks/2011/038_tewo_nigitte_arukitai.rb +38 -38
  91. data/lib/acme/smileage/discography/tracks/2012/039_choto_mate_kudasai.rb +45 -45
  92. data/lib/acme/smileage/discography/tracks/2012/040_chance_tourai.rb +36 -36
  93. data/lib/acme/smileage/discography/tracks/2012/041_smileage_singles_gekiatsu_remix.rb +35 -35
  94. data/lib/acme/smileage/discography/tracks/2012/042_namida_girl.rb +38 -38
  95. data/lib/acme/smileage/discography/tracks/2012/043_dotbikini.rb +45 -45
  96. data/lib/acme/smileage/discography/tracks/2012/044_smile_blues.rb +36 -36
  97. data/lib/acme/smileage/discography/tracks/2012/045_koibito_ha_kokoro_no_ouendan.rb +38 -38
  98. data/lib/acme/smileage/discography/tracks/2012/046_kiiroi_jitensha_to_sandwich.rb +36 -36
  99. data/lib/acme/smileage/discography/tracks/2012/047_sukiyo_junjou_hankouki.rb +45 -45
  100. data/lib/acme/smileage/discography/tracks/2012/048_kimi_ha_jitensha_watasi_ha_densya_de_kitaku.rb +38 -38
  101. data/lib/acme/smileage/discography/tracks/2012/049_samuine.rb +49 -49
  102. data/lib/acme/smileage/discography/tracks/2012/050_watashi_choito_kawaii_urabancho.rb +36 -36
  103. data/lib/acme/smileage/discography/tracks/2013/051_tabidachi_no_haru_ga_kita.rb +45 -45
  104. data/lib/acme/smileage/discography/tracks/2013/052_doushiyou.rb +36 -36
  105. data/lib/acme/smileage/discography/tracks/2013/053_shin_nihon_no_susume.rb +36 -36
  106. data/lib/acme/smileage/discography/tracks/2013/054_otona_no_tochuu.rb +36 -36
  107. data/lib/acme/smileage/discography/tracks/2013/055_tenshin_ramman.rb +36 -36
  108. data/lib/acme/smileage/discography/tracks/2013/056_watashi_no_kokoro.rb +36 -36
  109. data/lib/acme/smileage/discography/tracks/2013/057_yuugure_koi_no_jikan.rb +36 -36
  110. data/lib/acme/smileage/discography/tracks/2013/058_nee_sempai.rb +36 -36
  111. data/lib/acme/smileage/discography/tracks/2013/059_sayonara_sayonara_sayonara.rb +36 -36
  112. data/lib/acme/smileage/discography/tracks/2013/060_atarashii_watashini_nare.rb +45 -45
  113. data/lib/acme/smileage/discography/tracks/2013/061_yattaruchan.rb +45 -45
  114. data/lib/acme/smileage/discography/tracks/2013/062_eeka.rb +44 -44
  115. data/lib/acme/smileage/discography/tracks/2013/063_iiyatsu.rb +44 -44
  116. data/lib/acme/smileage/discography/tracks/2014/064_mystery_night.rb +44 -44
  117. data/lib/acme/smileage/discography/tracks/2014/065_eighteen_emotion.rb +44 -44
  118. data/lib/acme/smileage/discography/tracks/base.rb +39 -39
  119. data/lib/acme/smileage/members.rb +40 -40
  120. data/lib/acme/smileage/members/base.rb +56 -56
  121. data/lib/acme/smileage/members/fukuda_kanon.rb +29 -29
  122. data/lib/acme/smileage/members/katsuta_rina.rb +29 -29
  123. data/lib/acme/smileage/members/kosuga_fuyuka.rb +29 -29
  124. data/lib/acme/smileage/members/maeda_yuuka.rb +29 -29
  125. data/lib/acme/smileage/members/nakanishi_kana.rb +29 -29
  126. data/lib/acme/smileage/members/ogawa_saki.rb +29 -29
  127. data/lib/acme/smileage/members/takeuchi_akari.rb +29 -29
  128. data/lib/acme/smileage/members/tamura_meimi.rb +29 -29
  129. data/lib/acme/smileage/members/wada_ayaka.rb +29 -29
  130. data/lib/acme/smileage/utils/base_downloader.rb +38 -38
  131. data/lib/acme/smileage/utils/matcher.rb +64 -64
  132. data/lib/acme/smileage/version.rb +5 -5
  133. data/lib/acme/smileage/version.rb~ +5 -5
  134. data/test/acme/test_album.rb +204 -204
  135. data/test/acme/test_member.rb +45 -45
  136. data/test/acme/test_smileage.rb +144 -144
  137. data/test/acme/test_track.rb +57 -57
  138. data/test/minitest_helper.rb +5 -5
  139. metadata +20 -20
@@ -1,51 +1,51 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- module Acme
4
- class Smileage
5
- module Blog
6
- module Entry
7
- class List
8
- attr_accessor :link, :entries, :next_page
9
-
10
- def initialize
11
- self.entries = []
12
- yield self if block_given?
13
- end
14
- end
15
-
16
- class Header
17
- attr_accessor :link, :title, :datetime
18
- attr_accessor :comment_count, :good_count
19
- attr_accessor :author
20
-
21
- def initialize(blog)
22
- yield self if block_given?
23
- end
24
- end
25
-
26
- class Body
27
- attr_accessor :text
28
- attr_accessor :comment_link, :next_entry_link, :prev_entry_link
29
- attr_accessor :image_links
30
- attr_accessor :comments
31
-
32
- def initialize
33
- self.image_links = []
34
- self.comments = []
35
- yield self if block_given?
36
- end
37
- end
38
-
39
- class Comment
40
- attr_accessor :text
41
- attr_accessor :link, :title, :datetime
42
- attr_accessor :author, :author_link
43
-
44
- def initialize
45
- yield self if block_given?
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module Acme
4
+ class Smileage
5
+ module Blog
6
+ module Entry
7
+ class List
8
+ attr_accessor :link, :entries, :next_page
9
+
10
+ def initialize
11
+ self.entries = []
12
+ yield self if block_given?
13
+ end
14
+ end
15
+
16
+ class Header
17
+ attr_accessor :link, :title, :datetime
18
+ attr_accessor :comment_count, :good_count
19
+ attr_accessor :author
20
+
21
+ def initialize(blog)
22
+ yield self if block_given?
23
+ end
24
+ end
25
+
26
+ class Body
27
+ attr_accessor :text
28
+ attr_accessor :comment_link, :next_entry_link, :prev_entry_link
29
+ attr_accessor :image_links
30
+ attr_accessor :comments
31
+
32
+ def initialize
33
+ self.image_links = []
34
+ self.comments = []
35
+ yield self if block_given?
36
+ end
37
+ end
38
+
39
+ class Comment
40
+ attr_accessor :text
41
+ attr_accessor :link, :title, :datetime
42
+ attr_accessor :author, :author_link
43
+
44
+ def initialize
45
+ yield self if block_given?
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,16 +1,16 @@
1
- require "acme/smileage/commands/oricon"
2
- require "acme/smileage/commands/soundscan"
3
-
4
- module Acme
5
- class Smileage
6
- module Commands
7
- class Main < Thor
8
- desc "oricon", "Show oricon data"
9
- subcommand "oricon", Acme::Smileage::Commands::Oricon
10
-
11
- desc "soundscan", "Show soundscan data"
12
- subcommand "soundscan", Acme::Smileage::Commands::SoundScan
13
- end
14
- end
15
- end
16
- end
1
+ require "acme/smileage/commands/oricon"
2
+ require "acme/smileage/commands/soundscan"
3
+
4
+ module Acme
5
+ class Smileage
6
+ module Commands
7
+ class Main < Thor
8
+ desc "oricon", "Show oricon data"
9
+ subcommand "oricon", Acme::Smileage::Commands::Oricon
10
+
11
+ desc "soundscan", "Show soundscan data"
12
+ subcommand "soundscan", Acme::Smileage::Commands::SoundScan
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,10 +1,10 @@
1
- require "thor"
2
-
3
- require "acme/smileage"
4
-
5
- module Acme
6
- class Smileage
7
- module Commands
8
- end
9
- end
10
- end
1
+ require "thor"
2
+
3
+ require "acme/smileage"
4
+
5
+ module Acme
6
+ class Smileage
7
+ module Commands
8
+ end
9
+ end
10
+ end
@@ -1,47 +1,47 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require "acme/smileage/commands/base"
4
-
5
- module Acme
6
- class Smileage
7
- module Commands
8
- class Oricon < Thor
9
- option :single, :type => :boolean
10
- option :album, :type => :boolean
11
- desc "show [--album]", "Prints oricon sales data"
12
- def show
13
- show_sales_data(:oricon)
14
- end
15
-
16
- private
17
-
18
- def show_sales_data(sales)
19
- sm = Acme::Smileage.new
20
- filter = options[:album] ? :album? : :single?
21
-
22
- puts "初動売上 累積売上 初動比 最高位 登場回 発売日 タイトル"
23
- sm.discography(&filter).each do |album|
24
- print_sales_data(album, album.__send__(sales))
25
- end
26
- end
27
-
28
- def print_sales_data(album, sales)
29
- return unless sales
30
- puts "%s枚 %s枚 %.2f %s位 %s回 %s %s" % [
31
- format_number(sales.first_week_sales, 5),
32
- format_number(sales.total_sales, 5),
33
- sales.total_to_first_week_ratio,
34
- format_number(sales.peak_rank, 3),
35
- format_number(sales.weeks_on_chart, 2),
36
- album.release_date,
37
- album.name
38
- ]
39
- end
40
-
41
- def format_number(n, rank)
42
- ("%0#{rank}d" % n).reverse.gsub( /(\d{3})(?=\d)/, '\1,').reverse.gsub(/^(0+)/) { '*' * $1.length }
43
- end
44
- end
45
- end
46
- end
47
- end
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "acme/smileage/commands/base"
4
+
5
+ module Acme
6
+ class Smileage
7
+ module Commands
8
+ class Oricon < Thor
9
+ option :single, :type => :boolean
10
+ option :album, :type => :boolean
11
+ desc "show [--album]", "Prints oricon sales data"
12
+ def show
13
+ show_sales_data(:oricon)
14
+ end
15
+
16
+ private
17
+
18
+ def show_sales_data(sales)
19
+ sm = Acme::Smileage.new
20
+ filter = options[:album] ? :album? : :single?
21
+
22
+ puts "初動売上 累積売上 初動比 最高位 登場回 発売日 タイトル"
23
+ sm.discography(&filter).each do |album|
24
+ print_sales_data(album, album.__send__(sales))
25
+ end
26
+ end
27
+
28
+ def print_sales_data(album, sales)
29
+ return unless sales
30
+ puts "%s枚 %s枚 %.2f %s位 %s回 %s %s" % [
31
+ format_number(sales.first_week_sales, 5),
32
+ format_number(sales.total_sales, 5),
33
+ sales.total_to_first_week_ratio,
34
+ format_number(sales.peak_rank, 3),
35
+ format_number(sales.weeks_on_chart, 2),
36
+ album.release_date,
37
+ album.name
38
+ ]
39
+ end
40
+
41
+ def format_number(n, rank)
42
+ ("%0#{rank}d" % n).reverse.gsub( /(\d{3})(?=\d)/, '\1,').reverse.gsub(/^(0+)/) { '*' * $1.length }
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,18 +1,18 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require "acme/smileage/commands/oricon"
4
-
5
- module Acme
6
- class Smileage
7
- module Commands
8
- class SoundScan < Oricon
9
- option :single, :type => :boolean
10
- option :album, :type => :boolean
11
- desc "show [--album]", "Prints soundscan sales data"
12
- def show
13
- show_sales_data(:soundscan)
14
- end
15
- end
16
- end
17
- end
18
- end
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "acme/smileage/commands/oricon"
4
+
5
+ module Acme
6
+ class Smileage
7
+ module Commands
8
+ class SoundScan < Oricon
9
+ option :single, :type => :boolean
10
+ option :album, :type => :boolean
11
+ desc "show [--album]", "Prints soundscan sales data"
12
+ def show
13
+ show_sales_data(:soundscan)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,101 +1,101 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require "acme/smileage/utils/matcher"
4
- require "acme/smileage/discography/albums"
5
- require "acme/smileage/discography/tracks"
6
-
7
- module Acme
8
- class Smileage
9
- class Discography
10
- def initialize
11
- album Acme::Smileage::Discography::Albums::Amanojaku
12
- album Acme::Smileage::Discography::Albums::AsuhaDateNanoniImasuguKoeGaKikitai
13
- album Acme::Smileage::Discography::Albums::Sukichan
14
- album Acme::Smileage::Discography::Albums::OtonaNiNarutteMuzukashii
15
- album Acme::Smileage::Discography::Albums::Yumemiru15sai
16
- album Acme::Smileage::Discography::Albums::Yumemiru15saiPaxJaponicaGrooveRemix
17
- album Acme::Smileage::Discography::Albums::GambaranakutemoEenende
18
- album Acme::Smileage::Discography::Albums::GambaranakutemoEenendeTopnudeRemixVersion01
19
- album Acme::Smileage::Discography::Albums::OnajiJikyuuDeHatarakuTomodachiNoBijinMama
20
- album Acme::Smileage::Discography::Albums::OnajiJikyuuDeHatarakuTomodachiNoBijinMamaRemixType1
21
- album Acme::Smileage::Discography::Albums::WaruGaki1
22
- album Acme::Smileage::Discography::Albums::Shortcut
23
- album Acme::Smileage::Discography::Albums::KoiNiBooingBoo
24
- album Acme::Smileage::Discography::Albums::UchoutenLove
25
- album Acme::Smileage::Discography::Albums::ShortcutRemixver
26
- album Acme::Smileage::Discography::Albums::UchoutenLoverocketmanMix
27
- album Acme::Smileage::Discography::Albums::Tachiagirl
28
- album Acme::Smileage::Discography::Albums::PleaseMinisukaPostWoman
29
- album Acme::Smileage::Discography::Albums::ChotoMateKudasai
30
- album Acme::Smileage::Discography::Albums::Dotbikini
31
- album Acme::Smileage::Discography::Albums::SmleageBestAlbumComplete1
32
- album Acme::Smileage::Discography::Albums::SukiyoJunjouHankouki
33
- album Acme::Smileage::Discography::Albums::Samuine
34
- album Acme::Smileage::Discography::Albums::TabidachiNoHaruGaKita
35
- album Acme::Smileage::Discography::Albums::SmileSensation
36
- album Acme::Smileage::Discography::Albums::AtarashiiWatashiniNare_Yattaruchan
37
- album Acme::Smileage::Discography::Albums::Eeka_Iiyatsu
38
- album Acme::Smileage::Discography::Albums::MysteryNight_EighteenEmotion
39
-
40
- initialize_tracks
41
- end
42
-
43
- def discography(&block)
44
- if block
45
- @albums.select(&block)
46
- else
47
- @albums.dup
48
- end
49
- end
50
-
51
- def tracks(&block)
52
- if block
53
- @tracks.select(&block)
54
- else
55
- @tracks.dup
56
- end
57
- end
58
-
59
- def find_discography(name)
60
- find("Discography", name, @albums)
61
- end
62
-
63
- def find_track(name)
64
- find("Track", name, @tracks)
65
- end
66
-
67
- def oricon_total_sales(&block)
68
- albums = block ? @albums.select(&block) : @albums
69
- albums.inject(0) {|sum,e|
70
- if e.oricon
71
- sum + e.oricon.total_sales
72
- else
73
- sum
74
- end
75
- }
76
- end
77
-
78
- private
79
-
80
- def find(label, name, targets)
81
- matcher = Acme::Smileage::Utils::Matcher.new(name.encode("UTF-8"))
82
- canon_name = matcher.match(targets.map {|e| names(e) }.flatten)
83
- raise ArgumentError, "#{label} not found: #{name}" unless canon_name
84
- targets.find {|e| names(e).include?(canon_name) }
85
- end
86
-
87
- def names(obj)
88
- [obj.name, obj.name_romaji] | obj.nicknames
89
- end
90
-
91
- def initialize_tracks
92
- @tracks = @albums.sort_by {|e| e.release_date }.map{|e| e.tracks }.flatten.uniq
93
- end
94
-
95
- def album(album_class)
96
- @albums ||= []
97
- @albums << album_class.instance
98
- end
99
- end
100
- end
101
- end
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "acme/smileage/utils/matcher"
4
+ require "acme/smileage/discography/albums"
5
+ require "acme/smileage/discography/tracks"
6
+
7
+ module Acme
8
+ class Smileage
9
+ class Discography
10
+ def initialize
11
+ album Acme::Smileage::Discography::Albums::Amanojaku
12
+ album Acme::Smileage::Discography::Albums::AsuhaDateNanoniImasuguKoeGaKikitai
13
+ album Acme::Smileage::Discography::Albums::Sukichan
14
+ album Acme::Smileage::Discography::Albums::OtonaNiNarutteMuzukashii
15
+ album Acme::Smileage::Discography::Albums::Yumemiru15sai
16
+ album Acme::Smileage::Discography::Albums::Yumemiru15saiPaxJaponicaGrooveRemix
17
+ album Acme::Smileage::Discography::Albums::GambaranakutemoEenende
18
+ album Acme::Smileage::Discography::Albums::GambaranakutemoEenendeTopnudeRemixVersion01
19
+ album Acme::Smileage::Discography::Albums::OnajiJikyuuDeHatarakuTomodachiNoBijinMama
20
+ album Acme::Smileage::Discography::Albums::OnajiJikyuuDeHatarakuTomodachiNoBijinMamaRemixType1
21
+ album Acme::Smileage::Discography::Albums::WaruGaki1
22
+ album Acme::Smileage::Discography::Albums::Shortcut
23
+ album Acme::Smileage::Discography::Albums::KoiNiBooingBoo
24
+ album Acme::Smileage::Discography::Albums::UchoutenLove
25
+ album Acme::Smileage::Discography::Albums::ShortcutRemixver
26
+ album Acme::Smileage::Discography::Albums::UchoutenLoverocketmanMix
27
+ album Acme::Smileage::Discography::Albums::Tachiagirl
28
+ album Acme::Smileage::Discography::Albums::PleaseMinisukaPostWoman
29
+ album Acme::Smileage::Discography::Albums::ChotoMateKudasai
30
+ album Acme::Smileage::Discography::Albums::Dotbikini
31
+ album Acme::Smileage::Discography::Albums::SmleageBestAlbumComplete1
32
+ album Acme::Smileage::Discography::Albums::SukiyoJunjouHankouki
33
+ album Acme::Smileage::Discography::Albums::Samuine
34
+ album Acme::Smileage::Discography::Albums::TabidachiNoHaruGaKita
35
+ album Acme::Smileage::Discography::Albums::SmileSensation
36
+ album Acme::Smileage::Discography::Albums::AtarashiiWatashiniNare_Yattaruchan
37
+ album Acme::Smileage::Discography::Albums::Eeka_Iiyatsu
38
+ album Acme::Smileage::Discography::Albums::MysteryNight_EighteenEmotion
39
+
40
+ initialize_tracks
41
+ end
42
+
43
+ def discography(&block)
44
+ if block
45
+ @albums.select(&block)
46
+ else
47
+ @albums.dup
48
+ end
49
+ end
50
+
51
+ def tracks(&block)
52
+ if block
53
+ @tracks.select(&block)
54
+ else
55
+ @tracks.dup
56
+ end
57
+ end
58
+
59
+ def find_discography(name)
60
+ find("Discography", name, @albums)
61
+ end
62
+
63
+ def find_track(name)
64
+ find("Track", name, @tracks)
65
+ end
66
+
67
+ def oricon_total_sales(&block)
68
+ albums = block ? @albums.select(&block) : @albums
69
+ albums.inject(0) {|sum,e|
70
+ if e.oricon
71
+ sum + e.oricon.total_sales
72
+ else
73
+ sum
74
+ end
75
+ }
76
+ end
77
+
78
+ private
79
+
80
+ def find(label, name, targets)
81
+ matcher = Acme::Smileage::Utils::Matcher.new(name.encode("UTF-8"))
82
+ canon_name = matcher.match(targets.map {|e| names(e) }.flatten)
83
+ raise ArgumentError, "#{label} not found: #{name}" unless canon_name
84
+ targets.find {|e| names(e).include?(canon_name) }
85
+ end
86
+
87
+ def names(obj)
88
+ [obj.name, obj.name_romaji] | obj.nicknames
89
+ end
90
+
91
+ def initialize_tracks
92
+ @tracks = @albums.sort_by {|e| e.release_date }.map{|e| e.tracks }.flatten.uniq
93
+ end
94
+
95
+ def album(album_class)
96
+ @albums ||= []
97
+ @albums << album_class.instance
98
+ end
99
+ end
100
+ end
101
+ end