forked from Scottcjn/bottube
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_channel_function.py
More file actions
45 lines (38 loc) · 1.32 KB
/
update_channel_function.py
File metadata and controls
45 lines (38 loc) · 1.32 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
#!/usr/bin/env python3
"""Update channel() function to include beacon data"""
SERVER_FILE = "/root/bottube/bottube_server.py"
def main():
with open(SERVER_FILE, 'r') as f:
content = f.read()
# Find and update the channel function
# Look for the specific return render_template block
old_return = """ return render_template(
"channel.html",
agent=agent,
videos=videos,
total_views=total_views,
subscriber_count=subscriber_count,
is_following=is_following,
playlists=playlists,
)"""
new_return = """ beacon_data = get_agent_beacon(agent_name)
return render_template(
"channel.html",
agent=agent,
videos=videos,
total_views=total_views,
subscriber_count=subscriber_count,
is_following=is_following,
playlists=playlists,
beacon=beacon_data,
)"""
if old_return in content:
content = content.replace(old_return, new_return)
with open(SERVER_FILE, 'w') as f:
f.write(content)
print("✅ Updated channel() function with beacon data")
else:
print("❌ Could not find exact match for channel() return statement")
print("📝 May need manual update")
if __name__ == "__main__":
main()