atome 0.5.6.8.7 → 0.5.7.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/documentation/basic.md +7 -8
  3. data/documentation/deep learning/basic_infos.txt +6 -6
  4. data/documentation/installation/atome_server.md +66 -1
  5. data/documentation/installation/buiding_atome.md +307 -0
  6. data/lib/atome/atome.rb +2 -3
  7. data/lib/atome/extensions/atome.rb +38 -12
  8. data/lib/atome/genesis/atomes.rb +1 -1
  9. data/lib/atome/genesis/genesis.rb +11 -11
  10. data/lib/atome/genesis/particles/event.rb +58 -50
  11. data/lib/atome/genesis/particles/identity.rb +3 -0
  12. data/lib/atome/genesis/particles/property.rb +2 -1
  13. data/lib/atome/genesis/particles/utility.rb +19 -12
  14. data/lib/atome/genesis/presets.rb +10 -0
  15. data/lib/atome/genesis/sparkle.rb +11 -9
  16. data/lib/atome/kernel/universe.rb +22 -11
  17. data/lib/atome/presets/atome.rb +20 -17
  18. data/lib/atome/utilities/essentials.rb +5 -5
  19. data/lib/atome/utilities/utilities.rb +168 -15
  20. data/lib/atome/version.rb +1 -1
  21. data/lib/atome.rb +1 -0
  22. data/lib/atome_relative.rb +1 -0
  23. data/lib/molecules/init.rb +22 -42
  24. data/lib/molecules/intuition/_deprecated_inputs.rb +111 -0
  25. data/lib/molecules/intuition/utillities.rb +105 -11
  26. data/lib/renderers/html/event.rb +20 -4
  27. data/lib/renderers/html/html.rb +145 -161
  28. data/lib/renderers/html/identity.rb +10 -2
  29. data/lib/renderers/html/utility.rb +64 -8
  30. data/vendor/assets/application/examples/b64_to_image.rb +9 -0
  31. data/vendor/assets/application/examples/drag.rb +9 -2
  32. data/vendor/assets/application/examples/matrix.rb +77 -114
  33. data/vendor/assets/application/examples/recorder.rb +74 -0
  34. data/vendor/assets/application/examples/site.rb +41 -0
  35. data/vendor/assets/application/examples/sub_atome_manipulation.rb +0 -2
  36. data/vendor/assets/application/examples/svg_img_to_vector.rb +6 -0
  37. data/vendor/assets/application/examples/svg_vectorizer.rb +21 -0
  38. data/vendor/assets/application/examples/table.rb +1 -1
  39. data/vendor/assets/application/examples/test.rb +572 -0
  40. data/vendor/assets/application/examples/tools.rb +650 -304
  41. data/vendor/assets/application/examples/vector.rb +16 -3
  42. data/vendor/assets/server/atome_server.rb +3 -2
  43. data/vendor/assets/server/atome_server_wasm.rb +2 -2
  44. data/vendor/assets/server/eDen.rb +135 -14
  45. data/vendor/assets/src/index.html +1 -1
  46. data/vendor/assets/src/index_opal.html +1 -1
  47. data/vendor/assets/src/index_server.html +1 -1
  48. data/vendor/assets/src/index_server_wasm.html +1 -1
  49. data/vendor/assets/src/index_wasm.html +1 -1
  50. data/vendor/assets/src/js/atome/atome.js +250 -49
  51. data/vendor/assets/src/js/atome/atome_helpers/communication.js +4 -4
  52. data/vendor/assets/src/js/atome/specific/opal.js +19 -3
  53. data/vendor/assets/src/js/atome/specific/wasm.js +18 -3
  54. data/vendor/assets/src/js/molecules/web.js +1 -1
  55. data/vendor/assets/src/medias/images/icons/Lowpass.svg +8 -0
  56. data/vendor/assets/src/medias/images/icons/activate.svg +3 -0
  57. data/vendor/assets/src/medias/images/icons/audio.svg +7 -0
  58. data/vendor/assets/src/medias/images/icons/band_pass.svg +8 -0
  59. data/vendor/assets/src/medias/images/icons/clear.svg +5 -0
  60. data/vendor/assets/src/medias/images/icons/color.svg +5 -0
  61. data/vendor/assets/src/medias/images/icons/copy.svg +8 -0
  62. data/vendor/assets/src/medias/images/icons/create.svg +3 -0
  63. data/vendor/assets/src/medias/images/icons/delete.svg +8 -0
  64. data/vendor/assets/src/medias/images/icons/edit-.svg +4 -0
  65. data/vendor/assets/src/medias/images/icons/edit.svg +4 -0
  66. data/vendor/assets/src/medias/images/icons/edition.svg +4 -0
  67. data/vendor/assets/src/medias/images/icons/equalizer-.svg +5 -0
  68. data/vendor/assets/src/medias/images/icons/equalizer.svg +5 -0
  69. data/vendor/assets/src/medias/images/icons/filter.svg +4 -0
  70. data/vendor/assets/src/medias/images/icons/folder.svg +4 -0
  71. data/vendor/assets/src/medias/images/icons/group.svg +6 -0
  72. data/vendor/assets/src/medias/images/icons/hamburger.svg +8 -0
  73. data/vendor/assets/src/medias/images/icons/high_pass.svg +5 -0
  74. data/vendor/assets/src/medias/images/icons/link.svg +4 -0
  75. data/vendor/assets/src/medias/images/icons/load.svg +4 -0
  76. data/vendor/assets/src/medias/images/icons/low_pass.svg +5 -0
  77. data/vendor/assets/src/medias/images/icons/microphone.svg +7 -0
  78. data/vendor/assets/src/medias/images/icons/midi_in.svg +4 -0
  79. data/vendor/assets/src/medias/images/icons/midi_out.svg +4 -0
  80. data/vendor/assets/src/medias/images/icons/modules.svg +11 -0
  81. data/vendor/assets/src/medias/images/icons/paste.svg +4 -0
  82. data/vendor/assets/src/medias/images/icons/pause.svg +5 -0
  83. data/vendor/assets/src/medias/images/icons/play.svg +7 -0
  84. data/vendor/assets/src/medias/images/icons/record.svg +4 -0
  85. data/vendor/assets/src/medias/images/icons/save.svg +5 -0
  86. data/vendor/assets/src/medias/images/icons/select--.svg +4 -0
  87. data/vendor/assets/src/medias/images/icons/select-.svg +5 -0
  88. data/vendor/assets/src/medias/images/icons/select-all.svg +4 -0
  89. data/vendor/assets/src/medias/images/icons/select.svg +4 -0
  90. data/vendor/assets/src/medias/images/icons/settings.svg +5 -0
  91. data/vendor/assets/src/medias/images/icons/settings0.svg +2 -0
  92. data/vendor/assets/src/medias/images/icons/settings1.svg +17 -0
  93. data/vendor/assets/src/medias/images/icons/settings2.svg +25 -0
  94. data/vendor/assets/src/medias/images/icons/settings_old.svg +6 -0
  95. data/vendor/assets/src/medias/images/icons/shape.svg +7 -0
  96. data/vendor/assets/src/medias/images/icons/speaker.svg +6 -0
  97. data/vendor/assets/src/medias/images/icons/stop.svg +4 -0
  98. data/vendor/assets/src/medias/images/icons/tool.svg +7 -0
  99. data/vendor/assets/src/medias/images/icons/tools.svg +9 -0
  100. data/vendor/assets/src/medias/images/icons/undo2.svg +4 -0
  101. data/vendor/assets/src/medias/images/icons/validate.svg +9 -0
  102. data/vendor/assets/src/medias/images/icons/vie.svg +3 -0
  103. data/vendor/assets/src/medias/images/icons/wave-saw.svg +3 -0
  104. data/vendor/assets/src/medias/images/icons/wave-sine.svg +3 -0
  105. data/vendor/assets/src/medias/images/icons/wave-square-.svg +4 -0
  106. data/vendor/assets/src/medias/images/icons/wave-square.svg +3 -0
  107. data/vendor/assets/src/medias/images/icons/wave-triangle.svg +3 -0
  108. data/vendor/assets/src/medias/images/icons/waveform-.svg +4 -0
  109. data/vendor/assets/src/medias/images/icons/waveform.svg +7 -0
  110. metadata +68 -6
  111. data/lib/molecules/intuition/inputs.rb +0 -111
  112. /data/lib/molecules/{examples → _deprecated_examples}/site.rb +0 -0
  113. /data/lib/molecules/intuition/{toolbox.rb → _deprecated_toolbox.rb} +0 -0
@@ -1,11 +1,11 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  edition = "M257.7 752c2 0 4-0.2 6-0.5L431.9 722c2-0.4 3.9-1.3 5.3-2.8l423.9-423.9c3.9-3.9 3.9-10.2 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2c-1.9 11.1 1.5 21.9 9.4 29.8 6.6 6.4 14.9 9.9 23.8 9.9z m67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"
4
4
 
5
5
  v = vector({ data: { path: { d: edition, id: :p1, stroke: :black, 'stroke-width' => 37, fill: :red } } })
6
6
 
7
7
  wait 1 do
8
- v.data(circle: { cx: 1000, cy: 1000, r: 340, id: :p2, stroke: :green, 'stroke-width' => 35, fill: :yellow })
8
+ v.data([{ circle: { cx: 300, cy: 300, r: 340, id: :p2, stroke: :blue, 'stroke-width' => 35, fill: :yellow } }, { circle: { cx: 1000, cy: 1000, r: 340, id: :p2, stroke: :green, 'stroke-width' => 35, fill: :yellow } }])
9
9
  wait 1 do
10
10
  v.color(:cyan) # colorise everything with the color method
11
11
  wait 1 do
@@ -15,10 +15,23 @@ wait 1 do
15
15
  option: :natural,
16
16
  red: 0, green: 1, blue: 0, alpha: 1
17
17
  })
18
- v.component(p2: {fill: :blue,'stroke-width' => 166 })
18
+ wait 1 do
19
+ wait 1 do
20
+ v.component(p2: { fill: :blue, 'stroke-width' => 33 })
21
+ end
22
+ v.component(p2: { fill: :blue, 'stroke-width' => 122 })
23
+ wait 1 do
24
+ v.data({})
25
+ wait 1 do
26
+ v.data({ circle: { cx: 300, cy: 300, r: 340, id: :p2, stroke: :blue, 'stroke-width' => 99, fill: :yellowgreen } })
27
+ end
28
+ end
29
+ end
19
30
  v.left(222)
20
31
  end
21
32
  end
22
33
  end
23
34
 
24
35
 
36
+
37
+
@@ -39,8 +39,9 @@ class App < Roda
39
39
  data = full_data['data']
40
40
  action_requested = full_data['action']
41
41
  message_id = full_data['message_id']
42
- return_message = EDen.safe_send(action_requested, data, message_id)
42
+ return_message = EDen.safe_send(action_requested, data, message_id, ws)
43
43
  ws.send(return_message.to_json)
44
+
44
45
  end
45
46
  ws.on(:close) do |event|
46
47
  puts "server closed with status #{event.code}"
@@ -51,4 +52,4 @@ class App < Roda
51
52
  end
52
53
  end
53
54
 
54
- end
55
+ end
@@ -39,7 +39,7 @@ class App < Roda
39
39
  data = full_data['data']
40
40
  action_requested = full_data['action']
41
41
  message_id = full_data['message_id']
42
- return_message = EDen.safe_send(action_requested, data, message_id)
42
+ return_message = EDen.safe_send(action_requested, data, message_id, ws)
43
43
  ws.send(return_message.to_json)
44
44
  end
45
45
  ws.on(:close) do |event|
@@ -51,4 +51,4 @@ class App < Roda
51
51
  end
52
52
  end
53
53
 
54
- end
54
+ end
@@ -6,6 +6,7 @@ class EDen
6
6
 
7
7
  @@mail = nil
8
8
  @@pass = nil
9
+
9
10
  class << self
10
11
 
11
12
  @@mail = nil
@@ -15,7 +16,7 @@ class EDen
15
16
  Database.db_access
16
17
  end
17
18
 
18
- def terminal(data, message_id)
19
+ def terminal(data, message_id, ws)
19
20
  { data: { message: `#{data}` }, message_id: message_id }
20
21
  end
21
22
 
@@ -24,7 +25,127 @@ class EDen
24
25
  email.gsub(invalid_chars_pattern, '')
25
26
  end
26
27
 
27
- def authentication(data, message_id)
28
+ def metadata(msg, pid, message_id, ws)
29
+
30
+ path = msg[:output_file]
31
+ data = msg[:data]
32
+ if msg[:read]
33
+ command = "ffprobe -v error -show_entries format_tags=comment -of default=noprint_wrappers=1:nokey=1 #{path.shellescape}"
34
+
35
+ Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
36
+ if wait_thr.value.success?
37
+ output = stdout.read
38
+ puts "Metadata for #{path}:"
39
+ puts output
40
+ else
41
+ puts "Error reading metadata: #{stderr.read}"
42
+ end
43
+ end
44
+ else
45
+ custom_data = data.to_json
46
+ comment_metadata = "-metadata comment=#{custom_data.shellescape}"
47
+
48
+ # input_file = path
49
+ temp_output_file = "./temp_#{File.basename(path)}"
50
+ ffmpeg_cmd = "ffmpeg -i #{path.shellescape} #{comment_metadata} -codec copy #{temp_output_file.shellescape}"
51
+
52
+ Open3.popen3(ffmpeg_cmd) do |stdin, stdout, stderr, wait_thr|
53
+ if wait_thr.value.success?
54
+ FileUtils.mv(temp_output_file, path, force: true)
55
+ puts "Metadata successfully added to #{path}"
56
+ else
57
+ puts "Error: #{stderr.read}"
58
+ end
59
+ end
60
+ end
61
+
62
+
63
+ ws.send({ :pid => pid, :return => msg, :message_id => message_id }.to_json)
64
+ end
65
+
66
+ def finished(msg, pid, message_id, ws)
67
+
68
+ path = msg[:output_file]
69
+ # metadata = msg[:metadata]
70
+
71
+ # custom_data = metadata.to_json
72
+ # comment_metadata = "-metadata comment=#{custom_data.shellescape}"
73
+
74
+ input_file = path
75
+ # temp_output_file = "./temp_#{File.basename(input_file)}"
76
+
77
+ ##### write tag
78
+ metadata(msg, pid, message_id, ws)
79
+
80
+ ##### read tag
81
+ msg[:read]=true
82
+ metadata(msg, pid, message_id, ws)
83
+
84
+
85
+
86
+ ws.send({ :pid => pid, :return => msg, :message_id => message_id }.to_json)
87
+ end
88
+
89
+ def stop_recording(params, message_id, ws)
90
+ pid = params['pid']
91
+ if pid
92
+ begin
93
+ Process.getpgid(pid) # Vérifier si le processus est toujours actif
94
+ Process.kill("SIGINT", pid)
95
+ # puts "Recording stopped.#{pid} : #{pid.class}"
96
+ rescue Errno::ESRCH # Le processus n'existe pas
97
+ puts "Recording already stopped or PID not found."
98
+ end
99
+ else
100
+ puts "No recording in progress.#{pid} : #{pid.class}"
101
+ end
102
+ { data: "process killed", message_id: message_id }
103
+
104
+ end
105
+
106
+ def record(data, message_id, ws)
107
+
108
+ # # Command to start recording
109
+ # # -c 1 indicates recording in mono
110
+ # # rate 44.1k sets the sample rate to 44100 Hz
111
+ # # trim 0 <duration> records audio for 'duration' seconds
112
+ type = data['type']
113
+ name = data['name']
114
+ duration = data['duration']
115
+ media = data['media']
116
+ path = data['path']
117
+ data = data['data']
118
+
119
+ output_file = "#{path}/#{name}.#{type}"
120
+ if media == 'audio'
121
+ command = "rec -c 1 #{output_file} rate 44.1k trim 0 #{duration}"
122
+
123
+ stdin, stdout, stderr, wait_thr = Open3.popen3(command)
124
+ pid = wait_thr.pid # Sauvegarder le PID du processus ffmpeg
125
+ msg = { output_file: output_file, media: :audio, record: :stop, data: data }
126
+ # puts "pid class : #{pid.class}"
127
+ Thread.new { wait_thr.join; finished(msg, pid, message_id, ws) }
128
+ elsif media == 'video'
129
+ resolution = "1280x720"
130
+ framerate = "30"
131
+ video_device_index = "0"
132
+ audio_device_index = "1"
133
+ command = "ffmpeg -f avfoundation -framerate #{framerate} -video_size #{resolution} " +
134
+ "-i \"#{video_device_index}:#{audio_device_index}\" -t #{duration} " +
135
+ "-pix_fmt yuv420p -vsync 1 -filter:a \"aresample=async=1\" #{output_file}"
136
+ stdin, stdout, stderr, wait_thr = Open3.popen3(command)
137
+ pid = wait_thr.pid # save the pid
138
+ msg = { output_file: output_file, media: :video, record: :stop, data: data }
139
+ Thread.new { wait_thr.join; finished(msg, pid, message_id, ws) }
140
+ else
141
+ # nothing here
142
+
143
+ end
144
+
145
+ { pid: pid, return: "path : #{path} record : #{media} received : duration #{duration} : name: #{name}, pid: #{pid}", message_id: message_id }
146
+ end
147
+
148
+ def authentication(data, message_id, ws)
28
149
  # database connexion :
29
150
  db = db_access
30
151
  # retrieving data from the 'identity' table
@@ -40,7 +161,7 @@ class EDen
40
161
  if !mail_exists
41
162
  @@pass = nil
42
163
  puts "authentication @@pass : #{@@pass}"
43
- return { return: 'Email non trouvé, erreur', message_id: message_id }
164
+ { return: 'Email non trouvé, erreur', message_id: message_id }
44
165
  else
45
166
  @@mail = user_email
46
167
  puts "authentication @@mail du else : #{@@mail}"
@@ -58,7 +179,7 @@ class EDen
58
179
  end
59
180
  end
60
181
 
61
- def authorization(data, message_id)
182
+ def authorization(data, message_id, ws)
62
183
  # database connexion :
63
184
  db = db_access
64
185
  # retrieving data from the 'security' table
@@ -92,28 +213,28 @@ class EDen
92
213
  end
93
214
  end
94
215
 
95
- def localstorage(data, message_id)
216
+ def localstorage(data, message_id, ws)
96
217
  # return test
97
218
  # ws.send(return_message.to_json)
98
219
  return { return: 'localstorage content received', authorized: true, message_id: message_id }
99
220
 
100
221
  end
101
222
 
102
- def historicize(data, message_id)
223
+ def historicize(data, message_id, ws)
103
224
  # return test
104
225
  # ws.send(return_message.to_json)
105
226
  return { return: 'item to historicize received', authorized: true, message_id: message_id }
106
227
 
107
228
  end
108
229
 
109
- def init_db(_data, message_id)
230
+ def init_db(_data, message_id, ws)
110
231
  unless File.exist?("eden.sqlite3")
111
232
  Sequel.connect("sqlite://eden.sqlite3")
112
233
  end
113
234
  { data: { message: 'database_ready' }, message_id: message_id }
114
235
  end
115
236
 
116
- def crate_db_table(data, message_id)
237
+ def crate_db_table(data, message_id, ws)
117
238
  table = data['table']
118
239
  type = data['type']
119
240
  primary = data['primary']
@@ -121,7 +242,7 @@ class EDen
121
242
  { data: { message: "table #{table} added" }, message_id: message_id }
122
243
  end
123
244
 
124
- def create_db_column(data, message_id)
245
+ def create_db_column(data, message_id, ws)
125
246
  table = data['table']
126
247
  column = data['column']
127
248
  type = data['type']
@@ -129,13 +250,13 @@ class EDen
129
250
  { data: { message: "column #{column} with type : #{type} added" }, message_id: message_id }
130
251
  end
131
252
 
132
- def query(data, message_id)
253
+ def query(data, message_id, ws)
133
254
  identity_table = db_access[data['table'].to_sym]
134
255
  result = identity_table.send(:all).send(:select)
135
256
  { data: { table: data['table'], infos: result }, message_id: message_id }
136
257
  end
137
258
 
138
- def insert(data, message_id)
259
+ def insert(data, message_id, ws)
139
260
  table = data['table'].to_sym
140
261
  particles = data['particles']
141
262
 
@@ -164,7 +285,7 @@ class EDen
164
285
  end
165
286
  end
166
287
 
167
- def file(data, message_id)
288
+ def file(data, message_id, ws)
168
289
 
169
290
  file_content = File.send(data['operation'], data['source'], data['value']).to_s
170
291
  file_content = file_content.gsub("'", "\"")
@@ -173,9 +294,9 @@ class EDen
173
294
  { data: "=> operation: #{data['operation']}, source: #{data['source']}, content: #{file_content}", message_id: message_id }
174
295
  end
175
296
 
176
- def safe_send(method_name, data, message_id)
297
+ def safe_send(method_name, data, message_id, ws)
177
298
  method_sym = method_name.to_sym
178
- send(method_sym, data, message_id)
299
+ send(method_sym, data, message_id, ws)
179
300
  end
180
301
  end
181
302
  end
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="En">
2
+ <html lang="En" id="html">
3
3
  <head>
4
4
  <link rel="icon" type="image/x-icon"
5
5
  href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="En">
2
+ <html lang="En" id="html">
3
3
  <head>
4
4
  <link rel="icon" type="image/x-icon"
5
5
  href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="En">
2
+ <html lang="En" id="html">
3
3
  <head>
4
4
  <link href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico" rel="icon"
5
5
  type="image/x-icon">
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="En">
2
+ <html lang="En" id="html">
3
3
  <head>
4
4
  <link rel="icon" type="image/x-icon"
5
5
  href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="En">
2
+ <html lang="En" id="html">
3
3
  <head>
4
4
  <link rel="icon" type="image/x-icon"
5
5
  href="https://github.com/atomecorp/atome/blob/master/vendor/assets/src/favicon.ico">