musify 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/README.md +38 -209
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,37 +1,46 @@
1
- # 🎵 Musify
1
+ <div align="center">
2
+
3
+ # 🎧 Musify
2
4
 
3
- > **Professional Music Card Generator for Discord Bots**
5
+ > **Professional Music Image Generator for Discord Bots**
4
6
  > *Create stunning, high-performance music cards with elegant glass design and automatic color extraction*
5
7
 
6
- [![npm version](https://img.shields.io/npm/v/musify.svg?style=flat-square)](https://www.npmjs.com/package/musify)
7
- [![npm downloads](https://img.shields.io/npm/dm/musify.svg?style=flat-square)](https://www.npmjs.com/package/musify)
8
- [![License](https://img.shields.io/npm/l/musify.svg?style=flat-square)](https://github.com/Zokys/musify/blob/main/LICENSE)
8
+ <br>
9
+
10
+ [![npm version](https://img.shields.io/npm/v/musify.svg?style=flat-square)](https://www.npmjs.com/package/musify)
11
+ [![npm downloads](https://img.shields.io/npm/dm/musify.svg?style=flat-square)](https://www.npmjs.com/package/musify)
12
+ [![License](https://img.shields.io/npm/l/musify.svg?style=flat-square)](https://github.com/Zokys/musify/blob/main/LICENSE)
9
13
  [![Node.js](https://img.shields.io/node/v/musify.svg?style=flat-square)](https://nodejs.org/)
10
14
 
11
- <div align="center">
15
+ <br><br>
16
+
17
+ # 👀 Preview
18
+
19
+ <img src="https://i.imgur.com/5lEfqA7.png" alt="Musify Preview 1" width="70%" /><br><br>
12
20
 
13
- ![Musify Preview](https://via.placeholder.com/800x200/1c1c1c/FF7A00?text=Musify+Music+Card+Generator)
21
+ <img src="https://i.imgur.com/fZdYnAX.png" alt="Musify Preview 2" width="70%" /><br>
14
22
 
15
- *Elegant music cards for your Discord bot*
23
+ <img src="https://i.imgur.com/ztCvUln.png" alt="Musify Preview 3" width="70%" /><br>
16
24
 
17
25
  </div>
18
26
 
27
+
19
28
  ---
20
29
 
21
30
  ## ✨ Features
22
31
 
23
32
  | Feature | Description |
24
33
  |---------|-------------|
25
- | 🎨 **Glass Design** | Modern, clean music card layout with rounded corners and shadows |
34
+ | 🔎 **Glass Design** | Modern, clean music card layout with rounded corners and shadows |
26
35
  | 🎯 **Auto Color Extraction** | Intelligently extracts dominant colors from thumbnails |
27
- | 🌟 **Background Effects** | Blur, darkness, and overlay controls for stunning visuals |
36
+ | 🪅 **Background Effects** | Blur, darkness, and overlay controls for stunning visuals |
28
37
  | 📏 **Flexible Scaling** | Scale from 0.5x to 2x for different use cases |
29
38
  | ⚡ **High Performance** | Optimized rendering with minimal memory footprint |
30
39
  | 🔧 **TypeScript Ready** | Full TypeScript definitions and IntelliSense support |
31
40
  | 🎵 **Riffy Integration** | Perfect compatibility with Riffy music library |
32
41
  | 🖼️ **Multiple Formats** | Support for URLs, local paths, and buffer inputs |
33
42
 
34
- ## 🚀 Quick Start
43
+ ## 🤔 Quick Start
35
44
 
36
45
  ### Installation
37
46
 
@@ -44,7 +53,7 @@ npm install musify
44
53
  ```typescript
45
54
  import { Glass } from 'musify';
46
55
 
47
- const musicCard = await Glass({
56
+ const Musify = await Glass({
48
57
  thumbnailImage: 'https://example.com/thumbnail.jpg',
49
58
  name: 'Bohemian Rhapsody',
50
59
  author: 'Queen',
@@ -55,12 +64,12 @@ const musicCard = await Glass({
55
64
  });
56
65
  ```
57
66
 
58
- ### Send to Discord
67
+ ### Send to Discord Channel
59
68
 
60
69
  ```typescript
61
70
  await channel.send({
62
71
  files: [{
63
- attachment: musicCard,
72
+ attachment: Musify,
64
73
  name: 'now-playing.png'
65
74
  }]
66
75
  });
@@ -68,14 +77,6 @@ await channel.send({
68
77
 
69
78
  ---
70
79
 
71
- ## 🎨 API Reference
72
-
73
- ### Glass Function
74
-
75
- ```typescript
76
- Glass(options: MusifyOptions): Promise<Buffer>
77
- ```
78
-
79
80
  Generates a professional music card and returns a PNG buffer.
80
81
 
81
82
  ### Configuration Options
@@ -102,12 +103,12 @@ Generates a professional music card and returns a PNG buffer.
102
103
 
103
104
  ---
104
105
 
105
- ## 🎯 Advanced Examples
106
+ ## 🎯 Usage Examples
106
107
 
107
108
  ### Auto Color Extraction
108
109
 
109
110
  ```typescript
110
- const musicCard = await Glass({
111
+ const Musify = await Glass({
111
112
  thumbnailImage: track.info.thumbnail,
112
113
  name: track.info.title,
113
114
  author: track.info.author,
@@ -125,7 +126,7 @@ const musicCard = await Glass({
125
126
  ### Custom Styling
126
127
 
127
128
  ```typescript
128
- const musicCard = await Glass({
129
+ const Musify = await Glass({
129
130
  thumbnailImage: 'https://example.com/thumbnail.jpg',
130
131
  name: 'Custom Styled Track',
131
132
  author: 'Custom Artist',
@@ -146,7 +147,7 @@ const musicCard = await Glass({
146
147
  ### Background Effects
147
148
 
148
149
  ```typescript
149
- const musicCard = await Glass({
150
+ const Musify = await Glass({
150
151
  thumbnailImage: track.info.thumbnail,
151
152
  backgroundImage: track.info.thumbnail, // Use same image as background
152
153
  backgroundBlur: 20, // Strong blur effect
@@ -171,7 +172,7 @@ import { Glass } from 'musify';
171
172
 
172
173
  // Track start event
173
174
  client.riffy.on('trackStart', async (player, track) => {
174
- const musicCard = await Glass({
175
+ const Musify = await Glass({
175
176
  thumbnailImage: track.info.thumbnail,
176
177
  name: track.info.title,
177
178
  author: track.info.author,
@@ -184,7 +185,7 @@ client.riffy.on('trackStart', async (player, track) => {
184
185
 
185
186
  // Send to Discord
186
187
  await player.textChannel.send({
187
- files: [{ attachment: musicCard, name: 'now-playing.png' }]
188
+ files: [{ attachment: Musify, name: 'now-playing.png' }]
188
189
  });
189
190
  });
190
191
 
@@ -195,7 +196,7 @@ setInterval(async () => {
195
196
  const startTime = formatTime(player.position);
196
197
  const endTime = formatTime(player.current.info.length);
197
198
 
198
- const musicCard = await Glass({
199
+ const Musify = await Glass({
199
200
  thumbnailImage: player.current.info.thumbnail,
200
201
  name: player.current.info.title,
201
202
  author: player.current.info.author,
@@ -207,7 +208,7 @@ setInterval(async () => {
207
208
  });
208
209
 
209
210
  // Update message
210
- await message.edit({ files: [{ attachment: musicCard, name: 'now-playing.png' }] });
211
+ await message.edit({ files: [{ attachment: Musify, name: 'now-playing.png' }] });
211
212
  }
212
213
  }, 5000); // Update every 5 seconds
213
214
 
@@ -222,7 +223,7 @@ function formatTime(ms: number): string {
222
223
 
223
224
  ## ⚡ Performance Optimization
224
225
 
225
- ### 1. **Reuse Configuration Objects**
226
+ ### **Reuse Configuration Objects**
226
227
 
227
228
  ```typescript
228
229
  const baseConfig = {
@@ -233,7 +234,7 @@ const baseConfig = {
233
234
  };
234
235
 
235
236
  // Reuse for different tracks
236
- const musicCard1 = await Glass({
237
+ const Musify1 = await Glass({
237
238
  ...baseConfig,
238
239
  thumbnailImage: track1.info.thumbnail,
239
240
  name: track1.info.title,
@@ -241,7 +242,7 @@ const musicCard1 = await Glass({
241
242
  progress: 30
242
243
  });
243
244
 
244
- const musicCard2 = await Glass({
245
+ const Musify2 = await Glass({
245
246
  ...baseConfig,
246
247
  thumbnailImage: track2.info.thumbnail,
247
248
  name: track2.info.title,
@@ -250,7 +251,7 @@ const musicCard2 = await Glass({
250
251
  });
251
252
  ```
252
253
 
253
- ### 2. **Cache Generated Cards**
254
+ ### **Cache Generated Cards**
254
255
 
255
256
  ```typescript
256
257
  const cardCache = new Map();
@@ -262,8 +263,8 @@ async function getCachedCard(trackId: string, progress: number) {
262
263
  return cardCache.get(cacheKey);
263
264
  }
264
265
 
265
- const musicCard = await Glass(options);
266
- cardCache.set(cacheKey, musicCard);
266
+ const Musify = await Glass(options);
267
+ cardCache.set(cacheKey, Musify);
267
268
 
268
269
  // Limit cache size
269
270
  if (cardCache.size > 100) {
@@ -271,180 +272,8 @@ async function getCachedCard(trackId: string, progress: number) {
271
272
  cardCache.delete(firstKey);
272
273
  }
273
274
 
274
- return musicCard;
275
- }
276
- ```
277
-
278
- ### 3. **Batch Processing**
279
-
280
- ```typescript
281
- async function generateMultipleCards(tracks: Track[]) {
282
- const promises = tracks.map(track =>
283
- Glass({
284
- thumbnailImage: track.thumbnail,
285
- name: track.title,
286
- author: track.author,
287
- progress: 0
288
- })
289
- );
290
-
291
- return await Promise.all(promises);
275
+ return Musify;
292
276
  }
293
277
  ```
294
278
 
295
- ---
296
-
297
- ## 🛠️ Development
298
-
299
- ### Building from Source
300
-
301
- ```bash
302
- # Clone repository
303
- git clone https://github.com/Zokys/musify.git
304
- cd musify
305
-
306
- # Install dependencies
307
- npm install
308
-
309
- # Build package
310
- npm run build
311
-
312
- # Run tests
313
- npm test
314
- ```
315
-
316
- ### Development Mode
317
-
318
- ```bash
319
- # Watch for changes
320
- npm run dev
321
-
322
- # Clean build
323
- npm run clean && npm run build
324
- ```
325
-
326
- ### Project Structure
327
-
328
- ```
329
- musify/
330
- ├── src/
331
- │ ├── index.ts # Main entry point
332
- │ ├── renderers/
333
- │ │ └── glassRenderer.ts # Core rendering logic
334
- │ ├── utils/
335
- │ │ ├── colorExtractor.ts # Color extraction
336
- │ │ ├── textProcessor.ts # Text utilities
337
- │ │ └── fontManager.ts # Font management
338
- │ ├── types/
339
- │ │ └── index.ts # TypeScript definitions
340
- │ └── fonts/ # Font assets
341
- ├── dist/ # Compiled output
342
- ├── package.json
343
- └── README.md
344
- ```
345
-
346
- ---
347
-
348
- ## 🐛 Error Handling
349
-
350
- ```typescript
351
- try {
352
- const musicCard = await Glass({
353
- thumbnailImage: track.info.thumbnail,
354
- name: track.info.title,
355
- author: track.info.author,
356
- requester: track.info.requester.username,
357
- progress: 25,
358
- startTime: '1:15',
359
- endTime: '4:30'
360
- });
361
-
362
- await channel.send({
363
- files: [{ attachment: musicCard, name: 'music.png' }]
364
- });
365
-
366
- } catch (error) {
367
- console.error('Failed to generate music card:', error.message);
368
-
369
- // Fallback to text message
370
- await channel.send({
371
- embeds: [{
372
- title: '🎵 Now Playing',
373
- description: `${track.info.title} by ${track.info.author}`,
374
- color: 0xFF7A00
375
- }]
376
- });
377
- }
378
- ```
379
-
380
- ---
381
-
382
- ## 📊 Benchmarks
383
-
384
- | Operation | Time | Memory |
385
- |-----------|------|--------|
386
- | Basic Card Generation | ~50ms | ~2MB |
387
- | With Auto Color Extraction | ~80ms | ~3MB |
388
- | With Background Effects | ~120ms | ~4MB |
389
- | High Resolution (2x scale) | ~200ms | ~8MB |
390
-
391
- *Tested on Node.js 18+ with 8GB RAM*
392
-
393
- ---
394
-
395
- ## 🤝 Contributing
396
-
397
- We welcome contributions! Here's how to get started:
398
-
399
- 1. **Fork** the repository
400
- 2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
401
- 3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
402
- 4. **Push** to the branch (`git push origin feature/amazing-feature`)
403
- 5. **Open** a Pull Request
404
-
405
- ### Development Guidelines
406
-
407
- - Follow TypeScript best practices
408
- - Add tests for new features
409
- - Update documentation
410
- - Ensure cross-platform compatibility
411
- - Optimize for performance
412
-
413
- ---
414
-
415
- ## 📄 License
416
-
417
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
418
-
419
- ---
420
-
421
- ## 🆘 Support
422
-
423
- ### Getting Help
424
-
425
- - 📖 **Documentation**: Check this README and examples
426
- - 🐛 **Issues**: [GitHub Issues](https://github.com/Zokys/musify/issues)
427
- - 💬 **Discussions**: [GitHub Discussions](https://github.com/Zokys/musify/discussions)
428
- - 📧 **Email**: Contact the maintainers directly
429
-
430
- ### Common Issues
431
-
432
- | Issue | Solution |
433
- |-------|----------|
434
- | Font loading errors | Ensure fonts are in `src/fonts/` directory |
435
- | Color extraction fails | Check thumbnail URL accessibility |
436
- | Memory issues | Reduce scale or optimize image sizes |
437
- | Performance problems | Use caching and batch processing |
438
-
439
- ---
440
-
441
- <div align="center">
442
-
443
- **Made with ❤️ for the Discord bot community**
444
-
445
- [![GitHub stars](https://img.shields.io/github/stars/Zokys/musify?style=social)](https://github.com/Zokys/musify)
446
- [![GitHub forks](https://img.shields.io/github/forks/Zokys/musify?style=social)](https://github.com/Zokys/musify)
447
-
448
- *Star this repository if it helped you! ⭐*
449
279
 
450
- </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musify",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Powerful and elegant music image generator for Discord bots featuring high performance, customizable designs, and seamless integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",