ehbrs_ruby_utils 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f0bf8ac8c8902aea1601e17b525b178db51cce6fbea9f205a64afb0b4f75c4d
4
- data.tar.gz: 64f23644c1f126638f5cde4ddb8adce6df449fb0cb5e6e148fc67ca1678e9cfe
3
+ metadata.gz: e525be69cfe63696e72dc2184618e53ab5d092cb330ea999a0cc7c1593b59a09
4
+ data.tar.gz: 3bc91b8b5660eef3fd427f3795f4c7191b4bc1f253cd6cbad4d84b59686997d0
5
5
  SHA512:
6
- metadata.gz: 37fabbe2868285dc7c616dd9682c0c129b8d107985f66e9b59abd88fbdfed81d463b55b2daa388ca65f142e0eb29beee8598a0cfa24d278624f802253d6edaa3
7
- data.tar.gz: e1cdb672ff5affda1cfc7e55b546dda9f79c64d61cee0ccc1a0c9df16c10e6090c8d6bf058acf7354db122c3e00083377a04d904e3062b03b5bfee90fd2952be
6
+ metadata.gz: 8dba5f9914093130cc606c99ed44e5dc88967dc7423cd8843d89111636ccd70d7a2570adfa087d5c6148347ffd03dfbc9efda4b107c88e7b1dac0fde2485f96b
7
+ data.tar.gz: 0dbfef1d8c97cc3179789d9fcc3c1dffcaad87154e697d5a04d514c2cdb737bbb4350702e3f9846cb8057f18238bf7907acfd073c1372097d77b63e04ab4507d
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Music
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.9.0'
4
+ VERSION = '0.10.0'
5
5
  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
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehbrs_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aranha-parsers
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.8.5
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.8'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.8.5
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: eac_ruby_utils
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +64,34 @@ dependencies:
44
64
  - - ">="
45
65
  - !ruby/object:Gem::Version
46
66
  version: 0.1.1
67
+ - !ruby/object:Gem::Dependency
68
+ name: taglib-ruby
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '1.1'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.1'
81
+ - !ruby/object:Gem::Dependency
82
+ name: ultimate_lyrics
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0.1'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '0.1'
47
95
  - !ruby/object:Gem::Dependency
48
96
  name: aranha-parsers
49
97
  requirement: !ruby/object:Gem::Requirement
@@ -83,6 +131,7 @@ files:
83
131
  - lib/ehbrs_ruby_utils.rb
84
132
  - lib/ehbrs_ruby_utils/executables.rb
85
133
  - lib/ehbrs_ruby_utils/finances/bb_browser/docker_image.rb
134
+ - lib/ehbrs_ruby_utils/music.rb
86
135
  - lib/ehbrs_ruby_utils/patches/object/template.rb
87
136
  - lib/ehbrs_ruby_utils/version.rb
88
137
  - lib/ehbrs_ruby_utils/videos.rb