Skip to content

Commit 9954927

Browse files
committed
content(logs): the match
1 parent d34ea74 commit 9954927

File tree

3 files changed

+43
-8
lines changed

3 files changed

+43
-8
lines changed

public/logs/event/event.piml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
(logs)
2+
> (item)
3+
(category) Event
4+
(date) 2026-02-17
5+
(rating) 5
6+
(slug) galatasaray-juventus-2026
7+
(title) Galatasaray - Juventus (17.02.2026)
8+
(description) An incredible comeback by Galatasaray against Juventus. Features Osimhen and Noa Lang's great performance.
9+
(link) https://www.youtube.com/watch?v=IRjyK-YS3f8
10+
211
> (item)
312
(category) Event
413
(by) Geoff Keighley
@@ -15,4 +24,4 @@
1524
(rating) 5
1625
(slug) rumble-in-the-jungle
1726
(title) Rumble in the Jungle (1974)
18-
(description) The legendary heavyweight championship match between Muhammad Ali and George Foreman in Kinshasa, Zaire. Ali's "rope-a-dope" strategy led to a stunning 8th-round knockout of the previously undefeated Foreman.
27+
(description) The legendary heavyweight championship match between Muhammad Ali and George Foreman in Kinshasa, Zaire. Ali's "rope-a-dope" strategy led to a stunning 8th-round knockout of the previously undefeated Foreman.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Galatasaray - Juventus (17.02.2026)
2+
3+
<iframe width="100%" height="450" src="https://www.youtube.com/embed/IRjyK-YS3f8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
4+
5+
Galatasaray defeated Juventus with a stunning performance. The atmosphere was electric.
6+
Incredible comeback! Awesome job by Victor Osimhen, and Noa Lang exceeded himself.

scripts/mcp-server/index.mjs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ async function writePosts(posts) {
3636
await fs.writeFile(POSTS_JSON, JSON.stringify(posts, null, 2), 'utf-8');
3737
}
3838

39+
function getYoutubeEmbedUrl(url) {
40+
if (!url) return null;
41+
const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
42+
const match = url.match(regExp);
43+
if (match && match[2].length === 11) {
44+
return `https://www.youtube.com/embed/${match[2]}`;
45+
}
46+
return null;
47+
}
48+
3949
async function createPost(args) {
4050
const { title, slug, description, content, tags, category, image } = args;
4151

@@ -84,15 +94,15 @@ async function createPost(args) {
8494
}
8595

8696
async function createDiscoveryLog(args) {
87-
const { type, title, slug, rating, description, content, date, ...otherFields } = args;
97+
const { type, title, slug, rating, description, content, date, link, image, ...otherFields } = args;
8898

8999
// Validate slug
90100
if (!/^[a-z0-9-]+$/.test(slug)) {
91101
throw new Error('Slug must contain only lowercase letters, numbers, and hyphens.');
92102
}
93103

94104
const typeLower = type.toLowerCase();
95-
const categoryDir = path.join(LOGS_DIR, typeLower);
105+
const categoryDir = path.resolve(LOGS_DIR, typeLower);
96106
const pimlPath = path.join(categoryDir, `${typeLower}.piml`);
97107

98108
// Ensure directory exists
@@ -124,9 +134,11 @@ async function createDiscoveryLog(args) {
124134
const newItem = {
125135
category: type.charAt(0).toUpperCase() + type.slice(1),
126136
date: dateStr,
137+
link: link || '',
127138
rating: parseInt(rating, 10),
128139
slug,
129140
title,
141+
image: image || '',
130142
description,
131143
...otherFields
132144
};
@@ -138,13 +150,21 @@ async function createDiscoveryLog(args) {
138150
const newPimlString = piml.stringify({ logs });
139151
await fs.writeFile(pimlPath, newPimlString, 'utf-8');
140152

141-
// Create detailed content if provided
142-
if (content) {
143-
const txtPath = path.join(categoryDir, `${slug}.txt`);
144-
await fs.writeFile(txtPath, content, 'utf-8');
153+
// Create detailed content (.txt)
154+
const txtPath = path.join(categoryDir, `${slug}.txt`);
155+
let finalContent = content || description;
156+
157+
const embedUrl = getYoutubeEmbedUrl(link);
158+
let txtBody = `# ${title}\n\n`;
159+
if (embedUrl) {
160+
txtBody += `<iframe width="100%" height="450" src="${embedUrl}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>\n\n`;
145161
}
162+
txtBody += `${finalContent}\n\n`;
163+
txtBody += `Rating: ${rating}/5`;
164+
165+
await fs.writeFile(txtPath, txtBody, 'utf-8');
146166

147-
return `Discovery log "${title}" created successfully in ${typeLower}.`;
167+
return `Discovery log "${title}" created successfully in ${typeLower} with file ${txtPath}.`;
148168
}
149169

150170
// Server setup

0 commit comments

Comments
 (0)