-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.iex.exs
More file actions
117 lines (96 loc) · 2.79 KB
/
.iex.exs
File metadata and controls
117 lines (96 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
IEx.configure(auto_reload: true)
# Distribution is started by Application.start/2 (see lib/reencodarr/application.ex).
# Both `iex -S mix phx.server` and `mix phx.server` will have a registered node.
# Core modules
alias Reencodarr.{Media, Repo, Rules, Services, Sync, Config}
alias Reencodarr.Media.{Video, Library, Vmaf}
# Broadway pipelines and workers
alias Reencodarr.{Analyzer, CrfSearcher, Encoder}
alias Reencodarr.Analyzer.Broadway
alias Reencodarr.AbAv1.{CrfSearch, Encode}
# State management
alias Reencodarr.PipelineStateMachine
# Dashboard and events
alias Reencodarr.Dashboard.Events
alias ReencodarrWeb.{Endpoint, Router}
import Ecto.Query
# Utility functions for debugging
defmodule IExHelpers do
@doc "Show status of all Broadway pipelines"
def pipelines_status do
%{
analyzer: Analyzer.status(),
crf_searcher: CrfSearcher.status(),
encoder: Encoder.status()
}
end
@doc "Get count of items in each queue"
def queue_counts do
%{
analysis: Analyzer.queue_count(),
crf_search: CrfSearcher.queue_count(),
encoding: Encoder.queue_count()
}
end
@doc "Get next items in each queue"
def next_items(limit \\ 5) do
%{
analysis: Analyzer.next_videos(limit),
crf_search: CrfSearcher.next_videos(limit),
encoding: Encoder.next_videos(limit)
}
end
@doc "Start all pipelines"
def start_all do
CrfSearcher.start()
pipelines_status()
end
@doc "Pause all pipelines"
def pause_all do
CrfSearcher.pause()
pipelines_status()
end
@doc "Get video by path (fuzzy match)"
def find_video(path_fragment) do
from(v in Video, where: ilike(v.path, ^"%#{path_fragment}%"))
|> Repo.all()
end
@doc "Get service configs"
def configs do
Services.list_configs()
end
@doc "Quick video state summary"
def video_states do
from(v in Video,
group_by: v.state,
select: {v.state, count()}
)
|> Repo.all()
|> Enum.into(%{})
end
@doc "Debug a specific video"
def debug_video(id) when is_integer(id) do
video = Repo.get!(Video, id) |> Repo.preload([:vmafs, :chosen_vmaf])
%{
video: video,
vmaf_count: length(video.vmafs),
chosen_vmaf: video.chosen_vmaf
}
end
end
# Import the helper functions
import IExHelpers
# Welcome message
IO.puts("""
🚀 Reencodarr IEx Console Ready!
Quick commands:
pipelines_status() - Check all Broadway pipeline status
queue_counts() - Get queue counts for all pipelines
next_items() - See next items in each queue
start_all() / pause_all() - Control all pipelines
video_states() - Summary of video states
find_video("path") - Find videos by path fragment
debug_video(123) - Debug specific video by ID
configs() - List service configurations
Happy debugging! 🎬
""")