ehbrs-tools 0.25.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/.avm.yml +4 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +39 -0
  5. data/Gemfile.lock +307 -0
  6. data/lib/ehbrs/{core_ext.rb → tools/core_ext.rb} +0 -0
  7. data/lib/ehbrs/tools/runner/finances/bb_browser.rb +1 -1
  8. data/lib/ehbrs/tools/runner/fs/selected.rb +19 -26
  9. data/lib/ehbrs/tools/runner/music/lyrics.rb +68 -0
  10. data/lib/ehbrs/tools/runner/music/lyrics_book.rb +41 -0
  11. data/lib/ehbrs/tools/runner/music/selected.rb +6 -6
  12. data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +1 -1
  13. data/lib/ehbrs/tools/version.rb +1 -1
  14. data/lib/ehbrs/user_dirs.rb +2 -2
  15. data/lib/ehbrs/videos/extract/package.rb +2 -2
  16. data/lib/ehbrs/videos/extract/package_file.rb +0 -1
  17. data/spec/code/rubocop_spec.rb +3 -0
  18. data/spec/lib/ehbrs/cooking_book/recipe/measure_spec.rb +21 -0
  19. data/spec/lib/ehbrs/observers/base_spec.rb +93 -0
  20. data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +62 -0
  21. data/spec/lib/ehbrs/tools/runner/vg/ips_spec.rb +31 -0
  22. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom +0 -0
  23. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips +0 -0
  24. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips +0 -0
  25. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom +0 -0
  26. data/spec/lib/ehbrs/tools/runner/videos/probe_spec.rb +19 -0
  27. data/spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml +105 -0
  28. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb +75 -0
  29. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml +90 -0
  30. data/spec/lib/ehbrs/tools/runner_spec.rb +16 -0
  31. data/spec/lib/ehbrs/vg/wii/game_file_spec.rb +21 -0
  32. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec.rb +11 -0
  33. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.source.witdump +27 -0
  34. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_R92P01_wia.target.yaml +22 -0
  35. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.source.witdump +28 -0
  36. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/pikmin2_pal_iso.target.yaml +21 -0
  37. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.source.witdump +16 -0
  38. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/resident_evil_code_veronica_disc2_iso.target.yaml +19 -0
  39. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.source.witdump +28 -0
  40. data/spec/lib/ehbrs/vg/wii/wit/parsers/dump_spec_files/super_mario_galaxy_wbfs.target.yaml +23 -0
  41. data/spec/lib/ehbrs/vg/wii/wit/path_spec.rb +33 -0
  42. data/spec/spec_helper/videos.rb +30 -0
  43. data/spec/spec_helper/videos_files/stub_source.mp4 +0 -0
  44. data/spec/spec_helper.rb +7 -0
  45. data/vendor/aranha-parsers/aranha-parsers.gemspec +1 -0
  46. data/vendor/aranha-parsers/lib/aranha/parsers/rspec/setup.rb +1 -1
  47. data/vendor/aranha-parsers/lib/aranha/parsers/rspec/{source_target_fixtures_example.rb → shared_examples/source_target_fixtures.rb} +0 -0
  48. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/fetch_content_error.rb +10 -0
  49. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/http_get.rb +15 -2
  50. data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
  51. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +1 -1
  52. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +9 -1
  53. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +6 -0
  54. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +3 -3
  55. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  56. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +6 -5
  57. data/vendor/eac_fs/Gemfile +5 -0
  58. data/vendor/eac_fs/eac_fs.gemspec +20 -0
  59. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb → eac_fs/lib/eac_fs/cache.rb} +7 -2
  60. data/vendor/eac_fs/lib/eac_fs/file_info.rb +24 -0
  61. data/vendor/eac_fs/lib/eac_fs/patches/module/fs_cache.rb +10 -0
  62. data/vendor/eac_fs/lib/eac_fs/patches/module.rb +4 -0
  63. data/vendor/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +10 -0
  64. data/vendor/eac_fs/lib/eac_fs/patches/object.rb +4 -0
  65. data/vendor/eac_fs/lib/eac_fs/patches/pathname/info.rb +12 -0
  66. data/vendor/eac_fs/lib/eac_fs/patches/pathname.rb +4 -0
  67. data/vendor/eac_fs/lib/eac_fs/patches.rb +4 -0
  68. data/vendor/eac_fs/lib/eac_fs/version.rb +5 -0
  69. data/vendor/eac_fs/lib/eac_fs.rb +7 -0
  70. data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/filesystem_cache_spec.rb → eac_fs/spec/lib/eac_fs/cache_spec.rb} +2 -2
  71. data/vendor/eac_fs/spec/rubocop_spec.rb +3 -0
  72. data/vendor/eac_fs/spec/spec_helper.rb +4 -0
  73. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +2 -1
  74. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +3 -3
  75. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +1 -0
  76. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +16 -7
  77. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  78. data/vendor/eac_ruby_gems_utils/Gemfile +5 -0
  79. data/vendor/eac_ruby_gems_utils/LICENCE +16 -0
  80. data/vendor/eac_ruby_gems_utils/README.rdoc +3 -0
  81. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +30 -0
  82. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +33 -0
  83. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +41 -0
  84. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +97 -0
  85. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +58 -0
  86. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/minitest.rb +25 -0
  87. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +48 -0
  88. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
  89. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +84 -0
  90. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb +21 -0
  91. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests.rb +9 -0
  92. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +5 -0
  93. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils.rb +7 -0
  94. data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +3 -0
  95. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
  96. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
  97. data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb +20 -0
  98. data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +4 -0
  99. data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile +5 -0
  100. data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock +19 -0
  101. data/vendor/eac_ruby_gems_utils/spec/support/mygem/Rakefile +14 -0
  102. data/vendor/eac_ruby_gems_utils/spec/support/mygem/exe/myrunner +5 -0
  103. data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem/version.rb +5 -0
  104. data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem.rb +5 -0
  105. data/vendor/eac_ruby_gems_utils/spec/support/mygem/mygem.gemspec +16 -0
  106. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/compact.rb +22 -0
  107. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/compact.rb +20 -0
  108. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/delimited.rb +16 -0
  109. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/string_delimited.rb +70 -0
  110. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  111. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/compact_spec.rb +20 -0
  112. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb +20 -0
  113. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/string/delimited_spec.rb +34 -0
  114. data/vendor/eac_templates/Gemfile +5 -0
  115. data/vendor/eac_templates/eac_templates.gemspec +19 -0
  116. data/vendor/eac_templates/lib/eac_templates/directory.rb +108 -0
  117. data/vendor/eac_templates/lib/eac_templates/file.rb +48 -0
  118. data/vendor/eac_templates/lib/eac_templates/patches/module/erb_template.rb +9 -0
  119. data/vendor/eac_templates/lib/eac_templates/patches/module/template.rb +10 -0
  120. data/vendor/eac_templates/lib/eac_templates/patches/module.rb +4 -0
  121. data/vendor/eac_templates/lib/eac_templates/patches/object/erb_template.rb +9 -0
  122. data/vendor/eac_templates/lib/eac_templates/patches/object/template.rb +9 -0
  123. data/vendor/eac_templates/lib/eac_templates/patches/object.rb +4 -0
  124. data/vendor/eac_templates/lib/eac_templates/patches.rb +4 -0
  125. data/vendor/eac_templates/lib/eac_templates/searcher.rb +53 -0
  126. data/vendor/eac_templates/lib/eac_templates/variable_not_found_error.rb +5 -0
  127. data/vendor/eac_templates/lib/eac_templates/variable_providers/base.rb +21 -0
  128. data/vendor/eac_templates/lib/eac_templates/variable_providers/config_reader.rb +27 -0
  129. data/vendor/eac_templates/lib/eac_templates/variable_providers/entries_reader.rb +23 -0
  130. data/vendor/eac_templates/lib/eac_templates/variable_providers/generic.rb +23 -0
  131. data/vendor/eac_templates/lib/eac_templates/variable_providers/hash.rb +27 -0
  132. data/vendor/eac_templates/lib/eac_templates/variable_providers.rb +23 -0
  133. data/vendor/eac_templates/lib/eac_templates/version.rb +5 -0
  134. data/vendor/eac_templates/lib/eac_templates.rb +7 -0
  135. data/vendor/eac_templates/spec/lib/eac_templates/file_spec.rb +35 -0
  136. data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/expected_content +2 -0
  137. data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/source.template +2 -0
  138. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec.rb +30 -0
  139. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file1.template +1 -0
  140. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file2 +1 -0
  141. data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path2/subdir1/file3.template +1 -0
  142. data/vendor/eac_templates/spec/lib/object/template_spec.rb +23 -0
  143. data/vendor/eac_templates/spec/lib/object/template_spec_files/path/my_stub_with_template +1 -0
  144. data/vendor/eac_templates/spec/rubocop_spec.rb +3 -0
  145. data/vendor/eac_templates/spec/spec_helper.rb +4 -0
  146. data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +6 -1
  147. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/core_ext.rb +5 -0
  148. data/{lib/ehbrs → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils}/fs/compressed_package.rb +1 -1
  149. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build.rb +41 -0
  150. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build_file.rb +27 -0
  151. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected.rb +35 -0
  152. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs.rb +10 -0
  153. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb +42 -0
  154. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb +64 -0
  155. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/song.rb +68 -0
  156. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book.rb +65 -0
  157. data/{lib/ehbrs/fs.rb → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music.rb} +2 -2
  158. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object.rb +4 -0
  159. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches.rb +4 -0
  160. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
  161. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +31 -0
  162. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +1 -1
  163. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/album/inner.html.erb +3 -0
  164. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/custom_style.css +11 -0
  165. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/index.html.erb +14 -0
  166. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/main.html.erb +24 -0
  167. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/resource/main.html.erb +8 -0
  168. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/song/inner.html.erb +5 -0
  169. data/vendor/ultimate_lyrics/Gemfile +5 -0
  170. data/vendor/ultimate_lyrics/bin/download_parser_spec_files.rb +94 -0
  171. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/field.rb +83 -0
  172. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/lyrics.rb +13 -0
  173. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/parser.rb +28 -0
  174. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/exclude_item.rb +17 -0
  175. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/extract_item.rb +21 -0
  176. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/item.rb +48 -0
  177. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/replace_fields.rb +13 -0
  178. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/rule.rb +52 -0
  179. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb +21 -0
  180. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider.rb +96 -0
  181. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider_search.rb +43 -0
  182. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/providers_data.xml +356 -0
  183. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata/field.rb +24 -0
  184. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata.rb +28 -0
  185. data/vendor/ultimate_lyrics/lib/ultimate_lyrics/version.rb +5 -0
  186. data/vendor/ultimate_lyrics/lib/ultimate_lyrics.rb +7 -0
  187. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec.rb +20 -0
  188. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.source.html +8 -0
  189. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.target.yaml +3 -0
  190. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.url +1 -0
  191. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.source.html +8 -0
  192. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.target.yaml +3 -0
  193. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.url +1 -0
  194. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.source.html +193 -0
  195. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.target.yaml +3 -0
  196. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.url +1 -0
  197. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.source.html +193 -0
  198. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.target.yaml +3 -0
  199. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.url +1 -0
  200. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.source.html +87 -0
  201. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.target.yaml +36 -0
  202. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.url +1 -0
  203. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.source.html +4 -0
  204. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.target.yaml +3 -0
  205. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.url +1 -0
  206. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.source.html +2 -0
  207. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.target.yaml +3 -0
  208. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.url +1 -0
  209. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.source.html +2 -0
  210. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.target.yaml +3 -0
  211. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.url +1 -0
  212. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.source.html +101 -0
  213. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.target.yaml +3 -0
  214. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.url +1 -0
  215. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.source.html +29 -0
  216. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.target.yaml +3 -0
  217. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.url +1 -0
  218. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.source.html +29 -0
  219. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.target.yaml +3 -0
  220. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.url +1 -0
  221. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.source.html +1301 -0
  222. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.target.yaml +3 -0
  223. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.url +1 -0
  224. data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/provider_search_spec.rb +72 -0
  225. data/vendor/ultimate_lyrics/spec/rubocop_spec.rb +3 -0
  226. data/vendor/ultimate_lyrics/spec/spec_helper.rb +4 -0
  227. data/vendor/ultimate_lyrics/ultimate_lyrics.gemspec +21 -0
  228. metadata +251 -12
  229. data/lib/ehbrs/patches/module/erb_template.rb +0 -11
  230. data/lib/ehbrs/patches/object/erb_template.rb +0 -9
  231. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +0 -12
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ ENV['BUNDLE_GEMFILE'] = ::File.expand_path('../Gemfile', __dir__)
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+ $LOAD_PATH.unshift("#{__dir__}/../lib")
8
+
9
+ require 'ultimate_lyrics/song_metadata'
10
+ require 'ultimate_lyrics/provider'
11
+ require 'ultimate_lyrics/provider_search'
12
+ require 'aranha/parsers/source_address'
13
+ require 'aranha/parsers/source_address/fetch_content_error'
14
+ require 'eac_ruby_utils/core_ext'
15
+
16
+ class OriginalContentDownload
17
+ enable_simple_cache
18
+ common_constructor :song_metadata, :provider
19
+
20
+ def run
21
+ puts "Fetch content for #{provider_search}..."
22
+ source_content.if_present do |v|
23
+ source_file.write(v)
24
+ url_file.write(provider_search.url.strip + "\n")
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def basename_file_uncached
31
+ provider.name.variableize + '__' + "#{song_metadata.artist}_#{song_metadata.title}".variableize
32
+ end
33
+
34
+ def fixtures_dir_uncached
35
+ __dir__.to_pathname.parent.join('spec', 'lib', 'ultimate_lyrics', 'parser_spec_files')
36
+ end
37
+
38
+ def provider_search_uncached
39
+ ::UltimateLyrics::ProviderSearch.new(provider, song_metadata)
40
+ end
41
+
42
+ def source_content
43
+ r = ::Aranha::Parsers::SourceAddress.detect_sub(provider_search.url).content
44
+ puts 'SUCCESS: content fetched'
45
+ r
46
+ rescue ::Aranha::Parsers::SourceAddress::FetchContentError => e
47
+ puts "ERROR: #{e.message}"
48
+ nil
49
+ end
50
+
51
+ def source_file
52
+ fixtures_dir.join("#{basename_file}.source.html")
53
+ end
54
+
55
+ def url_file
56
+ fixtures_dir.join("#{basename_file}.url")
57
+ end
58
+ end
59
+
60
+ class OriginalContentDownloads
61
+ SONG_METADATAS = [{
62
+ artist: 'Michael Jackson',
63
+ title: 'Thriller',
64
+ album: 'Thriller',
65
+ track: '4',
66
+ year: '1982'
67
+ }, {
68
+ artist: 'Milton Nascimento',
69
+ title: 'Rouxinol',
70
+ album: 'Nascimento',
71
+ track: '5',
72
+ year: '1997'
73
+ }].freeze
74
+
75
+ def run
76
+ downloads.each(&:run)
77
+ end
78
+
79
+ def downloads
80
+ song_metadatas.lazy.flat_map do |song_metadata|
81
+ providers.map { |provider| ::OriginalContentDownload.new(song_metadata, provider) }
82
+ end
83
+ end
84
+
85
+ def song_metadatas
86
+ SONG_METADATAS.map { |data| ::UltimateLyrics::SongMetadata.new(data) }
87
+ end
88
+
89
+ def providers
90
+ ::UltimateLyrics::Provider.all
91
+ end
92
+ end
93
+
94
+ ::OriginalContentDownloads.new.run
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UltimateLyrics
4
+ class Field
5
+ DATA = {
6
+ 'artist' => %w[artist lower],
7
+ 'artist2' => %w[artist lower nospace],
8
+ 'album' => %w[album lower],
9
+ 'album2' => %w[album lower nospace],
10
+ 'title' => %w[title lower],
11
+ 'Artist' => %w[artist],
12
+ 'Album' => %w[album],
13
+ 'ARTIST' => %w[artist upper],
14
+ 'year' => %w[year pretty],
15
+ 'Title' => %w[title],
16
+ 'Title2' => %w[title titlecase],
17
+ 'a' => %w[artist firstchar],
18
+ 'track' => %w[track number]
19
+ }.freeze
20
+
21
+ BEGIN_DELIMITER = '{'
22
+ END_DELIMITER = '}'
23
+
24
+ class << self
25
+ # @return [Array<UltimateLyrics::Field>]
26
+ def all
27
+ @all ||= DATA.map do |name, modifiers|
28
+ source_attr = modifiers.shift
29
+ new(name, source_attr, modifiers)
30
+ end
31
+ end
32
+
33
+ # @return [UltimateLyrics::Field]
34
+ def by_name(name)
35
+ all.find { |field| field.name == name } ||
36
+ raise("No field with name \"#{name}\" (Available: #{all.values})")
37
+ end
38
+
39
+ # @return [Array<UltimateLyrics::Field>]
40
+ def from_string(string)
41
+ names_from_string(string).map { |name| by_name(name) }
42
+ end
43
+
44
+ # @return [Array<String>]
45
+ def names_from_string(string)
46
+ string.scan(/#{::Regexp.quote(BEGIN_DELIMITER)}[^\}]+#{::Regexp.quote(END_DELIMITER)}/)
47
+ .map { |s| s.delimited_inner(BEGIN_DELIMITER, END_DELIMITER) }
48
+ end
49
+ end
50
+
51
+ common_constructor :name, :source_attribute, :modifiers
52
+
53
+ def apply(string, value)
54
+ string.gsub(apply_pattern, value)
55
+ end
56
+
57
+ def apply_pattern
58
+ /#{::Regexp.quote(BEGIN_DELIMITER)}#{::Regexp.quote(name)}#{::Regexp.quote(END_DELIMITER)}/
59
+ end
60
+
61
+ def value(value)
62
+ modifiers.inject(value.to_s) { |a, e| send(e, a) }
63
+ end
64
+
65
+ def to_s
66
+ name
67
+ end
68
+
69
+ private
70
+
71
+ def firstchar(string)
72
+ string[0]
73
+ end
74
+
75
+ def lower(string)
76
+ string.downcase
77
+ end
78
+
79
+ def nospace(string)
80
+ string.gsub(/\s/, '')
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module UltimateLyrics
6
+ class Lyrics
7
+ common_constructor :song_metadata, :provider_name, :text
8
+
9
+ def found?
10
+ text.present?
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module UltimateLyrics
6
+ class Parser
7
+ common_constructor :provider, :original_content
8
+
9
+ def original_content_invalid?
10
+ provider.invalid_indicators.any? { |v| original_content.include?(v) }
11
+ end
12
+
13
+ def result
14
+ return nil if original_content_invalid?
15
+
16
+ sanitize_text(provider.rules.inject(original_content) { |a, e| e.apply(a) })
17
+ end
18
+
19
+ def sanitize_text(text)
20
+ r = text.to_s.gsub("\t", ' ').gsub("\r", '').gsub(/ +/, ' ').gsub(/\n{2,}/m, "\n\n").strip
21
+ r.present? ? "#{r}\n" : nil
22
+ end
23
+
24
+ def url?
25
+ provider.extract_rules.any?(&:url?)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ultimate_lyrics/provider/item'
4
+
5
+ module UltimateLyrics
6
+ class Provider
7
+ class ExcludeItem < ::UltimateLyrics::Provider::Item
8
+ def apply_from_delimiters(source)
9
+ source.delimited_without_outer(begin_with, end_with)
10
+ end
11
+
12
+ def apply_from_tag(source)
13
+ source.delimited_without_outer(tag, "</#{tag_name}>")
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ultimate_lyrics/provider/item'
4
+
5
+ module UltimateLyrics
6
+ class Provider
7
+ class ExtractItem < ::UltimateLyrics::Provider::Item
8
+ def apply_from_delimiters(source)
9
+ source.delimited_inner(begin_with, end_with)
10
+ end
11
+
12
+ def apply_from_tag(source)
13
+ source.delimited_inner(tag, "</#{tag_name}>")
14
+ end
15
+
16
+ def apply_from_url(source)
17
+ url.gsub('{id}', source)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UltimateLyrics
4
+ class Provider
5
+ class Item
6
+ METHODS_ATTRIBUTES = { tag: :tag, begin_with: :begin, end_with: :end, url: :url }.freeze
7
+ TAG_NAME_PARSER = /<(\w+).*>/.to_parser { |m| m[1] }
8
+
9
+ common_constructor :rule, :node
10
+
11
+ METHODS_ATTRIBUTES.each do |method_name, attr|
12
+ define_method method_name do
13
+ ::CGI.unescapeHTML(node.attribute(attr.to_s).if_present('', &:text)).presence
14
+ end
15
+
16
+ define_method "#{method_name}?" do
17
+ send(method_name).present?
18
+ end
19
+ end
20
+
21
+ def delimiters?
22
+ begin_with? || end_with?
23
+ end
24
+
25
+ def apply(source)
26
+ %w[url tag delimiters].each do |m|
27
+ next unless send("#{m}?")
28
+
29
+ return send("apply_from_#{m}", source)
30
+ end
31
+
32
+ raise 'Invalid branch hit'
33
+ end
34
+
35
+ def tag_name
36
+ TAG_NAME_PARSER.parse(tag)
37
+ end
38
+
39
+ def to_s
40
+ self.class.name.demodulize + '[' + METHODS_ATTRIBUTES
41
+ .select { |m, _a| send(m).present? }
42
+ .map { |m, a| "#{a}: #{send(m)}" }
43
+ .join(', ') +
44
+ ']'
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UltimateLyrics
4
+ class Provider
5
+ class ReplaceFields
6
+ common_constructor :metadata, :source_string
7
+
8
+ def result
9
+ fields_found.inject(source_string) { |a, e| a.gsub("{#{e}}", metadata.send(e)) }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UltimateLyrics
4
+ class Provider
5
+ class Rule
6
+ common_constructor :node
7
+
8
+ def items
9
+ node.xpath('./item').map { |v| item_class.new(self, v) }
10
+ end
11
+
12
+ def item_class
13
+ ::UltimateLyrics::Provider.const_get(type.camelize + 'Item')
14
+ end
15
+
16
+ def apply(string)
17
+ url? ? apply_with_url(string) : apply_without_url(string)
18
+ end
19
+
20
+ def to_s
21
+ "Rule[#{type} | #{items.join(', ')}]"
22
+ end
23
+
24
+ def type
25
+ node.name
26
+ end
27
+
28
+ def url?
29
+ items.any?(&:url?)
30
+ end
31
+
32
+ private
33
+
34
+ def apply_without_url(string)
35
+ items.inject(string) { |a, e| e.apply(a) }
36
+ end
37
+
38
+ def apply_with_url(string)
39
+ url_item, id_item = url_items
40
+ id_item.apply(string).if_present { |v| url_item.apply(v) }
41
+ end
42
+
43
+ def url_items
44
+ raise "There is more than 2 items in #{rule}" if items.count != 2
45
+
46
+ url_item = items.find(&:url?) || raise("No URL item found in #{rule}")
47
+ id_item = items.find(&:delimiters?) || raise("No ID item found in #{rule}")
48
+ [url_item, id_item]
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UltimateLyrics
4
+ class Provider
5
+ class UrlFormat
6
+ common_constructor :node
7
+
8
+ def apply(value)
9
+ replace_chars.inject(value) { |a, e| a.gsub(e, with) }
10
+ end
11
+
12
+ def replace_chars
13
+ ::CGI.unescapeHTML(node.attribute('replace').text).each_char.to_a
14
+ end
15
+
16
+ def with
17
+ node.attribute('with').text
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'nokogiri'
5
+ require 'ultimate_lyrics/field'
6
+
7
+ module UltimateLyrics
8
+ class Provider
9
+ require_sub __FILE__
10
+
11
+ class << self
12
+ # @return [Array<UltimateLyrics::Provider>]
13
+ def all
14
+ @all ||= ::Nokogiri::XML(
15
+ ::File.new(::File.join(__dir__, 'providers_data.xml'))
16
+ ).xpath('/lyricproviders/provider').map { |node| new(node) }
17
+ end
18
+
19
+ # @return [UltimateLyrics::Provider]
20
+ def by_name(name)
21
+ by_attribute('name', name)
22
+ end
23
+
24
+ # @return [UltimateLyrics::Provider]
25
+ def by_identifier(identifier)
26
+ by_attribute('identifier', identifier)
27
+ end
28
+
29
+ # @return [UltimateLyrics::Provider]
30
+ def by_attribute(attribute, value)
31
+ all.find { |provider| provider.send(attribute) == value } ||
32
+ raise("No provider with name \"#{value}\" (Available: " +
33
+ all.map { |p| p.send(attrbute) }.join(', ') + ')')
34
+ end
35
+ end
36
+
37
+ common_constructor :node
38
+
39
+ def encoding
40
+ node.attribute('charset').text
41
+ end
42
+
43
+ def extract_rules
44
+ node.xpath('./extract').map do |v|
45
+ ::UltimateLyrics::Provider::Rule.new(v)
46
+ end
47
+ end
48
+
49
+ def exclude_rules
50
+ node.xpath('./exclude').map do |v|
51
+ ::UltimateLyrics::Provider::Rule.new(v)
52
+ end
53
+ end
54
+
55
+ def identifier
56
+ name.variableize
57
+ end
58
+
59
+ def invalid_indicators
60
+ node.xpath('/invalidIndicator/@value').map(&:text)
61
+ end
62
+
63
+ # @return [String]
64
+ def name
65
+ node.attribute('name').text
66
+ end
67
+
68
+ def rules
69
+ extract_rules + exclude_rules
70
+ end
71
+
72
+ # @return [String]
73
+ def url
74
+ node.attribute('url').text
75
+ end
76
+
77
+ # @return [Array<UltimateLyrics::Field>]
78
+ def url_fields
79
+ ::UltimateLyrics::Field.from_string(url)
80
+ end
81
+
82
+ def url_formats
83
+ node.xpath('./urlFormat').map do |v|
84
+ ::UltimateLyrics::Provider::UrlFormat.new(v)
85
+ end
86
+ end
87
+
88
+ def title
89
+ node.attribute('text').text
90
+ end
91
+
92
+ def to_s
93
+ name
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aranha/parsers/source_address'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'ultimate_lyrics/lyrics'
6
+ require 'ultimate_lyrics/parser'
7
+
8
+ module UltimateLyrics
9
+ class ProviderSearch
10
+ common_constructor :provider, :song_metadata
11
+
12
+ # @return [String]
13
+ def url
14
+ url_fields.inject(provider.url) { |a, e| e.apply(a) }
15
+ end
16
+
17
+ # @return []
18
+ def url_fields
19
+ provider.url_fields.map { |provider_url_field| song_metadata.field(provider_url_field) }
20
+ end
21
+
22
+ # @return [UltimateLyrics::Lyrics]
23
+ def lyrics
24
+ ::UltimateLyrics::Lyrics.new(song_metadata, provider.name, parser.result)
25
+ end
26
+
27
+ # @return [UltimateLyrics::Parser]
28
+ def lyrics_original_text
29
+ ::Aranha::Parsers::SourceAddress.detect_sub(url).content.force_encoding(provider.encoding)
30
+ rescue ::Aranha::Parsers::SourceAddress::FetchContentError
31
+ nil
32
+ end
33
+
34
+ # @return [UltimateLyrics::Parser]
35
+ def parser
36
+ ::UltimateLyrics::Parser.new(provider, lyrics_original_text)
37
+ end
38
+
39
+ def to_s
40
+ "ProviderSearch[#{provider} | #{song_metadata}]"
41
+ end
42
+ end
43
+ end