ehbrs_ruby_utils 0.37.0 → 0.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs_ruby_utils/bga/game.rb +1 -1
- data/lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_content.rb +47 -0
- data/lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_title.rb +32 -0
- data/lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb +80 -0
- data/lib/ehbrs_ruby_utils/bga/game_statistics.rb +13 -0
- data/lib/ehbrs_ruby_utils/bga/player.rb +18 -0
- data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base/format_option.rb +3 -1
- data/lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb +15 -20
- data/lib/ehbrs_ruby_utils/bga/table.rb +25 -1
- data/lib/ehbrs_ruby_utils/bga/whatsapp_formatter/option.rb +31 -0
- data/lib/ehbrs_ruby_utils/bga/whatsapp_formatter.rb +72 -0
- data/lib/ehbrs_ruby_utils/executables.rb +2 -1
- data/lib/ehbrs_ruby_utils/fs/iso_9660_file.rb +32 -0
- data/lib/ehbrs_ruby_utils/gjt1/manager.rb +19 -3
- data/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb +45 -0
- data/lib/ehbrs_ruby_utils/vg/ps2.rb +11 -0
- data/lib/ehbrs_ruby_utils/videos/series/rename/results_builder.rb +1 -1
- metadata +34 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz: '
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '089b6f1fa3dd8f8ce4ba9414e089d522d2e9eaaf78f6a6004c323c31392639aa'
|
4
|
+
data.tar.gz: 811149efacf1d16ce127eb68acc18ce078c4ea066276d321e0c176590690be06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d4dab607225cf32244eabd21352ca551251ddd41bc789a46dc6bab10d2d298371d3dcb727acb2c1defb299409f1ccda2adf43f7213529d48267bd5cd636d815
|
7
|
+
data.tar.gz: 8fb1e6240cd3985f8b78b6932d778578dc3e88777561eb0f26bdc168195450ebaf1b3859a04f943558474cd7645baa483fbe9837d5ffa05cee93bc25375fb8e0
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Bga
|
7
|
+
class GameStatistics
|
8
|
+
class WhatsappFormatter
|
9
|
+
class PlayerContent
|
10
|
+
acts_as_instance_method
|
11
|
+
common_constructor :formatter, :player
|
12
|
+
|
13
|
+
# @return [Hash<String, String>]
|
14
|
+
def result
|
15
|
+
formatter.ranks.to_h do |rank|
|
16
|
+
[rank_label(rank), rank_value(rank)]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# @param rank [Integer]
|
21
|
+
# @return [String]
|
22
|
+
def rank_label(rank)
|
23
|
+
"#{rank}º"
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param rank [Integer]
|
27
|
+
# @return [String]
|
28
|
+
def rank_value(rank)
|
29
|
+
count = 0
|
30
|
+
formatter.normal_tables.each do |table|
|
31
|
+
count += 1 if table.player_by_id(player.id).if_present(false) do |v|
|
32
|
+
v.rank == rank
|
33
|
+
end
|
34
|
+
end
|
35
|
+
"#{count} (#{rank_percent(count)}%)"
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param count [Integer]
|
39
|
+
# @return [String]
|
40
|
+
def rank_percent(count)
|
41
|
+
(count * 100 / formatter.normal_tables.count).round
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Bga
|
7
|
+
class GameStatistics
|
8
|
+
class WhatsappFormatter
|
9
|
+
class PlayerTitle
|
10
|
+
acts_as_instance_method
|
11
|
+
common_constructor :formatter, :player
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
def result
|
15
|
+
username_by_tables || player.name
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [String, nil]
|
19
|
+
def username_by_tables
|
20
|
+
formatter.game_tables.lazy.map { |table| username_by_table(table) }.find(&:present?)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param table [EhbrsRubyUtils::Bga::Table]
|
24
|
+
# @return [String, nil]
|
25
|
+
def username_by_table(table)
|
26
|
+
table.player_by_id(player.id).if_present(&:name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/bga/whatsapp_formatter'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Bga
|
8
|
+
class GameStatistics
|
9
|
+
class WhatsappFormatter
|
10
|
+
include ::EhbrsRubyUtils::Bga::WhatsappFormatter
|
11
|
+
|
12
|
+
ROOT_TITLE = 'Estatísticas'
|
13
|
+
TITLE_ICON = 0x1F4CA.chr(::Encoding::UTF_8)
|
14
|
+
|
15
|
+
enable_simple_cache
|
16
|
+
common_constructor :game_statistics
|
17
|
+
delegate :game, :game_tables, :players, :until_table, to: :game_statistics
|
18
|
+
|
19
|
+
# @return [Integer]
|
20
|
+
def friendly_tables_count
|
21
|
+
game_tables.count - normal_tables.count
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [Hash]
|
25
|
+
def root_content
|
26
|
+
r = { 'Jogo' => game.name, 'Mesas normais' => normal_tables.count,
|
27
|
+
'Mesas amigáveis' => friendly_tables_count }
|
28
|
+
until_table.if_present { |v| r['Após mesa'] = v.url }
|
29
|
+
r
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Hash<String, String>] "title" => "content"
|
33
|
+
def sections
|
34
|
+
r = { ROOT_TITLE => root_content }
|
35
|
+
players.each do |player|
|
36
|
+
r[player_title(player)] = player_content(player)
|
37
|
+
end
|
38
|
+
r
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String]
|
42
|
+
def title_icon
|
43
|
+
TITLE_ICON
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
# @return [Enumerable<EhbrsRubyUtils::Bga::Table>]
|
49
|
+
def normal_tables_uncached
|
50
|
+
with_players_tables.reject(&:friendly?)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param table [EhbrsRubyUtils::Bga::Table]
|
54
|
+
# @return [Boolean]
|
55
|
+
def with_players_table?(table)
|
56
|
+
table.players.count == players.count &&
|
57
|
+
players.all? { |player| table.player_by_id(player.id).present? }
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [Enumerable<EhbrsRubyUtils::Bga::Table>]
|
61
|
+
def with_players_tables_uncached
|
62
|
+
game_tables.select { |table| with_players_table?(table) }
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return [Array<Integer>]
|
66
|
+
def ranks_uncached
|
67
|
+
r = ::Set.new
|
68
|
+
normal_tables.each do |table|
|
69
|
+
table.players.each do |player|
|
70
|
+
r.add(player.rank)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
r.sort
|
74
|
+
end
|
75
|
+
|
76
|
+
require_sub __FILE__, require_mode: :kernel
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Bga
|
7
|
+
class GameStatistics
|
8
|
+
common_constructor :game, :game_tables, :players, :until_table, default: [nil]
|
9
|
+
|
10
|
+
require_sub __FILE__
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/bga/parsers/table/active_players'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Bga
|
8
|
+
class Player
|
9
|
+
common_constructor :data
|
10
|
+
|
11
|
+
::EhbrsRubyUtils::Bga::Parsers::Table::ActivePlayers.fields.map(&:name).each do |field|
|
12
|
+
define_method field do
|
13
|
+
data.fetch(field)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/bga/whatsapp_formatter/option'
|
4
5
|
|
5
6
|
module EhbrsRubyUtils
|
6
7
|
module Bga
|
@@ -11,8 +12,9 @@ module EhbrsRubyUtils
|
|
11
12
|
acts_as_instance_method
|
12
13
|
common_constructor :table_formatter, :option
|
13
14
|
|
15
|
+
# @return [String]
|
14
16
|
def result
|
15
|
-
|
17
|
+
::EhbrsRubyUtils::Bga::WhatsappFormatter::Option.assert(option).to_s
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -1,13 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/bga/whatsapp_formatter'
|
4
5
|
|
5
6
|
module EhbrsRubyUtils
|
6
7
|
module Bga
|
7
8
|
class Table
|
8
9
|
module WhatsappFormatters
|
9
10
|
class Base
|
10
|
-
|
11
|
+
include ::EhbrsRubyUtils::Bga::WhatsappFormatter
|
12
|
+
acts_as_abstract :players_title, :root_items_title
|
11
13
|
enable_simple_cache
|
12
14
|
common_constructor :table
|
13
15
|
|
@@ -18,24 +20,21 @@ module EhbrsRubyUtils
|
|
18
20
|
'Duração' => :estimated_duration,
|
19
21
|
'Endereço' => :url
|
20
22
|
}.freeze
|
21
|
-
SECTION_SEPARATOR = "\n\n"
|
22
23
|
|
23
|
-
|
24
|
-
def image_local_path
|
25
|
-
table.game.box_large_image.local_path
|
26
|
-
end
|
27
|
-
|
28
|
-
def to_s
|
29
|
-
[root_items_to_s, players_to_s, options_to_s].map(&:strip).join(SECTION_SEPARATOR)
|
30
|
-
end
|
24
|
+
delegate :game, to: :table
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
# @return [Hash<String, String>] "title" => "content"
|
27
|
+
def sections
|
28
|
+
{
|
29
|
+
root_items_title => root_items,
|
30
|
+
players_title => players_to_s,
|
31
|
+
'Opções' => options
|
32
|
+
}
|
35
33
|
end
|
36
34
|
|
37
|
-
|
38
|
-
|
35
|
+
# @return [Hash]
|
36
|
+
def root_items
|
37
|
+
ROOT_ITENS.transform_values { |v| table.send(v) }
|
39
38
|
end
|
40
39
|
|
41
40
|
# @return [String]
|
@@ -45,11 +44,7 @@ module EhbrsRubyUtils
|
|
45
44
|
|
46
45
|
# @return [String]
|
47
46
|
def players_to_s
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def title_to_s(title)
|
52
|
-
"*#{[title_icon, title, title_icon].join(' ')}*\n\n"
|
47
|
+
players_extra + players.join("\n")
|
53
48
|
end
|
54
49
|
|
55
50
|
def players
|
@@ -13,6 +13,9 @@ module EhbrsRubyUtils
|
|
13
13
|
enable_simple_cache
|
14
14
|
common_constructor :data
|
15
15
|
|
16
|
+
GAME_MODE_KEY = 'Modo de Jogo'
|
17
|
+
GAME_MODE_FRIENDLY_VALUE = 'Modo Amigável'
|
18
|
+
GAME_MODE_NORMAL_VALUE = 'Modo Normal'
|
16
19
|
SET_ITEMS = %i[options players].freeze
|
17
20
|
|
18
21
|
([:id] + ::EhbrsRubyUtils::Bga::Parsers::Table.fields.map(&:name) - SET_ITEMS)
|
@@ -22,11 +25,32 @@ module EhbrsRubyUtils
|
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
28
|
+
# @return [Boolean]
|
29
|
+
def friendly?
|
30
|
+
value = option_value(GAME_MODE_KEY)
|
31
|
+
return true if value == GAME_MODE_FRIENDLY_VALUE
|
32
|
+
return false if value == GAME_MODE_NORMAL_VALUE
|
33
|
+
|
34
|
+
raise "Unknown \"#{GAME_MODE_KEY}\" value: \"#{value}\""
|
35
|
+
end
|
36
|
+
|
25
37
|
# @return [Boolean]
|
26
38
|
def game_conceded?
|
27
39
|
game_conceded
|
28
40
|
end
|
29
41
|
|
42
|
+
# @param key [String]
|
43
|
+
# @return [String, nil]
|
44
|
+
def option_value(label)
|
45
|
+
options.find { |o| o.label == label }.if_present(&:value)
|
46
|
+
end
|
47
|
+
|
48
|
+
# @param id [Integer]
|
49
|
+
# @return [EhbrsRubyUtils::Bga::Table::Player, nil]
|
50
|
+
def player_by_id(id)
|
51
|
+
players.find { |p| p.id.to_s == id.to_s }
|
52
|
+
end
|
53
|
+
|
30
54
|
# @return [Addressable::URI]
|
31
55
|
def url
|
32
56
|
table_url(id)
|
@@ -36,7 +60,7 @@ module EhbrsRubyUtils
|
|
36
60
|
|
37
61
|
# @return [EhbrsRubyUtils::Bga::Game]
|
38
62
|
def game_uncached
|
39
|
-
::EhbrsRubyUtils::Bga::Game.new(game_code)
|
63
|
+
::EhbrsRubyUtils::Bga::Game.new(game_code, game_name)
|
40
64
|
end
|
41
65
|
|
42
66
|
SET_ITEMS.each do |item|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Bga
|
7
|
+
module WhatsappFormatter
|
8
|
+
class Option
|
9
|
+
class << self
|
10
|
+
# @param obj [Object]
|
11
|
+
# @return [EhbrsRubyUtils::Bga::WhatsappFormatter::Option]
|
12
|
+
def assert(obj)
|
13
|
+
return obj if obj.is_a?(self)
|
14
|
+
return new(obj.label, obj.value) if obj.respond_to?(:label) && obj.respond_to?(:value)
|
15
|
+
return new(obj.fetch(:label), obj.fetch(:value)) if obj.is_a?(::Hash)
|
16
|
+
return new(*obj) if obj.is_a?(::Enumerable)
|
17
|
+
|
18
|
+
raise(::ArgumentError, "\"#{obj}\" não pôde ser convertido para #{self}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
common_constructor :label, :value
|
23
|
+
|
24
|
+
# @return [String]
|
25
|
+
def to_s
|
26
|
+
"*#{label}:* #{value}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Bga
|
7
|
+
module WhatsappFormatter
|
8
|
+
common_concern do
|
9
|
+
acts_as_abstract
|
10
|
+
end
|
11
|
+
|
12
|
+
LINE_SEPARATOR = "\n"
|
13
|
+
OPTION_SEPARATOR = LINE_SEPARATOR
|
14
|
+
SECTION_SEPARATOR = "#{LINE_SEPARATOR}#{LINE_SEPARATOR}"
|
15
|
+
|
16
|
+
# @param content [String, Enumerable]
|
17
|
+
# @return [String]
|
18
|
+
def content_to_s(content)
|
19
|
+
if content.is_a?(::Hash)
|
20
|
+
content_to_s(
|
21
|
+
content.map { |k, v| ::EhbrsRubyUtils::Bga::WhatsappFormatter::Option.new(k, v) }
|
22
|
+
)
|
23
|
+
elsif content.is_a?(::Enumerable)
|
24
|
+
content.to_a.join(OPTION_SEPARATOR)
|
25
|
+
else
|
26
|
+
content.to_s
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [EhbrsRubyUtils::Bga::Game]
|
31
|
+
def game
|
32
|
+
raise_abstract_method __method__
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Pathname]
|
36
|
+
def image_local_path
|
37
|
+
game.box_large_image.local_path
|
38
|
+
end
|
39
|
+
|
40
|
+
# @param options [Enumerable<EhbrsRubyUtils::Bga::WhatsappFormatters::Option>]
|
41
|
+
# @return [String]
|
42
|
+
def options_to_s(options)
|
43
|
+
options.map { |o| "#{o}#{OPTION_SEPARATOR}" }
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param title {String]
|
47
|
+
# @param content {String]
|
48
|
+
# @return [String]
|
49
|
+
def section_to_s(title, content)
|
50
|
+
[title_to_s(title), content_to_s(content)].map(&:strip).join(SECTION_SEPARATOR)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [Hash<String, String>] "title" => "content"
|
54
|
+
def sections
|
55
|
+
raise_abstract_method __method__
|
56
|
+
end
|
57
|
+
|
58
|
+
# @return [String]
|
59
|
+
def title_icon
|
60
|
+
raise_abstract_method __method__
|
61
|
+
end
|
62
|
+
|
63
|
+
def to_s
|
64
|
+
sections.map { |title, content| section_to_s(title, content) }.join(SECTION_SEPARATOR)
|
65
|
+
end
|
66
|
+
|
67
|
+
def title_to_s(title)
|
68
|
+
"*#{[title_icon, title, title_icon].join(' ')}*"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -17,7 +17,8 @@ module EhbrsRubyUtils
|
|
17
17
|
{
|
18
18
|
'-?' => %w[rar],
|
19
19
|
'-h' => %w[unzip],
|
20
|
-
'-version' => %w[ffmpeg ffprobe
|
20
|
+
'-version' => %w[ffmpeg ffprobe],
|
21
|
+
'--version' => %w[isoinfo tar wit]
|
21
22
|
}.each do |validate_arg, commands|
|
22
23
|
commands.each do |command|
|
23
24
|
define_method("#{command}_uncached") do
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/executables'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Fs
|
8
|
+
class Iso9660File
|
9
|
+
DEFAULT_EXTNAME = '.iso'
|
10
|
+
|
11
|
+
common_constructor :path do
|
12
|
+
self.path = path.to_pathname
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Array<String>]
|
16
|
+
def list
|
17
|
+
isoinfo_command('-f').execute!.each_line
|
18
|
+
end
|
19
|
+
|
20
|
+
# @param command_args [Array<String>]
|
21
|
+
# @return [EacRubyUtils::Envs::Command]
|
22
|
+
def isoinfo_command(*command_args)
|
23
|
+
::EacRubyUtils::Envs.local.command('isoinfo', '-i', path, *command_args)
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Boolean]
|
27
|
+
def valid?
|
28
|
+
isoinfo_command.execute.fetch(:exit_code).zero?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ehbrs_ruby_utils/bga/session'
|
4
|
+
require 'ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter'
|
4
5
|
require 'ehbrs_ruby_utils/executables'
|
5
6
|
require 'ehbrs_ruby_utils/mudslide/message'
|
6
7
|
require 'eac_ruby_utils/core_ext'
|
@@ -15,12 +16,21 @@ module EhbrsRubyUtils
|
|
15
16
|
# @param table [EhbrsRubyUtils::Bga::Table]
|
16
17
|
# @return [void]
|
17
18
|
define_method "bga_table_#{type}_notify" do |table|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
whatsapp_formatter_send(
|
20
|
+
::EhbrsRubyUtils::Bga::Table::WhatsappFormatters.const_get(type.camelize),
|
21
|
+
table
|
22
|
+
)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
26
|
+
# @param game_statistics [EhbrsRubyUtils::Bga::GameStatistics]
|
27
|
+
# @return [void]
|
28
|
+
def bga_game_statistics_notify(game_statistics)
|
29
|
+
whatsapp_formatter_send(
|
30
|
+
::EhbrsRubyUtils::Bga::GameStatistics::WhatsappFormatter, game_statistics
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
24
34
|
def on_bga_logged_session(&block)
|
25
35
|
bga_session = new_bga_session
|
26
36
|
begin
|
@@ -49,6 +59,12 @@ module EhbrsRubyUtils
|
|
49
59
|
def mudslide_run(*args)
|
50
60
|
::EhbrsRubyUtils::Executables.mudslide.command(*args).system!
|
51
61
|
end
|
62
|
+
|
63
|
+
# @return [void]
|
64
|
+
def whatsapp_formatter_send(formatter_class, formatter_owner)
|
65
|
+
formatter = formatter_class.new(formatter_owner)
|
66
|
+
whatsapp_send(formatter.to_s, formatter.image_local_path)
|
67
|
+
end
|
52
68
|
end
|
53
69
|
end
|
54
70
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/fs/iso_9660_file'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Vg
|
8
|
+
module Ps2
|
9
|
+
class IsoFile < ::EhbrsRubyUtils::Fs::Iso9660File
|
10
|
+
CODE_PATTERN = /[a-zA-Z]{4}_[0-9]{3}\.[0-9]{2}/.freeze
|
11
|
+
CODE_PARSER = CODE_PATTERN.to_parser(&:to_s)
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
def code
|
15
|
+
list.lazy.map { |line| CODE_PARSER.parse(line) }.find(&:present?)
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [String]
|
19
|
+
def basename_nocode_noext
|
20
|
+
path.basename_noext.to_path.gsub(/\A#{::Regexp.quote(code)}/, '')
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Path]
|
24
|
+
def target_path
|
25
|
+
path.basename_sub do |_b|
|
26
|
+
"#{code}.#{path_basename}#{DEFAULT_EXTNAME}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Boolean]
|
31
|
+
def valid?
|
32
|
+
super && code.present?
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
# @return [String]
|
38
|
+
def path_basename
|
39
|
+
path.basename_noext.to_path.gsub(/\A#{::Regexp.quote(code)}/, '')
|
40
|
+
.gsub(/[^0-9a-zA-Z]+/, '_').gsub(/\A_+/, '').gsub(/_+\z/, '')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehbrs_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.39.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:
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha
|
@@ -36,42 +36,48 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.22'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.22'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: aranha-selenium
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.8'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
60
|
+
version: '0.8'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: avm
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
67
|
+
version: '0.84'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.84.2
|
68
71
|
type: :runtime
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
71
74
|
requirements:
|
72
75
|
- - "~>"
|
73
76
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0.
|
77
|
+
version: '0.84'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 0.84.2
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: dentaku
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +87,7 @@ dependencies:
|
|
81
87
|
version: '3.5'
|
82
88
|
- - ">="
|
83
89
|
- !ruby/object:Gem::Version
|
84
|
-
version: 3.5.
|
90
|
+
version: 3.5.2
|
85
91
|
type: :runtime
|
86
92
|
prerelease: false
|
87
93
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -91,55 +97,49 @@ dependencies:
|
|
91
97
|
version: '3.5'
|
92
98
|
- - ">="
|
93
99
|
- !ruby/object:Gem::Version
|
94
|
-
version: 3.5.
|
100
|
+
version: 3.5.2
|
95
101
|
- !ruby/object:Gem::Dependency
|
96
102
|
name: eac_fs
|
97
103
|
requirement: !ruby/object:Gem::Requirement
|
98
104
|
requirements:
|
99
105
|
- - "~>"
|
100
106
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0.
|
107
|
+
version: '0.17'
|
102
108
|
type: :runtime
|
103
109
|
prerelease: false
|
104
110
|
version_requirements: !ruby/object:Gem::Requirement
|
105
111
|
requirements:
|
106
112
|
- - "~>"
|
107
113
|
- !ruby/object:Gem::Version
|
108
|
-
version: '0.
|
114
|
+
version: '0.17'
|
109
115
|
- !ruby/object:Gem::Dependency
|
110
116
|
name: eac_rest
|
111
117
|
requirement: !ruby/object:Gem::Requirement
|
112
118
|
requirements:
|
113
119
|
- - "~>"
|
114
120
|
- !ruby/object:Gem::Version
|
115
|
-
version: '0.
|
121
|
+
version: '0.12'
|
116
122
|
type: :runtime
|
117
123
|
prerelease: false
|
118
124
|
version_requirements: !ruby/object:Gem::Requirement
|
119
125
|
requirements:
|
120
126
|
- - "~>"
|
121
127
|
- !ruby/object:Gem::Version
|
122
|
-
version: '0.
|
128
|
+
version: '0.12'
|
123
129
|
- !ruby/object:Gem::Dependency
|
124
130
|
name: eac_ruby_utils
|
125
131
|
requirement: !ruby/object:Gem::Requirement
|
126
132
|
requirements:
|
127
133
|
- - "~>"
|
128
134
|
- !ruby/object:Gem::Version
|
129
|
-
version: '0.
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: 0.119.2
|
135
|
+
version: '0.120'
|
133
136
|
type: :runtime
|
134
137
|
prerelease: false
|
135
138
|
version_requirements: !ruby/object:Gem::Requirement
|
136
139
|
requirements:
|
137
140
|
- - "~>"
|
138
141
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0.
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version: 0.119.2
|
142
|
+
version: '0.120'
|
143
143
|
- !ruby/object:Gem::Dependency
|
144
144
|
name: eac_templates
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,40 +228,20 @@ dependencies:
|
|
228
228
|
- - ">="
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: 0.1.3
|
231
|
-
- !ruby/object:Gem::Dependency
|
232
|
-
name: aranha-parsers
|
233
|
-
requirement: !ruby/object:Gem::Requirement
|
234
|
-
requirements:
|
235
|
-
- - "~>"
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
version: '0.8'
|
238
|
-
type: :development
|
239
|
-
prerelease: false
|
240
|
-
version_requirements: !ruby/object:Gem::Requirement
|
241
|
-
requirements:
|
242
|
-
- - "~>"
|
243
|
-
- !ruby/object:Gem::Version
|
244
|
-
version: '0.8'
|
245
231
|
- !ruby/object:Gem::Dependency
|
246
232
|
name: eac_ruby_gem_support
|
247
233
|
requirement: !ruby/object:Gem::Requirement
|
248
234
|
requirements:
|
249
235
|
- - "~>"
|
250
236
|
- !ruby/object:Gem::Version
|
251
|
-
version: '0.
|
252
|
-
- - ">="
|
253
|
-
- !ruby/object:Gem::Version
|
254
|
-
version: 0.8.2
|
237
|
+
version: '0.9'
|
255
238
|
type: :development
|
256
239
|
prerelease: false
|
257
240
|
version_requirements: !ruby/object:Gem::Requirement
|
258
241
|
requirements:
|
259
242
|
- - "~>"
|
260
243
|
- !ruby/object:Gem::Version
|
261
|
-
version: '0.
|
262
|
-
- - ">="
|
263
|
-
- !ruby/object:Gem::Version
|
264
|
-
version: 0.8.2
|
244
|
+
version: '0.9'
|
265
245
|
description:
|
266
246
|
email:
|
267
247
|
executables: []
|
@@ -272,6 +252,10 @@ files:
|
|
272
252
|
- lib/ehbrs_ruby_utils/bga.rb
|
273
253
|
- lib/ehbrs_ruby_utils/bga/game.rb
|
274
254
|
- lib/ehbrs_ruby_utils/bga/game/image.rb
|
255
|
+
- lib/ehbrs_ruby_utils/bga/game_statistics.rb
|
256
|
+
- lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb
|
257
|
+
- lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_content.rb
|
258
|
+
- lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_title.rb
|
275
259
|
- lib/ehbrs_ruby_utils/bga/parsers/game_in_progress.rb
|
276
260
|
- lib/ehbrs_ruby_utils/bga/parsers/game_stats.rb
|
277
261
|
- lib/ehbrs_ruby_utils/bga/parsers/game_stats/players.rb
|
@@ -279,6 +263,7 @@ files:
|
|
279
263
|
- lib/ehbrs_ruby_utils/bga/parsers/table/active_players.rb
|
280
264
|
- lib/ehbrs_ruby_utils/bga/parsers/table/ended_players.rb
|
281
265
|
- lib/ehbrs_ruby_utils/bga/parsers/table/options.rb
|
266
|
+
- lib/ehbrs_ruby_utils/bga/player.rb
|
282
267
|
- lib/ehbrs_ruby_utils/bga/session.rb
|
283
268
|
- lib/ehbrs_ruby_utils/bga/session/login.rb
|
284
269
|
- lib/ehbrs_ruby_utils/bga/session/player.rb
|
@@ -299,6 +284,8 @@ files:
|
|
299
284
|
- lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/ending.rb
|
300
285
|
- lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/ending/format_player.rb
|
301
286
|
- lib/ehbrs_ruby_utils/bga/urls.rb
|
287
|
+
- lib/ehbrs_ruby_utils/bga/whatsapp_formatter.rb
|
288
|
+
- lib/ehbrs_ruby_utils/bga/whatsapp_formatter/option.rb
|
302
289
|
- lib/ehbrs_ruby_utils/circular_list_spreader.rb
|
303
290
|
- lib/ehbrs_ruby_utils/circular_list_spreader/base_level.rb
|
304
291
|
- lib/ehbrs_ruby_utils/circular_list_spreader/group_level.rb
|
@@ -320,6 +307,7 @@ files:
|
|
320
307
|
- lib/ehbrs_ruby_utils/finances/bb_browser/docker_image.rb
|
321
308
|
- lib/ehbrs_ruby_utils/fs.rb
|
322
309
|
- lib/ehbrs_ruby_utils/fs/compressed_package.rb
|
310
|
+
- lib/ehbrs_ruby_utils/fs/iso_9660_file.rb
|
323
311
|
- lib/ehbrs_ruby_utils/fs/selected.rb
|
324
312
|
- lib/ehbrs_ruby_utils/fs/selected/build.rb
|
325
313
|
- lib/ehbrs_ruby_utils/fs/selected/build_file.rb
|
@@ -344,6 +332,8 @@ files:
|
|
344
332
|
- lib/ehbrs_ruby_utils/patches/object/template.rb
|
345
333
|
- lib/ehbrs_ruby_utils/version.rb
|
346
334
|
- lib/ehbrs_ruby_utils/vg.rb
|
335
|
+
- lib/ehbrs_ruby_utils/vg/ps2.rb
|
336
|
+
- lib/ehbrs_ruby_utils/vg/ps2/iso_file.rb
|
347
337
|
- lib/ehbrs_ruby_utils/vg/wii.rb
|
348
338
|
- lib/ehbrs_ruby_utils/vg/wii/file_move.rb
|
349
339
|
- lib/ehbrs_ruby_utils/vg/wii/game_file.rb
|