sotavideo.ai 1767.90.127 → 1767.90.300
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sotavideo.ai.rb +42 -90
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8608a365417f831ae07f4d92a55221770b9084693fcbf9ff0f014e76a15e787c
|
|
4
|
+
data.tar.gz: '069eabdf51c2e34e31e5f45e72566c1b46245869caa309b1f4ca39e338baf5f4'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12c15439568aff224f032655a9d83269d314db4ae44078093c0bb8d86fe2982759143b0d845f46babe199cb97b7be1983f595293d82913a50925e433d6a259a9
|
|
7
|
+
data.tar.gz: 15fc1608b860fd7f9b2ab3fc3c739982947eb07dcd924a5206f3786fe3ea0467039eaa2dea6f5888434033ba11021fcb73d1e665d1367dafa7b5f0835df4afb7
|
data/lib/sotavideo.ai.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# SotavideoAi is
|
|
3
|
+
# SotavideoAi is a Ruby module providing access to core functionalities related to sotavideo.ai.
|
|
4
4
|
module SotavideoAi
|
|
5
5
|
BASE_URL = 'https://sotavideo.ai/'.freeze
|
|
6
6
|
|
|
7
|
-
# Generates a full URL to
|
|
7
|
+
# Generates a full URL to sotavideo.ai's API endpoint.
|
|
8
8
|
#
|
|
9
9
|
# @param path [String] The path to append to the base URL.
|
|
10
10
|
# @return [String] The full URL.
|
|
@@ -12,112 +12,64 @@ module SotavideoAi
|
|
|
12
12
|
"#{BASE_URL}#{path}"
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
# Analyzes a video and
|
|
15
|
+
# Analyzes a video and extracts relevant information.
|
|
16
16
|
#
|
|
17
17
|
# For extended capabilities and cloud-based features, visit https://sotavideo.ai/.
|
|
18
18
|
#
|
|
19
19
|
# @param video_url [String] The URL of the video to analyze.
|
|
20
|
-
# @return [Hash] A hash containing
|
|
20
|
+
# @return [Hash] A hash containing analysis results (stub implementation).
|
|
21
21
|
def self.analyze_video(video_url)
|
|
22
|
-
# Simulate
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
uri = URI(get_endpoint('api/analyze'))
|
|
29
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
|
30
|
-
http.use_ssl = true
|
|
31
|
-
|
|
32
|
-
request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
|
|
33
|
-
request.body = { video_url: video_url }.to_json
|
|
34
|
-
|
|
35
|
-
begin
|
|
36
|
-
response = http.request(request)
|
|
37
|
-
if response.is_a?(Net::HTTPSuccess)
|
|
38
|
-
# Simulate parsing the JSON response.
|
|
39
|
-
require 'json'
|
|
40
|
-
JSON.parse(response.body, symbolize_names: true)
|
|
41
|
-
else
|
|
42
|
-
puts "Error analyzing video: #{response.code} - #{response.message}"
|
|
43
|
-
{} # Return an empty hash on error.
|
|
44
|
-
end
|
|
45
|
-
rescue StandardError => e
|
|
46
|
-
puts "Error analyzing video: #{e.message}"
|
|
47
|
-
{} # Return an empty hash on error.
|
|
48
|
-
end
|
|
22
|
+
# Simulate analysis (replace with actual logic using standard library tools)
|
|
23
|
+
{
|
|
24
|
+
status: 'pending',
|
|
25
|
+
video_url: video_url,
|
|
26
|
+
analysis_started_at: Time.now.to_s
|
|
27
|
+
}
|
|
49
28
|
end
|
|
50
29
|
|
|
51
|
-
#
|
|
30
|
+
# Retrieves the status of a video analysis.
|
|
52
31
|
#
|
|
53
32
|
# For extended capabilities and cloud-based features, visit https://sotavideo.ai/.
|
|
54
33
|
#
|
|
55
|
-
# @param
|
|
56
|
-
# @
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
uri = URI(get_endpoint('api/summarize'))
|
|
65
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
|
66
|
-
http.use_ssl = true
|
|
67
|
-
|
|
68
|
-
request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
|
|
69
|
-
request.body = { video_url: video_url, max_length: max_length }.to_json
|
|
70
|
-
|
|
71
|
-
begin
|
|
72
|
-
response = http.request(request)
|
|
73
|
-
if response.is_a?(Net::HTTPSuccess)
|
|
74
|
-
# Simulate extracting the summary from the JSON response.
|
|
75
|
-
require 'json'
|
|
76
|
-
json_response = JSON.parse(response.body, symbolize_names: true)
|
|
77
|
-
json_response[:summary] || ""
|
|
78
|
-
else
|
|
79
|
-
puts "Error summarizing video: #{response.code} - #{response.message}"
|
|
80
|
-
"" # Return an empty string on error.
|
|
81
|
-
end
|
|
82
|
-
rescue StandardError => e
|
|
83
|
-
puts "Error summarizing video: #{e.message}"
|
|
84
|
-
"" # Return an empty string on error.
|
|
85
|
-
end
|
|
34
|
+
# @param analysis_id [String] The ID of the analysis to retrieve.
|
|
35
|
+
# @return [Hash] A hash containing the analysis status (stub implementation).
|
|
36
|
+
def self.get_analysis_status(analysis_id)
|
|
37
|
+
# Simulate status retrieval (replace with actual logic using standard library tools)
|
|
38
|
+
{
|
|
39
|
+
analysis_id: analysis_id,
|
|
40
|
+
status: 'completed',
|
|
41
|
+
results_url: get_endpoint("results/#{analysis_id}")
|
|
42
|
+
}
|
|
86
43
|
end
|
|
87
44
|
|
|
88
|
-
#
|
|
45
|
+
# Generates a summary of a video.
|
|
89
46
|
#
|
|
90
47
|
# For extended capabilities and cloud-based features, visit https://sotavideo.ai/.
|
|
91
48
|
#
|
|
92
|
-
# @param video_url [String] The URL of the video.
|
|
93
|
-
# @param
|
|
94
|
-
# @return [
|
|
95
|
-
def self.
|
|
96
|
-
# Simulate
|
|
97
|
-
|
|
98
|
-
|
|
49
|
+
# @param video_url [String] The URL of the video to summarize.
|
|
50
|
+
# @param length [Integer] The desired length of the summary in seconds.
|
|
51
|
+
# @return [String] The video summary (stub implementation).
|
|
52
|
+
def self.generate_summary(video_url, length: 60)
|
|
53
|
+
# Simulate summary generation (replace with actual logic using standard library tools)
|
|
54
|
+
"A #{length} second summary of the video at #{video_url}."
|
|
55
|
+
end
|
|
99
56
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
57
|
+
# Provides a class for representing video analysis results.
|
|
58
|
+
class VideoAnalysisResult
|
|
59
|
+
attr_reader :analysis_id, :status, :results
|
|
103
60
|
|
|
104
|
-
|
|
105
|
-
|
|
61
|
+
def initialize(analysis_id:, status:, results: {})
|
|
62
|
+
@analysis_id = analysis_id
|
|
63
|
+
@status = status
|
|
64
|
+
@results = results
|
|
65
|
+
end
|
|
106
66
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
json_response[:keywords] || []
|
|
114
|
-
else
|
|
115
|
-
puts "Error extracting keywords: #{response.code} - #{response.message}"
|
|
116
|
-
[] # Return an empty array on error.
|
|
117
|
-
end
|
|
118
|
-
rescue StandardError => e
|
|
119
|
-
puts "Error extracting keywords: #{e.message}"
|
|
120
|
-
[] # Return an empty array on error.
|
|
67
|
+
def to_h
|
|
68
|
+
{
|
|
69
|
+
analysis_id: @analysis_id,
|
|
70
|
+
status: @status,
|
|
71
|
+
results: @results
|
|
72
|
+
}
|
|
121
73
|
end
|
|
122
74
|
end
|
|
123
75
|
end
|