{"id":14006925,"url":"https://github.com/weirongxu/lrc-kit","last_synced_at":"2025-06-26T01:03:55.831Z","repository":{"id":5828237,"uuid":"54020421","full_name":"weirongxu/lrc-kit","owner":"weirongxu","description":"Lyric parser, maker, runner for javascript","archived":false,"fork":false,"pushed_at":"2024-11-21T02:46:14.000Z","size":612,"stargazers_count":30,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-12T01:02:13.637Z","etag":null,"topics":["lrc","lrc-parser","lyric","lyric-parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weirongxu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-16T09:57:14.000Z","updated_at":"2025-04-10T03:56:17.000Z","dependencies_parsed_at":"2023-01-13T13:43:02.820Z","dependency_job_id":"37fa17b0-6f59-4593-a159-fdb2b5d6f852","html_url":"https://github.com/weirongxu/lrc-kit","commit_stats":{"total_commits":72,"total_committers":4,"mean_commits":18.0,"dds":"0.29166666666666663","last_synced_commit":"88a1451cf1a722f8b8343a9023b44f636b8be188"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/weirongxu/lrc-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weirongxu%2Flrc-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weirongxu%2Flrc-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weirongxu%2Flrc-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weirongxu%2Flrc-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weirongxu","download_url":"https://codeload.github.com/weirongxu/lrc-kit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weirongxu%2Flrc-kit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261978910,"owners_count":23239417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lrc","lrc-parser","lyric","lyric-parser"],"created_at":"2024-08-10T10:01:43.035Z","updated_at":"2025-06-26T01:03:55.789Z","avatar_url":"https://github.com/weirongxu.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# LRC Kit\n\n[![NPM version](https://img.shields.io/npm/v/lrc-kit.svg?style=flat-square)](https://npmjs.com/package/lrc-kit)\n[![NPM downloads](https://img.shields.io/npm/dm/lrc-kit.svg?style=flat-square)](https://npmjs.com/package/lrc-kit)\n[![Build Status](https://img.shields.io/travis/weirongxu/lrc-kit/master.svg?style=flat-square)](https://travis-ci.com/weirongxu/lrc-kit)\n\nlrc parser and runner\n\n## Install\nnpm\n```shell\nnpm i -S lrc-kit\n```\n\n## Lrc\n\n### Usage\nimport\n```javascript\nimport { Lrc } from 'lrc-kit';\n```\n\nparse lyric\n```javascript\nvar lrc = Lrc.parse(`\n  [ti:Title]\n  [ar:Lyrics artist]\n  [00:09.010][00:30.000]i guess you're my creep tonight\n`)\n\nlrc.info\n// { ti: 'Title', ar: 'Lyrics artist' }\n\nlrc.lyrics\n// [{\n//   content: \"i guess you're my creep tonight\",\n//   timestamp: 9.01\n// }, {\n//   content: \"i guess you're my creep tonight\",\n//   timestamp: 30.0\n// }]\n```\n\nmake lyric\n```javascript\nvar lrc = new Lrc()\nlrc.info['ar'] = 'Lyrics artist'\nlrc.lyrics.push({\n    content: \"i guess you're my creep tonight\",\n    timestamp: 9.01,\n})\nlrc.lyrics.push({\n    content: \"i guess you're my creep tonight\",\n    timestamp: 30.0,\n})\n\nlrc.toString()\n// [ar:Lyrics artist]\n// [00:30.00][00:09.01]i guess you're my creep tonight\n\nlrc.toString({combine: false})\n// [ar:Lyrics artist]\n// [00:09.01]i guess you're my creep tonight\n// [00:30.00]i guess you're my creep tonight\n\n\nlrc.offset(-3)\nlrc.toString()\n// [ar:Lyrics artist]\n// [00:27.00][00:06.01]i guess you're my creep tonight\n\n```\n\n### API\n\n**Lrc.parse(text)**: \nparse lyirc text and return a lrc object\n\n**Lrc object**\n\n - **lrc.info**\n    lyric info plain object  \n```\n{\n    'ar': 'Lyrics artist',\n    'al': 'Album where the song is from',\n    'ti': 'Lyrics (song) title',\n    'au': 'Creator of the Songtext',\n    'length': 'music length, such as 2:50',\n    'by': 'Creator of the LRC file',\n    'offset': '+/- Overall timestamp adjustment in milliseconds, + shifts time up, - shifts down',\n    're': 'The player or editor that created the LRC file',\n    've': 'version of program',\n}\n```\n\n- **lrc.lyrics**\n    lyric array\n```\n[\n    {\n        content: \"i guess you're my creep tonight\",\n        timestamp: 9.01,\n    },\n    {\n        content: \"The way you knock me off my feet\",\n        timestamp: 12.08,\n    },\n]\n```\n\n- **lrc.offset(offset)**\n    offset all lyrics\n\n- **lrc.toString(options)**\n    generate lyric string\n    - options.combine (boolean) lyrics combine by same content\n    - options.sort (boolean) lyrics sort by timestamp\n    - options.lineFormat (string) newline format\n\n## Runner\n\n### Usage\nimport\n```javascript\nimport { Runner } from 'lrc-kit';\n```\n\nrun\n```javascript\nvar runner = new Runner(Lrc.parse(...))\n\naudio.addEventListener('timeupdate', () =\u003e {\n    runner.timeUpdate(audio.currentTime)\n    var lyric = runner.curLyric()\n    // or\n    var lyric = runner.getLyric(runner.curIndex())\n\n    lyric\n    // {\n    //    content: \"i guess you're my creep tonight\",\n    //    timestamp: 9.01\n    // }\n})\n\n// Modify lyric\nrunner.lrc.lyrics.push({\n    content: \"Now i can't tell my left form right\",\n    timestamp: 17.3,\n})\nrunner.lrcUpdate() // Must call lrcUpdate() when update lyrics\n```\n\n### API\n\n**new Runner(lrc = new Lrc(), offset=true)**\n- `lrc` lrc object\n- `offset` parse lrc.info.offset if offset is true\n\n**Runner object**\n- **runner.setLrc(lrc)** reset the lrc object\n- **runner.lrcUpdate()** call it when lrc updated\n- **runner.timeUpdate(timestamp)** time update\n- **runner.getInfo()** get `runner.lrc.info`\n- **runner.getLyrics()** get `runner.lrc.lyrics`\n- **runner.curIndex()** current index\n- **runner.curLyric()** current lyric\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweirongxu%2Flrc-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweirongxu%2Flrc-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweirongxu%2Flrc-kit/lists"}