acme-smileage 4.0.0

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 +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +215 -0
  7. data/Rakefile +9 -0
  8. data/acme-smileage.gemspec +29 -0
  9. data/bin/smileage +3 -0
  10. data/lib/acme/smileage/blog/ameblo.rb +49 -0
  11. data/lib/acme/smileage/blog/ameblo_downloader.rb +171 -0
  12. data/lib/acme/smileage/blog/entry.rb +51 -0
  13. data/lib/acme/smileage/commands/base.rb +10 -0
  14. data/lib/acme/smileage/commands/oricon.rb +47 -0
  15. data/lib/acme/smileage/commands/soundscan.rb +18 -0
  16. data/lib/acme/smileage/commands.rb +16 -0
  17. data/lib/acme/smileage/discography/albums/2009/I001_amanojaku.rb +35 -0
  18. data/lib/acme/smileage/discography/albums/2009/I002_asuha_date_nanoni_imasugu_koe_ga_kikitai.rb +35 -0
  19. data/lib/acme/smileage/discography/albums/2009/I003_sukichan.rb +35 -0
  20. data/lib/acme/smileage/discography/albums/2010/A001_waru_gaki_(1).rb +50 -0
  21. data/lib/acme/smileage/discography/albums/2010/D001_yumemiru_15sai_(pax_japonica_groove_remix).rb +35 -0
  22. data/lib/acme/smileage/discography/albums/2010/D002_gambaranakutemo_eenende_(topnude_remix_version_01).rb +35 -0
  23. data/lib/acme/smileage/discography/albums/2010/D003_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama_(remix_type1).rb +35 -0
  24. data/lib/acme/smileage/discography/albums/2010/I004_otona_ni_narutte_muzukashii.rb +35 -0
  25. data/lib/acme/smileage/discography/albums/2010/S001_yumemiru_15sai.rb +42 -0
  26. data/lib/acme/smileage/discography/albums/2010/S002_gambaranakutemo_eenende.rb +47 -0
  27. data/lib/acme/smileage/discography/albums/2010/S003_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama.rb +46 -0
  28. data/lib/acme/smileage/discography/albums/2011/D004_shortcut_(remixver).rb +35 -0
  29. data/lib/acme/smileage/discography/albums/2011/D005_uchouten_love_rocketman_mix.rb +35 -0
  30. data/lib/acme/smileage/discography/albums/2011/S004_shortcut.rb +51 -0
  31. data/lib/acme/smileage/discography/albums/2011/S005_koi_ni_booing_boo.rb +51 -0
  32. data/lib/acme/smileage/discography/albums/2011/S006_uchouten_love.rb +51 -0
  33. data/lib/acme/smileage/discography/albums/2011/S007_tachiagirl.rb +56 -0
  34. data/lib/acme/smileage/discography/albums/2011/S008_please_minisuka_post_woman.rb +52 -0
  35. data/lib/acme/smileage/discography/albums/2012/A002_smleage_best_album_complete_(1).rb +54 -0
  36. data/lib/acme/smileage/discography/albums/2012/S009_choto_mate_kudasai.rb +52 -0
  37. data/lib/acme/smileage/discography/albums/2012/S010_dotbikini.rb +51 -0
  38. data/lib/acme/smileage/discography/albums/2012/S011_sukiyo_junjou_hankouki.rb +50 -0
  39. data/lib/acme/smileage/discography/albums/2012/S012_samuine.rb +50 -0
  40. data/lib/acme/smileage/discography/albums/2013/A003_(2)_smile_sensation.rb +48 -0
  41. data/lib/acme/smileage/discography/albums/2013/S013_tabidachi_no_haru_ga_kita.rb +50 -0
  42. data/lib/acme/smileage/discography/albums/2013/S014_atarashii_watashini_nare_yattaruchan.rb +50 -0
  43. data/lib/acme/smileage/discography/albums/2013/S015_eeka_iiyatsu.rb +50 -0
  44. data/lib/acme/smileage/discography/albums/2014/S016_mystery_night_eighteen_emotion.rb +54 -0
  45. data/lib/acme/smileage/discography/albums/base.rb +37 -0
  46. data/lib/acme/smileage/discography/albums.rb +28 -0
  47. data/lib/acme/smileage/discography/hello_project_music_award.rb +22 -0
  48. data/lib/acme/smileage/discography/lyrics_downloader.rb +48 -0
  49. data/lib/acme/smileage/discography/sales.rb +43 -0
  50. data/lib/acme/smileage/discography/tracks/2009/001_amanojaku.rb +57 -0
  51. data/lib/acme/smileage/discography/tracks/2009/002_asuha_date_nanoni_imasugu_koe_ga_kikitai.rb +57 -0
  52. data/lib/acme/smileage/discography/tracks/2009/003_sukichan.rb +57 -0
  53. data/lib/acme/smileage/discography/tracks/2010/004_otona_ni_narutte_muzukashii.rb +57 -0
  54. data/lib/acme/smileage/discography/tracks/2010/005_yumemiru_15sai.rb +77 -0
  55. data/lib/acme/smileage/discography/tracks/2010/006_thank_you_creme_brulee_no_yuujou.rb +37 -0
  56. data/lib/acme/smileage/discography/tracks/2010/007_yumemiru_15sai_(pax_japonica_groove_remix).rb +38 -0
  57. data/lib/acme/smileage/discography/tracks/2010/008_gambaranakutemo_eenende.rb +85 -0
  58. data/lib/acme/smileage/discography/tracks/2010/009_gambaranakutemo_iindayo.rb +44 -0
  59. data/lib/acme/smileage/discography/tracks/2010/010_smile_bijin.rb +36 -0
  60. data/lib/acme/smileage/discography/tracks/2010/011_gambaranakutemo_eenende_(topnude_remix_version_01).rb +38 -0
  61. data/lib/acme/smileage/discography/tracks/2010/012_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama.rb +85 -0
  62. data/lib/acme/smileage/discography/tracks/2010/013_chokotto_love.rb +38 -0
  63. data/lib/acme/smileage/discography/tracks/2010/014_onaji_jikyuu_de_hataraku_tomodachi_no_bijin_mama_(remix_type1).rb +38 -0
  64. data/lib/acme/smileage/discography/tracks/2010/015_odorouyo.rb +36 -0
  65. data/lib/acme/smileage/discography/tracks/2010/016_onna_bakari_no_nichiyoubi.rb +36 -0
  66. data/lib/acme/smileage/discography/tracks/2010/017_shooting_star.rb +36 -0
  67. data/lib/acme/smileage/discography/tracks/2010/018_gakkyuu_iinchou.rb +36 -0
  68. data/lib/acme/smileage/discography/tracks/2010/019_shikkari_shiteyo_mou.rb +36 -0
  69. data/lib/acme/smileage/discography/tracks/2011/020_shortcut.rb +69 -0
  70. data/lib/acme/smileage/discography/tracks/2011/021_panyasan_no_arbeit.rb +36 -0
  71. data/lib/acme/smileage/discography/tracks/2011/022_otome_pasta_ni_kandou.rb +38 -0
  72. data/lib/acme/smileage/discography/tracks/2011/023_koi_ni_booing_boo.rb +69 -0
  73. data/lib/acme/smileage/discography/tracks/2011/024_hatukoi_no_anatahe.rb +36 -0
  74. data/lib/acme/smileage/discography/tracks/2011/025_koi_wo_shichaimashita.rb +38 -0
  75. data/lib/acme/smileage/discography/tracks/2011/026_uchouten_love.rb +77 -0
  76. data/lib/acme/smileage/discography/tracks/2011/027_jitensha_chiririn.rb +36 -0
  77. data/lib/acme/smileage/discography/tracks/2011/028_chu_natsu_party.rb +38 -0
  78. data/lib/acme/smileage/discography/tracks/2011/029_shortcut_(remixver).rb +37 -0
  79. data/lib/acme/smileage/discography/tracks/2011/030_uchouten_love_rocketman_mix.rb +38 -0
  80. data/lib/acme/smileage/discography/tracks/2011/031_tachiagirl.rb +73 -0
  81. data/lib/acme/smileage/discography/tracks/2011/032_smile_ondon.rb +35 -0
  82. data/lib/acme/smileage/discography/tracks/2011/033_boogie_train11.rb +38 -0
  83. data/lib/acme/smileage/discography/tracks/2011/034_smileage_singles_gekimoe_remix.rb +35 -0
  84. data/lib/acme/smileage/discography/tracks/2011/035_please_minisuka_post_woman.rb +45 -0
  85. data/lib/acme/smileage/discography/tracks/2011/036_konnichiwa_konbanwa.rb +36 -0
  86. data/lib/acme/smileage/discography/tracks/2011/037_smileage_singles_gekiyaba_remix.rb +35 -0
  87. data/lib/acme/smileage/discography/tracks/2011/038_tewo_nigitte_arukitai.rb +38 -0
  88. data/lib/acme/smileage/discography/tracks/2012/039_choto_mate_kudasai.rb +45 -0
  89. data/lib/acme/smileage/discography/tracks/2012/040_chance_tourai.rb +36 -0
  90. data/lib/acme/smileage/discography/tracks/2012/041_smileage_singles_gekiatsu_remix.rb +35 -0
  91. data/lib/acme/smileage/discography/tracks/2012/042_namida_girl.rb +38 -0
  92. data/lib/acme/smileage/discography/tracks/2012/043_dotbikini.rb +45 -0
  93. data/lib/acme/smileage/discography/tracks/2012/044_smile_blues.rb +36 -0
  94. data/lib/acme/smileage/discography/tracks/2012/045_koibito_ha_kokoro_no_ouendan.rb +38 -0
  95. data/lib/acme/smileage/discography/tracks/2012/046_kiiroi_jitensha_to_sandwich.rb +36 -0
  96. data/lib/acme/smileage/discography/tracks/2012/047_sukiyo_junjou_hankouki.rb +45 -0
  97. data/lib/acme/smileage/discography/tracks/2012/048_kimi_ha_jitensha_watasi_ha_densya_de_kitaku.rb +38 -0
  98. data/lib/acme/smileage/discography/tracks/2012/049_samuine.rb +49 -0
  99. data/lib/acme/smileage/discography/tracks/2012/050_watashi_choito_kawaii_urabancho.rb +36 -0
  100. data/lib/acme/smileage/discography/tracks/2013/051_tabidachi_no_haru_ga_kita.rb +45 -0
  101. data/lib/acme/smileage/discography/tracks/2013/052_doushiyou.rb +36 -0
  102. data/lib/acme/smileage/discography/tracks/2013/053_shin_nihon_no_susume.rb +36 -0
  103. data/lib/acme/smileage/discography/tracks/2013/054_otona_no_tochuu.rb +36 -0
  104. data/lib/acme/smileage/discography/tracks/2013/055_tenshin_ramman.rb +36 -0
  105. data/lib/acme/smileage/discography/tracks/2013/056_watashi_no_kokoro.rb +36 -0
  106. data/lib/acme/smileage/discography/tracks/2013/057_yuugure_koi_no_jikan.rb +36 -0
  107. data/lib/acme/smileage/discography/tracks/2013/058_nee_sempai.rb +36 -0
  108. data/lib/acme/smileage/discography/tracks/2013/059_sayonara_sayonara_sayonara.rb +36 -0
  109. data/lib/acme/smileage/discography/tracks/2013/060_atarashii_watashini_nare.rb +45 -0
  110. data/lib/acme/smileage/discography/tracks/2013/061_yattaruchan.rb +45 -0
  111. data/lib/acme/smileage/discography/tracks/2013/062_eeka.rb +44 -0
  112. data/lib/acme/smileage/discography/tracks/2013/063_iiyatsu.rb +44 -0
  113. data/lib/acme/smileage/discography/tracks/2014/064_mystery_night.rb +44 -0
  114. data/lib/acme/smileage/discography/tracks/2014/065_eighteen_emotion.rb +44 -0
  115. data/lib/acme/smileage/discography/tracks/base.rb +39 -0
  116. data/lib/acme/smileage/discography/tracks.rb +65 -0
  117. data/lib/acme/smileage/discography.rb +101 -0
  118. data/lib/acme/smileage/members/base.rb +56 -0
  119. data/lib/acme/smileage/members/fukuda_kanon.rb +29 -0
  120. data/lib/acme/smileage/members/katsuta_rina.rb +29 -0
  121. data/lib/acme/smileage/members/kosuga_fuyuka.rb +29 -0
  122. data/lib/acme/smileage/members/maeda_yuuka.rb +29 -0
  123. data/lib/acme/smileage/members/nakanishi_kana.rb +29 -0
  124. data/lib/acme/smileage/members/ogawa_saki.rb +29 -0
  125. data/lib/acme/smileage/members/takeuchi_akari.rb +29 -0
  126. data/lib/acme/smileage/members/tamura_meimi.rb +29 -0
  127. data/lib/acme/smileage/members/wada_ayaka.rb +29 -0
  128. data/lib/acme/smileage/members.rb +40 -0
  129. data/lib/acme/smileage/utils/base_downloader.rb +38 -0
  130. data/lib/acme/smileage/utils/matcher.rb +64 -0
  131. data/lib/acme/smileage/version.rb +5 -0
  132. data/lib/acme/smileage/version.rb~ +5 -0
  133. data/lib/acme/smileage.rb +55 -0
  134. data/test/acme/test_album.rb +204 -0
  135. data/test/acme/test_member.rb +45 -0
  136. data/test/acme/test_smileage.rb +144 -0
  137. data/test/acme/test_track.rb +57 -0
  138. data/test/minitest_helper.rb +5 -0
  139. metadata +287 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f088a0732a322010da6c01122f1b7b13ccf7ea8
4
+ data.tar.gz: 84d9e834a7221ab92e0b94376940e2e129004b9d
5
+ SHA512:
6
+ metadata.gz: 10b5cb1c53f7765ba932359f46d697d4c3f23d3aabfa317f1dc3f7b57a0fe993b6258b0810b02b162c3304416a5c08d3f74cf3a331d2ff530fa98811596c3844
7
+ data.tar.gz: 848c0dd114a82e353bbf91425c4e00eb64415b0fa22cabd6063ef80c0fe9e41239e697fbf7ab58b022dfcde6ced734172e881fec26f7bf5546b15bbb05d7e69e
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in acme-smileage.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 nicochan99
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,215 @@
1
+ # Acme::Smileage
2
+
3
+ All about Japanese pop star "S/mileage".
4
+
5
+ "S/mileage" is one of highly famous Japanese pop stars.
6
+ This module, acme-smileage, provides an easy method to catch up with S/mileage.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'acme-smileage'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install acme-smileage
21
+
22
+ ## Usage
23
+
24
+ require "acme/smileage"
25
+
26
+ sm = Acme::Smileage.new
27
+
28
+ ## Member infomation
29
+
30
+ all_members = sm.members
31
+ active_members = sm.members {|m| m.active? }
32
+ graduated_members = sm.members {|m| m.graduated? }
33
+ at_some_time_members = sm.members {|m| m.active?(Date.new(2010, 10, 10)) }
34
+
35
+ member = sm.members {|m| m.name_en =~ /rina/i }.first
36
+ p member.name #=> "Rina Katsuta"
37
+ p member.name_en #=> "Rina Katsuta"
38
+ p member.family_name_en #=> "Katsuta"
39
+ p member.first_name_en #=> "Rina"
40
+ p member.name_ja #=> "���c����"
41
+ p member.family_name_ja #=> "���c"
42
+ p member.first_name_ja #=> "����"
43
+ p member.birthday #=> #<Date: 1998-04-06 ((2450910j,0s,0n),+0s,2299161j)>
44
+ p member.blood_type #=> "A"
45
+ p member.hometown #=> "����"
46
+ p member.emoticon #=> "��p�L v�M)"
47
+ p member.nicknames #=> ["��ȂՁ`"]
48
+ p member.member_color #=> "Yellow"
49
+ p member.blog_link #=> "http://ameblo.jp/smileage-submember/"
50
+ p member.twitter_accounts #=> ["@smileage_newmem", "@smileage_715"]
51
+ p member.generation #=> 2
52
+ p member.join_date #=> #<Date: 2011-08-14 ((2455788j,0s,0n),+0s,2299161j)>
53
+ p member.graduate_date #=> nil
54
+ p member.age #=> 16
55
+ p member.age(Date.new(2020, 1, 1)) #=> 21
56
+ p member.active? #=> true
57
+ p member.active?(Date.new(2010, 1, 1)) #=> false
58
+ p member.graduated? #=> false
59
+ p member.graduated?(Date.new(2010, 1, 1)) #=> false
60
+
61
+ entry_list = member.get_blog_entry_list
62
+ pp entry_list #=> #<Acme::Smileage::Blog::Entry::List:0x1b7f590
63
+ # @entries=
64
+ # [#<Acme::Smileage::Blog::Entry::Header:0x1b948a8
65
+ # @author="Katsuta",
66
+ # @comment_count=51,
67
+ # @datetime="2014-04-24 20:03:52",
68
+ # @good_count=186,
69
+ # @link="http://ameblo.jp/smileage-submember/entry-11832527015.html",
70
+ # @title="�C�O�􏟓c����">,
71
+ # #<Acme::Smileage::Blog::Entry::Header:0x1bbcd48
72
+ # @author="Katsuta",
73
+ # @comment_count=51,
74
+ # @datetime="2014-04-23 22:50:50",
75
+ # @good_count=250,
76
+ # @link="http://ameblo.jp/smileage-submember/entry-11831671384.html",
77
+ # @title="Zipper�I���c����">,
78
+ # #<Acme::Smileage::Blog::Entry::Header:0x208a520
79
+ # @author="Katsuta",
80
+ # @comment_count=57,
81
+ # @datetime="2014-04-21 21:34:17",
82
+ # @good_count=233,
83
+ # @link="http://ameblo.jp/smileage-submember/entry-11829355763.html",
84
+ # @title=
85
+ # "�L�����y�[���I���c����">],
86
+ # @link="http://ameblo.jp/smileage-submember/entrylist-1.html",
87
+ # @next_page=2>
88
+
89
+ pp entry_list.entries.first.get_body #=> #<Acme::Smileage::Blog::Entry::Body:0x1dba760
90
+ # @comment_link="http://ameblo.jp/smileage-submember/entry-11832527015.html#cbox",
91
+ # @comments=
92
+ # [#<Acme::Smileage::Blog::Entry::Comment:0x163f4b8
93
+ # @author="xxx",
94
+ # @author_link="http://ameblo.jp/xxx/",
95
+ # @datetime="2014-04-24 20:07:51",
96
+ # @link= "http://ameblo.jp/smileage-submember/entry-11832527015.html#c12503056111",
97
+ # @text= "yyy",
98
+ # @title="2. zzz">,
99
+ # # �ȗ�
100
+ # ],
101
+ # @image_links=
102
+ # ["http://stat.ameba.jp/user_images/20140424/20/smileage-submember/30/03/j/o0240024012918923521.jpg"],
103
+ # @next_entry_link="http://ameblo.jp/smileage-submember/entry-11832574000.html",
104
+ # @prev_entry_link="http://ameblo.jp/smileage-submember/entry-11832528306.html",
105
+ # @text="(�ȗ�)">
106
+
107
+ ## Track infomation
108
+
109
+ all_tracks = sm.tracks
110
+ all_cover_tracks = sm.tracks {|e| e.cover? }
111
+ all_remix_tracks = sm.tracks {|e| e.remix? }
112
+
113
+ track = sm.find_track("���b�^���`����")
114
+ p track.name #=> "���b�^���`����"
115
+ p track.name_romaji #=> "yattaruchan"
116
+ p track.nicknames #=> ["���b�^��"]
117
+ p track.play_time #=> 231
118
+ p track.lyricists #=> ["�‚񂭁�"]
119
+ p track.composers #=> ["�‚񂭁�"]
120
+ p track.arrangers #=> ["��v�یO"]
121
+
122
+ # �n���v���y�ȑΏۃ����L���O
123
+ if track.hpma
124
+ p track.hpma.year #=> 2013
125
+ p track.hpma.rank #=> 2
126
+ p track.hpma.votes #=> 939
127
+ p track.hpma.points #=> 2343.5
128
+ end
129
+
130
+ p track.cover? #=> false
131
+ p track.remix? #=> false
132
+ p track.get_lyrics #=> "���̒��ȁ@�Ȃ�₩��⌾���Ă��� (�ȗ�)"
133
+ p track.get_lyrics(:utanet) #=> "���̒��ȁ@�Ȃ�₩��⌾���Ă��� (�ȗ�)"
134
+ p track.get_lyrics(:utamap) #=> "���̒��� �Ȃ�₩��⌾���Ă��� (�ȗ�)"
135
+
136
+ p track.lyric_links #=> {
137
+ # :utamap => "http://www.utamap.com/showkasi.php?surl=k-130703-251",
138
+ # :utanet => "http://www.uta-net.com/song/148899/",
139
+ # }
140
+
141
+ p track.youtube_links #=> [
142
+ # {
143
+ # :title => "�X�}�C���[�W �w���b�^���`�����x(S/mileage[Yattaruchan]) (MV)",
144
+ # :link => "https://www.youtube.com/watch?v=emiJ1iGih6U",
145
+ # },
146
+ # {
147
+ # :title => "�X�}�C���[�W �w���b�^���`�����x(S/mileage[Yattaruchan]) (Dance Shot Ver.)",
148
+ # :link => "https://www.youtube.com/watch?v=fwpjnUSvyKk",
149
+ # },
150
+ # ]
151
+
152
+ p track.itunes_links #=> [
153
+ # {
154
+ # :title => "�V�������ɂȂ�I�^���b�^���`����",
155
+ # :link => "https://itunes.apple.com/jp/album/id663131682",
156
+ # },
157
+ # ]
158
+
159
+
160
+ ## Discography infomation
161
+
162
+ all_single_albums = sm.discography
163
+ all_singles = sm.discography {|e| e.single? }
164
+ all_indies_singles = sm.discography {|e| e.indies? and e.single? }
165
+ all_major_singles = sm.discography {|e| e.major? and e.single? }
166
+ all_albums = sm.discography {|e| e.album? }
167
+ all_original_albums = sm.discography {|e| e.original_album? }
168
+ all_best_albums = sm.discography {|e| e.best_album? }
169
+
170
+ sm.oricon_total_sales #=> 462702
171
+ sm.oricon_total_sales {e| e.album? } #=> 27034
172
+
173
+ album = sm.find_discography("�X�}�Z��")
174
+ p album.name #=> "�A�X�}�C���Z���Z�[�V����"
175
+ p album.name_romaji #=> "(2) smile sensation"
176
+ p album.nicknames #=> ["�X�}�Z��"]
177
+ p album.release_date #=> #<Date: 2013-05-22 ((2456435j,0s,0n),+0s,2299161j)>
178
+ p album.release_year #=> 2013
179
+ p album.discography_link #=> "http://s-mileage.jp/discography/detail_00146/"
180
+ p album.artwork_links #=> [
181
+ # {
182
+ # :title => "�A�X�}�C���Z���Z�[�V���� �y�ʏ�Ձz",
183
+ # :link => "http://s-mileage.jp/discography/obj/img/000/146/130425-1954_01l.jpg",
184
+ # },
185
+ # {
186
+ # :title => "�A�X�}�C���Z���Z�[�V���� �y���񐶎Y����Ձz",
187
+ # :link => "http://s-mileage.jp/discography/obj/img/000/146/130425-1954_02l.jpg",
188
+ # },
189
+ # ]
190
+
191
+ # �I���R���Z�[���X
192
+ if album.oricon
193
+ p album.oricon.first_week_sales #=> 6199
194
+ p album.oricon.total_sales #=> 7091
195
+ p album.oricon.peak_rank #=> 13
196
+ p album.oricon.weeks_on_chart #=> 3
197
+ end
198
+
199
+ p album.tracks.length #=> 10
200
+ p album.single? #=> false
201
+ p album.album? #=> true
202
+ p album.best_album? #=> false
203
+ p album.original_album? #=> true
204
+ p album.major? #=> true
205
+ p album.indies? #=> false
206
+ p album.download_only? #=> false
207
+
208
+
209
+ ## Contributing
210
+
211
+ 1. Fork it ( http://github.com/nicochan99/acme-smileage/fork )
212
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
213
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
214
+ 4. Push to the branch (`git push origin my-new-feature`)
215
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.pattern = "test/**/test_*.rb"
7
+ end
8
+
9
+ task :default => :test
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'acme/smileage/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "acme-smileage"
8
+ spec.version = Acme::Smileage::VERSION
9
+ spec.authors = ["nicochan99"]
10
+ spec.email = ["nicochan990@yahoo.co.jp"]
11
+ spec.summary = %q{All about Japanese pop star "S/mileage"}
12
+ spec.description = %q{"S/mileage" is one of highly famous Japanese pop stars.
13
+ This module, acme-smileage, provides an easy method to catch up with S/mileage.}
14
+ spec.homepage = "https://github.com/nicochan99/acme-smileage"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.5"
23
+ spec.add_development_dependency "rake", "~> 10.2"
24
+ spec.add_development_dependency "minitest", "~> 5.3"
25
+ spec.add_runtime_dependency "amatch", '~> 0.3'
26
+ spec.add_runtime_dependency "moji", '~> 1.6'
27
+ spec.add_runtime_dependency "nokogiri", '~> 1.6'
28
+ spec.add_runtime_dependency "thor", '~> 0.19'
29
+ end
data/bin/smileage ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "acme/smileage/commands"
3
+ Acme::Smileage::Commands::Main.start
@@ -0,0 +1,49 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "acme/smileage/blog/ameblo_downloader"
4
+
5
+ module Acme
6
+ class Smileage
7
+ module Blog
8
+ class Ameblo
9
+ @@cache = {}
10
+
11
+ attr_reader :blog_link, :author
12
+
13
+ def initialize(blog_link, author = nil)
14
+ @blog_link = blog_link
15
+ @author = author
16
+ @downloader = Acme::Smileage::Blog::AmebloDownloader.new
17
+ end
18
+
19
+ def get_entry_list(page = 1)
20
+ c = (@@cache[[self.blog_link, page]] ||= @downloader.get_entry_list(self, self.blog_link, page))
21
+
22
+ r = c.dup
23
+ if self.author
24
+ r.entries = r.entries.select {|e| e.author == self.author }
25
+ end
26
+ r
27
+ end
28
+
29
+ def get_entry_body(entry_header)
30
+ entry_link = coerce_entry_link(entry_header)
31
+ @@cache[entry_link] ||= @downloader.get_entry_body(entry_link)
32
+ end
33
+
34
+ private
35
+
36
+ def coerce_entry_link(x)
37
+ case x
38
+ when String, URI
39
+ x
40
+ when Acme::Smileage::Blog::Entry::Header
41
+ x.link
42
+ else
43
+ raise ArgumentError, "Invalid entry link: #{x}"
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,171 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "cgi"
4
+
5
+ require "acme/smileage/blog/entry"
6
+ require "acme/smileage/utils/base_downloader"
7
+
8
+ module Acme
9
+ class Smileage
10
+ module Blog
11
+ class AmebloDownloader < Acme::Smileage::Utils::BaseDownloader
12
+ def get_entry_list(blog, blog_link, page=1)
13
+ unless blog_link
14
+ Acme::Smileage::Blog::Entry::List.new
15
+ end
16
+
17
+ with_nokogiri(blog_link, "entrylist-#{page}.html") do |doc, uri|
18
+ Acme::Smileage::Blog::Entry::List.new {|e|
19
+ e.link = uri.to_s
20
+ e.entries = parse_entry_list(blog, doc)
21
+ e.next_page = parse_next_page(doc)
22
+ }
23
+ end
24
+ end
25
+
26
+ def get_entry_body(entry_link)
27
+ with_nokogiri(entry_link) do |doc|
28
+ Acme::Smileage::Blog::Entry::Body.new {|e|
29
+ e.text = parse_text(doc, ".articleText")
30
+ e.comment_link = parse_attr(doc, ".commentLink", :href)
31
+ e.next_entry_link = parse_attr(doc, ".pagingNext", :href)
32
+ e.prev_entry_link = parse_attr(doc, ".pagingPrev", :href)
33
+ e.image_links = parse_image_list(doc)
34
+ e.comments = parse_comment_list(entry_link, doc)
35
+ }
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def parse_entry_list(blog, doc)
42
+ doc.css(".contentsList li").map {|li|
43
+ Acme::Smileage::Blog::Entry::Header.new(blog) {|e|
44
+ e.link = parse_attr(li, ".contentTitle", :href)
45
+ e.title = parse_text(li, ".contentTitle")
46
+ e.datetime = parse_text(li, ".contentTime")
47
+ e.comment_count = parse_number(li, ".contentComment")
48
+ e.good_count = parse_number(li, "a.skinWeakColor")
49
+ e.author = guess_author(e.link, e.title)
50
+
51
+ e.define_singleton_method(:get_body, Proc.new {
52
+ blog.get_entry_body(e)
53
+ })
54
+ }
55
+ }
56
+ end
57
+
58
+ def parse_next_page(doc)
59
+ parse_attr(doc, ".listPagePaging .pagingNext", :href) {|href|
60
+ href[/entrylist-(\d+)/, 1].to_i if href
61
+ }
62
+ end
63
+
64
+ def parse_image_list(doc)
65
+ doc.css(".articleText a img").map{|e|
66
+ src = e[:src]
67
+ if src.sub!(/t[0-9]+_([0-9]+)/) { "o#{$1}" }
68
+ src
69
+ end
70
+ }.compact
71
+ end
72
+
73
+ def parse_comment_list(entry_link, doc)
74
+ doc.css(".commentList li").map {|li|
75
+ Acme::Smileage::Blog::Entry::Comment.new {|e|
76
+ e.link = "%s#%s" % [entry_link, li.css("a")[0][:id]]
77
+ e.title = parse_text(li, ".commentHeader")
78
+ e.text = parse_text(li, ".commentBody")
79
+ e.author = parse_text(li, ".commentAuthor")
80
+ e.author_link = parse_attr(li, ".commentAuthor", :href)
81
+ e.datetime = parse_text(li, ".commentTime > time")
82
+ }
83
+ }
84
+ end
85
+
86
+
87
+ BLOG_ENTRY_AUTHOR_MAPPING = {
88
+ "http://ameblo.jp/smileage-submember/entry-11018609295.html" => "Katsuta",
89
+ "http://ameblo.jp/smileage-submember/entry-11039125372.html" => "Nakanishi",
90
+ "http://ameblo.jp/smileage-submember/entry-11063872434.html" => "Katsuta",
91
+ "http://ameblo.jp/smileage-submember/entry-11073466463.html" => "Tamura",
92
+ "http://ameblo.jp/smileage-submember/entry-11155617406.html" => nil, # スタッフ
93
+ "http://ameblo.jp/smileage-submember/entry-11215252589.html" => "Tamura",
94
+ "http://ameblo.jp/smileage-submember/entry-11217726959.html" => "Takeuchi",
95
+ "http://ameblo.jp/smileage-submember/entry-11453335643.html" => "Tamura",
96
+ "http://ameblo.jp/smileage-submember/entry-11529821236.html" => "Tamura",
97
+ "http://ameblo.jp/smileage-submember/entry-11545517618.html" => "Takeuchi",
98
+ "http://ameblo.jp/smileage-submember/entry-11545630723.html" => "Takeuchi",
99
+ "http://ameblo.jp/smileage-submember/entry-11614497735.html" => nil, # スタッフ
100
+ "http://ameblo.jp/smileage-submember/entry-11623987909.html" => "Takeuchi",
101
+ "http://ameblo.jp/smileage-submember/entry-11821080105.html" => "Nakanishi"
102
+ }
103
+
104
+ def guess_author(link, title)
105
+ if author = BLOG_ENTRY_AUTHOR_MAPPING[link]
106
+ return author
107
+ end
108
+
109
+ case link
110
+ when /wadaayaka/
111
+ "Wada"
112
+ when /kanon-fukuda/
113
+ "Fukuda"
114
+ when /smileage-submember/
115
+ case title
116
+ when /中西香菜/, /中西/
117
+ "Nakanishi"
118
+ when /竹内朱莉/, /竹内/, /朱莉/
119
+ "Takeuchi"
120
+ when /勝田里奈/, /R.?I.?N.?A/i
121
+ "Katsuta"
122
+ when /田村芽実/, /田村/, /芽実/
123
+ "Tamura"
124
+ end
125
+ end
126
+ end
127
+
128
+ def parse_text(doc, css)
129
+ e = doc.css(css)
130
+ return nil if not e
131
+
132
+ # これだと改行がうまく変換できない場合があるので自前で処理
133
+ # e.css("br").each {|ee| ee.replace("\n") }
134
+ # e.text.strip
135
+
136
+ v = e.to_s
137
+ v.gsub!(/<br\/?>/i, "\n")
138
+ v.gsub!(%r{<img.*?src="(http://stat\.ameba\.jp/user_images/.*?/)t[0-9]+_([0-9]+\.jpg)".*?>}) { "%so%s" % [$1, $2] }
139
+ v.gsub!(/<.*?>/, "")
140
+ v.gsub!(/\r/, "")
141
+ v.gsub!(/\u00a0/, "")
142
+ CGI.unescapeHTML(v.strip) if v
143
+ end
144
+
145
+ def parse_number(doc, css)
146
+ v = parse_text(doc, css)
147
+ return nil if not v
148
+
149
+ vv = v[/\d+/, 0]
150
+ return nil if not vv
151
+
152
+ vv.to_i
153
+ end
154
+
155
+ def parse_attr(doc, css, attr)
156
+ e = doc.css(css)
157
+ return nil if not e or e.empty?
158
+
159
+ v = e[0][attr]
160
+ v.strip! if v
161
+
162
+ if block_given?
163
+ yield v
164
+ else
165
+ v
166
+ end
167
+ end
168
+ end
169
+ end
170
+ end
171
+ end
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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
@@ -0,0 +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