ehbrs-tools 0.25.1 → 0.28.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +60 -22
- data/lib/ehbrs/{core_ext.rb → tools/core_ext.rb} +0 -0
- data/lib/ehbrs/tools/runner/finances/bb_browser.rb +1 -1
- data/lib/ehbrs/tools/runner/fs/selected.rb +19 -26
- data/lib/ehbrs/tools/runner/music/lyrics.rb +68 -0
- data/lib/ehbrs/tools/runner/music/lyrics_book.rb +41 -0
- data/lib/ehbrs/tools/runner/music/selected.rb +6 -6
- data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +1 -1
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/user_dirs.rb +2 -2
- data/lib/ehbrs/videos/extract/package.rb +2 -2
- data/lib/ehbrs/videos/extract/package_file.rb +0 -1
- data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +2 -1
- data/vendor/aranha-parsers/aranha-parsers.gemspec +1 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/rspec/setup.rb +1 -1
- data/vendor/aranha-parsers/lib/aranha/parsers/rspec/{source_target_fixtures_example.rb → shared_examples/source_target_fixtures.rb} +0 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/source_address/fetch_content_error.rb +10 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/source_address/http_get.rb +15 -2
- data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +9 -1
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +6 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +3 -3
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +6 -5
- data/vendor/eac_fs/Gemfile +5 -0
- data/vendor/eac_fs/eac_fs.gemspec +20 -0
- data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb → eac_fs/lib/eac_fs/cache.rb} +7 -2
- data/vendor/eac_fs/lib/eac_fs/file_info.rb +24 -0
- data/vendor/eac_fs/lib/eac_fs/patches/module/fs_cache.rb +10 -0
- data/vendor/eac_fs/lib/eac_fs/patches/module.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +10 -0
- data/vendor/eac_fs/lib/eac_fs/patches/object.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/patches/pathname/info.rb +12 -0
- data/vendor/eac_fs/lib/eac_fs/patches/pathname.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/patches.rb +4 -0
- data/vendor/eac_fs/lib/eac_fs/version.rb +5 -0
- data/vendor/eac_fs/lib/eac_fs.rb +7 -0
- 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
- data/vendor/eac_fs/spec/rubocop_spec.rb +3 -0
- data/vendor/eac_fs/spec/spec_helper.rb +4 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +2 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +3 -3
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +1 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +16 -7
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/Gemfile +5 -0
- data/vendor/eac_ruby_gems_utils/LICENCE +16 -0
- data/vendor/eac_ruby_gems_utils/README.rdoc +3 -0
- data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +30 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +33 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +41 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +97 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +58 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/minitest.rb +25 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +48 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +25 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +84 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb +21 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests.rb +9 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +5 -0
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils.rb +7 -0
- data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +3 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb +20 -0
- data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +4 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock +19 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/Rakefile +14 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/exe/myrunner +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem/version.rb +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/lib/mygem.rb +5 -0
- data/vendor/eac_ruby_gems_utils/spec/support/mygem/mygem.gemspec +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/compact.rb +22 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/compact.rb +20 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/delimited.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/string_delimited.rb +70 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/compact_spec.rb +20 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb +20 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/string/delimited_spec.rb +34 -0
- data/vendor/eac_templates/Gemfile +5 -0
- data/vendor/eac_templates/eac_templates.gemspec +19 -0
- data/vendor/eac_templates/lib/eac_templates/directory.rb +108 -0
- data/vendor/eac_templates/lib/eac_templates/file.rb +48 -0
- data/vendor/eac_templates/lib/eac_templates/patches/module/erb_template.rb +9 -0
- data/vendor/eac_templates/lib/eac_templates/patches/module/template.rb +10 -0
- data/vendor/eac_templates/lib/eac_templates/patches/module.rb +4 -0
- data/vendor/eac_templates/lib/eac_templates/patches/object/erb_template.rb +9 -0
- data/vendor/eac_templates/lib/eac_templates/patches/object/template.rb +9 -0
- data/vendor/eac_templates/lib/eac_templates/patches/object.rb +4 -0
- data/vendor/eac_templates/lib/eac_templates/patches.rb +4 -0
- data/vendor/eac_templates/lib/eac_templates/searcher.rb +53 -0
- data/vendor/eac_templates/lib/eac_templates/variable_not_found_error.rb +5 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/base.rb +21 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/config_reader.rb +27 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/entries_reader.rb +23 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/generic.rb +23 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers/hash.rb +27 -0
- data/vendor/eac_templates/lib/eac_templates/variable_providers.rb +23 -0
- data/vendor/eac_templates/lib/eac_templates/version.rb +5 -0
- data/vendor/eac_templates/lib/eac_templates.rb +7 -0
- data/vendor/eac_templates/spec/lib/eac_templates/file_spec.rb +35 -0
- data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/expected_content +2 -0
- data/vendor/eac_templates/spec/lib/eac_templates/file_spec_files/source.template +2 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec.rb +30 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file1.template +1 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path1/subdir1/file2 +1 -0
- data/vendor/eac_templates/spec/lib/eac_templates/searcher_spec_files/path2/subdir1/file3.template +1 -0
- data/vendor/eac_templates/spec/lib/object/template_spec.rb +23 -0
- data/vendor/eac_templates/spec/lib/object/template_spec_files/path/my_stub_with_template +1 -0
- data/vendor/eac_templates/spec/rubocop_spec.rb +3 -0
- data/vendor/eac_templates/spec/spec_helper.rb +4 -0
- data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +4 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/core_ext.rb +5 -0
- data/{lib/ehbrs → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils}/fs/compressed_package.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build.rb +41 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected/build_file.rb +27 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs/selected.rb +35 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/fs.rb +10 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/album.rb +42 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb +64 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book/song.rb +68 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music/lyrics_book.rb +65 -0
- data/{lib/ehbrs/fs.rb → vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/music.rb} +2 -2
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object.rb +4 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches.rb +4 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +31 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +1 -1
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/album/inner.html.erb +3 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/custom_style.css +15 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/index.html.erb +14 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/main.html.erb +24 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/resource/main.html.erb +8 -0
- data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/song/inner.html.erb +9 -0
- data/vendor/ultimate_lyrics/Gemfile +5 -0
- data/vendor/ultimate_lyrics/bin/download_parser_spec_files.rb +94 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/field.rb +83 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/lyrics.rb +13 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/parser.rb +28 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/exclude_item.rb +17 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/extract_item.rb +21 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/item.rb +48 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/replace_fields.rb +13 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/rule.rb +52 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider/url_format.rb +21 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider.rb +96 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/provider_search.rb +43 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/providers_data.xml +356 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata/field.rb +24 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/song_metadata.rb +28 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics/version.rb +5 -0
- data/vendor/ultimate_lyrics/lib/ultimate_lyrics.rb +7 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec.rb +20 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.source.html +8 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.source.html +8 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/encyclopaedia_metallum__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.source.html +193 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.source.html +193 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/hindilyrics_net_bollywood_songs__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.source.html +87 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.target.yaml +36 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.source.html +4 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyrics_com__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.source.html +2 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.source.html +2 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsplugin_com__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.source.html +101 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/lyricsreg_com__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.source.html +29 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.source.html +29 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/mp3lyrics_org__milton_nascimento_rouxinol.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.source.html +1301 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.target.yaml +3 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/parser_spec_files/songlyrics_com__michael_jackson_thriller.url +1 -0
- data/vendor/ultimate_lyrics/spec/lib/ultimate_lyrics/provider_search_spec.rb +72 -0
- data/vendor/ultimate_lyrics/spec/rubocop_spec.rb +3 -0
- data/vendor/ultimate_lyrics/spec/spec_helper.rb +4 -0
- data/vendor/ultimate_lyrics/ultimate_lyrics.gemspec +21 -0
- metadata +170 -13
- data/lib/ehbrs/patches/module/erb_template.rb +0 -11
- data/lib/ehbrs/patches/object/erb_template.rb +0 -9
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +0 -12
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Fs
|
7
|
+
class Selected
|
8
|
+
require_sub __FILE__
|
9
|
+
DEFAULT_FILENAME = '.selected'
|
10
|
+
|
11
|
+
enable_listable
|
12
|
+
enable_simple_cache
|
13
|
+
lists.add_symbol :option, :filename, :target_name_builder
|
14
|
+
common_constructor :root_path, :options, default: [{}] do
|
15
|
+
self.root_path = root_path.to_pathname
|
16
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def build(target_dir, &directory_target_basename)
|
20
|
+
::EhbrsRubyUtils::Fs::Selected::Build.new(self, target_dir, &directory_target_basename)
|
21
|
+
end
|
22
|
+
|
23
|
+
def filename
|
24
|
+
options[OPTION_FILENAME].if_present(DEFAULT_FILENAME)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# @return [Pathname]
|
30
|
+
def found_uncached
|
31
|
+
root_path.glob("**/#{filename}").map(&:parent).sort
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/music/lyrics_book/resource'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Music
|
8
|
+
class LyricsBook
|
9
|
+
class Album < ::EhbrsRubyUtils::Music::LyricsBook::Resource
|
10
|
+
enable_simple_cache
|
11
|
+
|
12
|
+
def book
|
13
|
+
parent
|
14
|
+
end
|
15
|
+
|
16
|
+
def first_previous
|
17
|
+
previous.if_present { |v| v.songs.last }
|
18
|
+
end
|
19
|
+
|
20
|
+
def valid?
|
21
|
+
songs.any?
|
22
|
+
end
|
23
|
+
|
24
|
+
def header_title
|
25
|
+
"#{songs.first.number}-#{songs.last.number} | #{artist} | #{title}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def artist
|
29
|
+
songs.lazy.map { |v| v.tag.artist }.find(&:present?)
|
30
|
+
end
|
31
|
+
|
32
|
+
def title
|
33
|
+
songs.lazy.map { |v| v.tag.album }.find(&:present?)
|
34
|
+
end
|
35
|
+
|
36
|
+
def songs_uncached
|
37
|
+
::EhbrsRubyUtils::Music::LyricsBook::Song.create_list(self, path.children)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Music
|
7
|
+
class LyricsBook
|
8
|
+
class Resource
|
9
|
+
class << self
|
10
|
+
def create_list(parent, files)
|
11
|
+
r = files.sort.map { |path| new(parent, path) }.select(&:valid?)
|
12
|
+
previous = parent.first_previous
|
13
|
+
r.map do |e|
|
14
|
+
e.reset_cache
|
15
|
+
e.previous = previous
|
16
|
+
previous = e
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
enable_simple_cache
|
22
|
+
include ::Comparable
|
23
|
+
common_constructor :parent, :path
|
24
|
+
attr_accessor :previous
|
25
|
+
|
26
|
+
def filename
|
27
|
+
path.relative_path_from(parent.path)
|
28
|
+
end
|
29
|
+
|
30
|
+
def <=>(other)
|
31
|
+
path <=> other.path
|
32
|
+
end
|
33
|
+
|
34
|
+
def link_to_header
|
35
|
+
"<a href=\"\##{header_id}\" id=\"#{index_id}\">#{header_title}</a>"
|
36
|
+
end
|
37
|
+
|
38
|
+
def index_id
|
39
|
+
"index_#{header_id}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def header_id
|
43
|
+
header_title.variableize
|
44
|
+
end
|
45
|
+
|
46
|
+
def header_index
|
47
|
+
parent.header_index + 1
|
48
|
+
end
|
49
|
+
|
50
|
+
def output_main
|
51
|
+
::EhbrsRubyUtils::Music::LyricsBook::Resource.erb_template('main.html.erb', binding)
|
52
|
+
end
|
53
|
+
|
54
|
+
def output_index
|
55
|
+
erb_template('index.html.erb')
|
56
|
+
end
|
57
|
+
|
58
|
+
def type
|
59
|
+
self.class.name.demodulize.underscore
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/music/lyrics_book/resource'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Music
|
8
|
+
class LyricsBook
|
9
|
+
class Song < ::EhbrsRubyUtils::Music::LyricsBook::Resource
|
10
|
+
enable_simple_cache
|
11
|
+
delegate :book, to: :album
|
12
|
+
delegate :provider, to: :book
|
13
|
+
delegate :tag, :to_s, to: :container
|
14
|
+
|
15
|
+
def album
|
16
|
+
parent
|
17
|
+
end
|
18
|
+
|
19
|
+
def lyrics
|
20
|
+
fetch_lyrics unless lyrics_cached?
|
21
|
+
cached_lyrics
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid?
|
25
|
+
tag.present?
|
26
|
+
end
|
27
|
+
|
28
|
+
def lyrics_cached?
|
29
|
+
lyrics_cache.cached?
|
30
|
+
end
|
31
|
+
|
32
|
+
def cached_lyrics
|
33
|
+
::YAML.load_file(lyrics_cache.content_path)
|
34
|
+
end
|
35
|
+
|
36
|
+
def header_title
|
37
|
+
"#{number} - #{title}"
|
38
|
+
end
|
39
|
+
|
40
|
+
delegate :title, to: :tag
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def container_uncached
|
45
|
+
::EhbrsRubyUtils::Videos::Container.new(path)
|
46
|
+
end
|
47
|
+
|
48
|
+
def fetch_lyrics
|
49
|
+
lyrics = fetched_lyrics
|
50
|
+
lyrics_cache.write(lyrics.to_yaml)
|
51
|
+
end
|
52
|
+
|
53
|
+
def fetched_lyrics
|
54
|
+
container.lyrics_by_provider(provider)
|
55
|
+
end
|
56
|
+
|
57
|
+
def lyrics_cache
|
58
|
+
(%w[artist album title].map { |k| tag.send(k) } + [provider.identifier])
|
59
|
+
.inject(fs_cache) { |a, e| a.child(e) }
|
60
|
+
end
|
61
|
+
|
62
|
+
def number_uncached
|
63
|
+
previous.if_present(0, &:number) + 1
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Music
|
7
|
+
class LyricsBook
|
8
|
+
require_sub __FILE__
|
9
|
+
|
10
|
+
DEFAULT_PROVIDER_NAME = 'lyrics.com'
|
11
|
+
DEFAULT_TITLE = 'Letras de músicas'
|
12
|
+
|
13
|
+
enable_listable
|
14
|
+
lists.add_symbol :option, :provider_name, :title
|
15
|
+
enable_simple_cache
|
16
|
+
common_constructor :source_dir, :options, default: [{}] do
|
17
|
+
self.source_dir = source_dir.to_pathname
|
18
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def first_previous
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def header_index
|
26
|
+
1
|
27
|
+
end
|
28
|
+
|
29
|
+
def output
|
30
|
+
erb_template('main.html.erb')
|
31
|
+
end
|
32
|
+
|
33
|
+
def path
|
34
|
+
source_dir
|
35
|
+
end
|
36
|
+
|
37
|
+
def title
|
38
|
+
options[OPTION_TITLE].if_present(DEFAULT_TITLE)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def albums_directories_uncached
|
44
|
+
r = []
|
45
|
+
t = ::EacRubyUtils::Fs::Traverser.new
|
46
|
+
t.recursive = true
|
47
|
+
t.check_directory = ->(directory) { r << directory }
|
48
|
+
t.check_path(source_dir)
|
49
|
+
r
|
50
|
+
end
|
51
|
+
|
52
|
+
def albums_uncached
|
53
|
+
::EhbrsRubyUtils::Music::LyricsBook::Album.create_list(self, albums_directories)
|
54
|
+
end
|
55
|
+
|
56
|
+
def provider_uncached
|
57
|
+
::UltimateLyrics::Provider.by_name(provider_name)
|
58
|
+
end
|
59
|
+
|
60
|
+
def provider_name
|
61
|
+
options[OPTION_PROVIDER_NAME].if_present(DEFAULT_PROVIDER_NAME)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -4,23 +4,49 @@ require 'eac_ruby_utils/core_ext'
|
|
4
4
|
require 'ehbrs_ruby_utils/executables'
|
5
5
|
require 'ehbrs_ruby_utils/videos/stream'
|
6
6
|
require 'json'
|
7
|
+
require 'taglib'
|
8
|
+
require 'ultimate_lyrics/provider_search'
|
9
|
+
require 'ultimate_lyrics/song_metadata'
|
7
10
|
|
8
11
|
module EhbrsRubyUtils
|
9
12
|
module Videos
|
10
13
|
class Container
|
14
|
+
class << self
|
15
|
+
def from_file(path)
|
16
|
+
new(path)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
11
20
|
enable_simple_cache
|
12
21
|
common_constructor :path do
|
13
22
|
self.path = path.to_pathname
|
14
23
|
end
|
15
24
|
|
25
|
+
delegate :tag, to: :tag_file
|
26
|
+
delegate :to_s, to: :path
|
27
|
+
|
16
28
|
::EhbrsRubyUtils::Videos::Stream.lists.codec_type.each_value do |stream_type|
|
17
29
|
define_method stream_type.to_s.pluralize do
|
18
30
|
streams.select { |stream| stream.codec_type == stream_type }
|
19
31
|
end
|
20
32
|
end
|
21
33
|
|
34
|
+
# @param provider [UltimateLyrics::Provider]
|
35
|
+
# @return [UltimateLyrics::Lyrics]
|
36
|
+
def lyrics_by_provider(provider)
|
37
|
+
::UltimateLyrics::ProviderSearch.new(provider, song_metadata).lyrics
|
38
|
+
end
|
39
|
+
|
22
40
|
private
|
23
41
|
|
42
|
+
# @return [UltimateLyrics::SongMetadata]
|
43
|
+
def song_metadata_uncached
|
44
|
+
::UltimateLyrics::SongMetadata.new(
|
45
|
+
::UltimateLyrics::SongMetadata::Field.lists.sources.values
|
46
|
+
.map { |source| [source, tag.send(source)] }.to_h
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
24
50
|
def probe_data_uncached
|
25
51
|
::JSON.parse(
|
26
52
|
::EhbrsRubyUtils::Executables.ffprobe.command(
|
@@ -34,6 +60,11 @@ module EhbrsRubyUtils
|
|
34
60
|
::EhbrsRubyUtils::Videos::Stream.new(stream_ffprobe_data)
|
35
61
|
end
|
36
62
|
end
|
63
|
+
|
64
|
+
# @return [TagLib::FileRef]
|
65
|
+
def tag_file_uncached
|
66
|
+
::TagLib::FileRef.new(path.to_path)
|
67
|
+
end
|
37
68
|
end
|
38
69
|
end
|
39
70
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= title %></title>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
9
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
|
10
|
+
<style>
|
11
|
+
<%= template.child('custom_style.css').content %>
|
12
|
+
</style>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div class="container" >
|
16
|
+
<h1><%= title %></h1>
|
17
|
+
<h2>Índice</h2>
|
18
|
+
<%= erb_template('index.html.erb') %>
|
19
|
+
<% albums.each do |album| %>
|
20
|
+
<%= album.output_main %>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
</body>
|
24
|
+
</html>
|
data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/music/lyrics_book/resource/main.html.erb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="<%= type %>">
|
2
|
+
<h<%= header_index %> id='<%= header_id %>' >
|
3
|
+
<%= header_title %>
|
4
|
+
<a href="#<%= index_id %>" ><i class="bi-arrow-up-circle-fill"></i></a>
|
5
|
+
</h<%= header_index %>>
|
6
|
+
<span class="filename"><%= filename %></span>
|
7
|
+
<%= erb_template('inner.html.erb') %>
|
8
|
+
</div>
|
@@ -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
|