@students-dev/audify-js 1.0.0

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.
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Audio queue management
3
+ */
4
+ export class Queue {
5
+ tracks: any[];
6
+ currentIndex: number;
7
+ eventBus: EventBus;
8
+ /**
9
+ * Add track(s) to queue
10
+ * @param {Track|Track[]|string|string[]} tracks - Track(s) to add
11
+ * @param {number} position - Position to insert (optional)
12
+ */
13
+ add(tracks: Track | Track[] | string | string[], position: number): void;
14
+ /**
15
+ * Remove track from queue
16
+ * @param {number|string} identifier - Track index or ID
17
+ * @returns {Track|null} Removed track
18
+ */
19
+ remove(identifier: number | string): Track | null;
20
+ /**
21
+ * Shuffle the queue
22
+ */
23
+ shuffle(): void;
24
+ /**
25
+ * Clear the queue
26
+ */
27
+ clear(): void;
28
+ /**
29
+ * Jump to specific track
30
+ * @param {number} index - Track index
31
+ * @returns {Track|null} Track at index
32
+ */
33
+ jump(index: number): Track | null;
34
+ /**
35
+ * Get current track
36
+ * @returns {Track|null} Current track
37
+ */
38
+ getCurrent(): Track | null;
39
+ /**
40
+ * Get next track
41
+ * @returns {Track|null} Next track
42
+ */
43
+ getNext(): Track | null;
44
+ /**
45
+ * Get previous track
46
+ * @returns {Track|null} Previous track
47
+ */
48
+ getPrevious(): Track | null;
49
+ /**
50
+ * Get all tracks
51
+ * @returns {Track[]} Array of tracks
52
+ */
53
+ getTracks(): Track[];
54
+ /**
55
+ * Get queue size
56
+ * @returns {number} Number of tracks
57
+ */
58
+ size(): number;
59
+ /**
60
+ * Check if queue is empty
61
+ * @returns {boolean} Is empty
62
+ */
63
+ isEmpty(): boolean;
64
+ /**
65
+ * Get track at index
66
+ * @param {number} index - Track index
67
+ * @returns {Track|null} Track at index
68
+ */
69
+ getTrack(index: number): Track | null;
70
+ }
71
+ import { EventBus } from '../events/EventBus.js';
72
+ import { Track } from './Track.js';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Represents an audio track
3
+ */
4
+ export class Track {
5
+ /**
6
+ * @param {string} url - Track URL or file path
7
+ * @param {Object} options - Additional options
8
+ */
9
+ constructor(url: string, options?: any);
10
+ url: string;
11
+ title: any;
12
+ artist: any;
13
+ duration: any;
14
+ thumbnail: any;
15
+ metadata: any;
16
+ id: any;
17
+ /**
18
+ * Get track info
19
+ * @returns {Object} Track information
20
+ */
21
+ getInfo(): any;
22
+ /**
23
+ * Update track metadata
24
+ * @param {Object} metadata - New metadata
25
+ */
26
+ updateMetadata(metadata: any): void;
27
+ /**
28
+ * Check if track is valid
29
+ * @returns {boolean} Is valid
30
+ */
31
+ isValid(): boolean;
32
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Logger utility with different levels
3
+ */
4
+ export class Logger {
5
+ constructor(level?: string);
6
+ levels: {
7
+ debug: number;
8
+ info: number;
9
+ warn: number;
10
+ error: number;
11
+ };
12
+ currentLevel: any;
13
+ /**
14
+ * Set log level
15
+ * @param {string} level - Log level (debug, info, warn, error)
16
+ */
17
+ setLevel(level: string): void;
18
+ /**
19
+ * Debug log
20
+ * @param {...*} args - Arguments to log
21
+ */
22
+ debug(...args: any[]): void;
23
+ /**
24
+ * Info log
25
+ * @param {...*} args - Arguments to log
26
+ */
27
+ info(...args: any[]): void;
28
+ /**
29
+ * Warning log
30
+ * @param {...*} args - Arguments to log
31
+ */
32
+ warn(...args: any[]): void;
33
+ /**
34
+ * Error log
35
+ * @param {...*} args - Arguments to log
36
+ */
37
+ error(...args: any[]): void;
38
+ }
39
+ export const logger: Logger;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Metadata parsing utilities
3
+ */
4
+ export class MetadataUtils {
5
+ /**
6
+ * Extract basic metadata from URL or file path
7
+ * @param {string} source - URL or file path
8
+ * @returns {Object} Metadata object
9
+ */
10
+ static extract(source: string): any;
11
+ /**
12
+ * Extract title from source
13
+ * @param {string} source - Source string
14
+ * @returns {string} Extracted title
15
+ */
16
+ static extractTitle(source: string): string;
17
+ /**
18
+ * Extract YouTube metadata (basic)
19
+ * @param {string} url - YouTube URL
20
+ * @returns {Object} Metadata
21
+ */
22
+ static extractYouTubeMetadata(url: string): any;
23
+ /**
24
+ * Extract SoundCloud metadata (basic)
25
+ * @param {string} url - SoundCloud URL
26
+ * @returns {Object} Metadata
27
+ */
28
+ static extractSoundCloudMetadata(url: string): any;
29
+ /**
30
+ * Extract file metadata (basic)
31
+ * @param {string} path - File path
32
+ * @returns {Object} Metadata
33
+ */
34
+ static extractFileMetadata(path: string): any;
35
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Audio probing utilities
3
+ */
4
+ export class ProbeUtils {
5
+ /**
6
+ * Probe audio file/stream for basic info
7
+ * @param {string|Buffer|ReadableStream} source - Audio source
8
+ * @returns {Promise<Object>} Probe result
9
+ */
10
+ static probe(source: string | Buffer | ReadableStream): Promise<any>;
11
+ /**
12
+ * Check if source is a valid audio URL
13
+ * @param {string} url - URL to check
14
+ * @returns {boolean} Is valid audio URL
15
+ */
16
+ static isValidAudioUrl(url: string): boolean;
17
+ /**
18
+ * Get audio format from URL or buffer
19
+ * @param {string|Buffer} source - Audio source
20
+ * @returns {string|null} Audio format
21
+ */
22
+ static getFormat(source: string | Buffer): string | null;
23
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Time formatting utilities
3
+ */
4
+ export class TimeUtils {
5
+ /**
6
+ * Format seconds to MM:SS or HH:MM:SS
7
+ * @param {number} seconds - Time in seconds
8
+ * @returns {string} Formatted time string
9
+ */
10
+ static format(seconds: number): string;
11
+ /**
12
+ * Parse time string to seconds
13
+ * @param {string} timeStr - Time string like "1:23" or "01:23:45"
14
+ * @returns {number} Time in seconds
15
+ */
16
+ static parse(timeStr: string): number;
17
+ /**
18
+ * Get current timestamp in milliseconds
19
+ * @returns {number} Current time
20
+ */
21
+ static now(): number;
22
+ /**
23
+ * Calculate duration between two timestamps
24
+ * @param {number} start - Start time
25
+ * @param {number} end - End time
26
+ * @returns {number} Duration in milliseconds
27
+ */
28
+ static duration(start: number, end: number): number;
29
+ }
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@students-dev/audify-js",
3
+ "version": "1.0.0",
4
+ "description": "Modern modular audio engine with queue, filters, plugin API, and event-driven design.",
5
+ "type": "module",
6
+ "main": "dist/cjs/index.js",
7
+ "module": "dist/esm/index.js",
8
+ "types": "dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/esm/index.js",
12
+ "require": "./dist/cjs/index.js",
13
+ "types": "./dist/types/index.d.ts"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "tsc && rollup -c",
18
+ "dev": "rollup -c -w",
19
+ "test": "jest",
20
+ "lint": "eslint src/**/*.js",
21
+ "typecheck": "tsc --noEmit"
22
+ },
23
+ "keywords": [
24
+ "audio",
25
+ "engine",
26
+ "playback",
27
+ "queue",
28
+ "filters",
29
+ "plugins",
30
+ "javascript",
31
+ "nodejs",
32
+ "browser"
33
+ ],
34
+ "author": "Students Dev",
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/students-dev/audify-js.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/students-dev/audify-js/issues"
42
+ },
43
+ "homepage": "https://github.com/students-dev/audify-js#readme",
44
+ "devDependencies": {
45
+ "@rollup/plugin-node-resolve": "^15.0.0",
46
+ "@rollup/plugin-commonjs": "^25.0.0",
47
+ "rollup": "^4.0.0",
48
+ "rollup-plugin-dts": "^6.0.0",
49
+ "typescript": "^5.0.0",
50
+ "jest": "^29.0.0",
51
+ "eslint": "^8.0.0"
52
+ },
53
+ "engines": {
54
+ "node": ">=14.0.0"
55
+ },
56
+ "files": [
57
+ "dist",
58
+ "README.md"
59
+ ]
60
+ }