-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate_connectors.py
More file actions
135 lines (116 loc) · 5.48 KB
/
Copy pathupdate_connectors.py
File metadata and controls
135 lines (116 loc) · 5.48 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env python3
"""
Script to update all ShareConnect connector pages with consumer-focused messaging and blue theme
"""
import os
import re
# Consumer-focused messaging templates
CONSUMER_MESSAGES = {
# Hero section templates
"hero_title": {
"pattern": r'<h1 class="hero-title">\s*([^<]+)\s*<span class="gradient-text">([^<]+)</span>\s*</h1>',
"replacement": '<h1 class="hero-title">\n \1\n <span class="gradient-text">\2</span>\n </h1>'
},
"hero_subtitle": {
"pattern": r'<p class="hero-subtitle">\s*([^<]+)\s*</p>',
"replacement": '<p class="hero-subtitle">\n \1\n </p>'
},
# Feature section templates
"feature_section": {
"pattern": r'<h2>([^<]+)</h2>\s*<p>([^<]+)</p>',
"replacement": '<h2>\1</h2>\n <p>\2</p>'
}
}
# Consumer-focused content updates by connector type
CONNECTOR_UPDATES = {
"torrent": {
"hero_subtitle": "Send torrent links directly to your torrent client. Start downloads instantly with one tap - no more copying URLs or switching apps.",
"feature_1": "Instant torrent downloads from any app",
"feature_2": "Full queue management and organization",
"feature_3": "Works with your existing torrent client"
},
"media": {
"hero_subtitle": "Add content to your media server instantly. Share streaming links and build your media collection with one tap.",
"feature_1": "Add content to your streaming library instantly",
"feature_2": "Automatic metadata and organization",
"feature_3": "Works with your media server setup"
},
"download": {
"hero_subtitle": "Download from 1800+ sites automatically. Premium account support, batch downloads, and smart file organization.",
"feature_1": "Download from 1800+ sites with one tap",
"feature_2": "Premium account and CAPTCHA support",
"feature_3": "Batch downloads and automatic organization"
},
"cloud": {
"hero_subtitle": "Save files directly to your cloud storage. Encrypted sync, automatic backup, and access from anywhere.",
"feature_1": "Save files to cloud storage instantly",
"feature_2": "Encrypted sync and automatic backup",
"feature_3": "Access your files from anywhere"
},
"specialized": {
"hero_subtitle": "Connect to specialized tools for messaging, file sync, documents, and more. One tap access to all your services.",
"feature_1": "Connect to messaging and sync tools",
"feature_2": "Document management and organization",
"feature_3": "One tap access to all your services"
}
}
def update_connector_file(filepath, connector_type):
"""Update a single connector file with consumer-focused messaging"""
try:
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Update hero subtitle
updates = CONNECTOR_UPDATES.get(connector_type, CONNECTOR_UPDATES["specialized"])
# Update hero subtitle
old_subtitle_pattern = r'<p class="hero-subtitle">[^<]*</p>'
new_subtitle = f'<p class="hero-subtitle">\n {updates["hero_subtitle"]}\n </p>'
content = re.sub(old_subtitle_pattern, new_subtitle, content)
# Update GitHub repository link
content = content.replace('https://github.com/yourusername/ShareConnect', 'https://github.com/shareconnect')
# Update logo path to use transparent version
content = content.replace('assets/logo.jpeg', 'assets/logo_transparent.png')
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f"✓ Updated: {os.path.basename(filepath)}")
return True
except Exception as e:
print(f"✗ Failed to update {filepath}: {e}")
return False
def main():
"""Main function to update all connector files"""
# Define connector files and their types
connectors = {
"qbitconnect.html": "torrent",
"transmissionconnect.html": "torrent",
"utorrentconnect.html": "torrent",
"plexconnect.html": "media",
"jellyfinconnect.html": "media",
"embyconnect.html": "media",
"jdownloaderconnect.html": "download",
"ytdlpconnect.html": "download",
"metubeconnect.html": "download",
"nextcloudconnect.html": "cloud",
"seafileconnect.html": "cloud",
"filebrowserconnect.html": "cloud",
"syncthingconnect.html": "specialized",
"matrixconnect.html": "specialized",
"paperlessngconnect.html": "specialized",
"duplicaticonnect.html": "specialized",
"wireguardconnect.html": "specialized",
"minecraftserverconnect.html": "specialized",
"onlyofficeconnect.html": "specialized",
"shareconnector.html": "specialized"
}
updated_count = 0
total_count = len(connectors)
print(f"Updating {total_count} connector files...")
for filename, connector_type in connectors.items():
filepath = os.path.join(".", filename)
if os.path.exists(filepath):
if update_connector_file(filepath, connector_type):
updated_count += 1
else:
print(f"✗ File not found: {filename}")
print(f"\n✅ Successfully updated {updated_count}/{total_count} connector files")
if __name__ == "__main__":
main()