Compare commits

...

83 Commits

Author SHA1 Message Date
Nemo 4d1bea0d0f run local prettier instead of global one 2023-12-14 15:40:23 +05:30
Nemo a94395ea9d drop node 16 2023-12-14 15:15:41 +05:30
Nemo 8019310674 fix prettier warnings 2023-12-14 15:15:31 +05:30
Nemo 1a2d485d10 dependency updates 2023-12-14 11:34:36 +05:30
dependabot[bot] 7cce1333f1 Bump prettier from 3.0.0 to 3.0.1
Bumps [prettier](https://github.com/prettier/prettier) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.0.0...3.0.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-05 09:30:21 +05:30
Nemo 1b9a02fa20 prettier fixes 2023-07-31 15:02:08 +05:30
dependabot[bot] cbc90f7110 Bump prettier from 2.8.8 to 3.0.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-31 15:02:08 +05:30
dependabot[bot] b785434c45 Bump ytdl-core from 4.11.4 to 4.11.5
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.11.4 to 4.11.5.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.11.4...v4.11.5)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-15 09:35:06 +05:30
dependabot[bot] 7c43700c11 Bump cacheable-request and got
Bumps [cacheable-request](https://github.com/jaredwray/cacheable-request) and [got](https://github.com/sindresorhus/got). These dependencies needed to be updated together.

Updates `cacheable-request` from 7.0.2 to 10.2.7
- [Release notes](https://github.com/jaredwray/cacheable-request/releases)
- [Commits](https://github.com/jaredwray/cacheable-request/commits)

Updates `got` from 12.3.1 to 12.5.3
- [Release notes](https://github.com/sindresorhus/got/releases)
- [Commits](https://github.com/sindresorhus/got/compare/v12.3.1...v12.5.3)

---
updated-dependencies:
- dependency-name: cacheable-request
  dependency-type: indirect
- dependency-name: got
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 13:31:07 +05:30
dependabot[bot] 33741a50e7 Bump prettier from 2.8.7 to 2.8.8
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.7 to 2.8.8.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.7...2.8.8)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 13:30:42 +05:30
dependabot[bot] 3bd269e517 Bump semver from 7.3.7 to 7.5.3
Bumps [semver](https://github.com/npm/node-semver) from 7.3.7 to 7.5.3.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.7...v7.5.3)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 13:30:29 +05:30
dependabot[bot] 2a67cc7c0b Bump ytdl-core from 4.11.3 to 4.11.4
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.11.3 to 4.11.4.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.11.3...v4.11.4)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-14 11:17:29 +05:30
dependabot[bot] 51a50b8a11 Bump minimist from 1.2.7 to 1.2.8
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.7 to 1.2.8.
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.7...v1.2.8)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-07 01:02:24 +05:30
dependabot[bot] 7c97cc9bc3 Bump http-cache-semantics from 4.1.0 to 4.1.1
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-07 01:02:17 +05:30
dependabot[bot] ce3c11a820 Bump prettier from 2.8.2 to 2.8.7
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.2 to 2.8.7.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.2...2.8.7)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-07 01:02:11 +05:30
dependabot[bot] d376b3ad3d Bump ytdl-core from 4.11.2 to 4.11.3
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.11.2 to 4.11.3.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.11.2...v4.11.3)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-07 01:01:46 +05:30
dependabot[bot] 6af3c1da60 Bump prettier from 2.8.1 to 2.8.2
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.1 to 2.8.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.1...2.8.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-10 06:34:07 +00:00
dependabot[bot] 68bf09689a Bump prettier from 2.8.0 to 2.8.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.0...2.8.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-13 11:41:46 +05:30
dependabot[bot] 84c23243d3 Bump mocha from 10.1.0 to 10.2.0
Bumps [mocha](https://github.com/mochajs/mocha) from 10.1.0 to 10.2.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.1.0...v10.2.0)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-13 11:39:33 +05:30
dependabot[bot] 1e9bace48d Bump prettier from 2.7.1 to 2.8.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.7.1 to 2.8.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.7.1...2.8.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-24 11:02:23 +05:30
dependabot[bot] 00af711bf6 Bump minimist from 1.2.6 to 1.2.7
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.6 to 1.2.7.
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 17:37:05 +05:30
dependabot[bot] 278aebf32f Bump mocha from 10.0.0 to 10.1.0
Bumps [mocha](https://github.com/mochajs/mocha) from 10.0.0 to 10.1.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.0.0...v10.1.0)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 15:02:27 +05:30
dependabot[bot] 1743561886 Bump ytdl-core from 4.11.1 to 4.11.2
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.11.1 to 4.11.2.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.11.1...v4.11.2)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-07 15:08:21 +05:30
Nemo f4f0e4db76 1.0.10 2022-08-26 18:36:36 +05:30
Nemo 8a570f74ad Prettier fixes 2022-08-26 18:36:33 +05:30
Nemo 5ba24e95db Fixes #75
Drops any tracks that start after the track length (as per YouTube).
We can add a flag for making this optional in case it is needed
2022-08-26 18:33:06 +05:30
Nemo 91242ce61f [ci] Dropped support for Node v16 2022-08-26 17:58:15 +05:30
Nemo 34acfe769e [style] Fix lint issues 2022-08-26 17:55:45 +05:30
Nemo 0012c3b083 [fix] Fixes #74
Leading zeroes are nice
2022-08-26 17:51:19 +05:30
Nemo 93321c6fb9 [docs] Update CHANGELOG 2022-08-26 17:22:07 +05:30
Nemo 25e0081c6d 1.0.9 2022-08-26 17:22:07 +05:30
Nemo 9245d84332 [dep] dependency updates 2022-08-26 17:22:05 +05:30
Nemo bb11d6e9a8
Create FUNDING.yml 2022-05-27 07:18:57 +00:00
Nemo ce4074f829 [ci] Use supported Node versions 2022-05-03 13:02:33 +05:30
dependabot[bot] 25ff38e93e Bump mocha from 9.2.2 to 10.0.0
Bumps [mocha](https://github.com/mochajs/mocha) from 9.2.2 to 10.0.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.2.2...v10.0.0)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-03 13:02:33 +05:30
dependabot[bot] 343fbda261 Bump prettier from 2.6.1 to 2.6.2
Bumps [prettier](https://github.com/prettier/prettier) from 2.6.1 to 2.6.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.6.1...2.6.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-22 12:15:15 +05:30
dependabot[bot] f53aed7dec Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-22 12:14:45 +05:30
dependabot[bot] 531ad3de3f Bump prettier from 2.6.0 to 2.6.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.6.0...2.6.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 09:43:40 +05:30
dependabot[bot] c185212b14 Bump prettier from 2.5.1 to 2.6.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.5.1 to 2.6.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.5.1...2.6.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 11:09:14 +05:30
dependabot[bot] 869487e153 Bump mocha from 9.2.1 to 9.2.2
Bumps [mocha](https://github.com/mochajs/mocha) from 9.2.1 to 9.2.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.2.1...v9.2.2)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-12 10:52:58 +05:30
Nemo 98f17e55d3 [docs] CHANGELOG update 2022-03-11 11:27:52 +05:30
Nemo f281a42a2e 1.0.8 2022-03-11 11:26:30 +05:30
Nemo 242e08bc1b [deps] Update 2022-03-11 11:26:27 +05:30
dependabot[bot] e83debe2bf Bump ytdl-core from 4.10.1 to 4.11.0
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.10.1 to 4.11.0.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.10.1...v4.11.0)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-08 12:15:11 +05:30
dependabot[bot] 9925d6e578 Bump ytdl-core from 4.10.0 to 4.10.1
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.10.0 to 4.10.1.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.10.0...v4.10.1)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-04 17:10:09 +05:30
Nemo 0986305a50 1.0.7 2022-01-24 16:31:29 +05:30
Nemo a08e1cd3b3 deps update 2022-01-24 16:31:26 +05:30
dependabot[bot] 4744bb604f Bump mocha from 9.1.3 to 9.1.4
Bumps [mocha](https://github.com/mochajs/mocha) from 9.1.3 to 9.1.4.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.1.3...v9.1.4)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-15 18:23:25 +05:30
dependabot[bot] 42a3dfb872 Bump ytdl-core from 4.9.2 to 4.10.0
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.9.2 to 4.10.0.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.9.2...v4.10.0)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-12 06:33:04 +05:30
Nemo 8c3a3a7ec6 [dep] Dependency updates 2021-12-16 12:11:27 +05:30
dependabot[bot] 3acd787d0d Bump prettier from 2.5.0 to 2.5.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.5.0 to 2.5.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.5.0...2.5.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-09 11:02:23 +05:30
dependabot[bot] 4f136dcf42 Bump prettier from 2.4.1 to 2.5.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.4.1 to 2.5.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.4.1...2.5.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-26 09:47:10 +00:00
dependabot[bot] 5b65a76e6c Bump mocha from 9.1.2 to 9.1.3
Bumps [mocha](https://github.com/mochajs/mocha) from 9.1.2 to 9.1.3.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.1.2...v9.1.3)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-16 10:59:01 +05:30
dependabot[bot] f6acc1bdd8 Bump mocha from 9.1.1 to 9.1.2
Bumps [mocha](https://github.com/mochajs/mocha) from 9.1.1 to 9.1.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.1.1...v9.1.2)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-28 12:22:16 +05:30
dependabot[bot] 1cb210d64c Bump prettier from 2.4.0 to 2.4.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.4.0...2.4.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-17 12:31:33 +05:30
dependabot[bot] 666e802cfe Bump prettier from 2.3.2 to 2.4.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.3.2 to 2.4.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.2...2.4.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-10 09:58:23 +05:30
dependabot[bot] 5046823854 Bump mocha from 9.1.0 to 9.1.1
Bumps [mocha](https://github.com/mochajs/mocha) from 9.1.0 to 9.1.1.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.1.0...v9.1.1)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 11:29:51 +05:30
dependabot[bot] 741d74ddf1 Bump mocha from 9.0.3 to 9.1.0
Bumps [mocha](https://github.com/mochajs/mocha) from 9.0.3 to 9.1.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.0.3...v9.1.0)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-21 12:28:28 +05:30
dependabot[bot] 67012ca4ac Bump ytdl-core from 4.9.0 to 4.9.1
Bumps [ytdl-core](https://github.com/fent/node-ytdl-core) from 4.9.0 to 4.9.1.
- [Release notes](https://github.com/fent/node-ytdl-core/releases)
- [Commits](https://github.com/fent/node-ytdl-core/compare/v4.9.0...v4.9.1)

---
updated-dependencies:
- dependency-name: ytdl-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-09 16:18:11 +05:30
Nemo 8724ba85aa
Merge pull request #77 from captn3m0/update-notice
Add package-upgrade notice and --version
2021-07-29 11:48:49 +05:30
Nemo 68e53896b9 [docs] Update CHANGELOG 2021-07-29 11:47:46 +05:30
Nemo 30effce43b Add package-upgrade notice and --version 2021-07-29 11:44:23 +05:30
Nemo 2eadb53b8f
Add prettier as linter 2021-07-29 11:28:30 +05:30
Nemo 44e68fc140 [ci] Add prettier to CI 2021-07-29 11:25:55 +05:30
Nemo 9cc3cd4228 [style] Run everything through prettier 2021-07-29 11:21:39 +05:30
Nemo bcae4ebeb1 [dep] Add Prettier 2021-07-29 11:21:29 +05:30
Nemo e0f05fe646 Version Bump (1.0.6) 2021-07-29 11:12:37 +05:30
Nemo 610c13fcef
Parse Duration 2021-07-29 11:11:58 +05:30
Nemo 089c46d978 Prep for next release 2021-07-28 17:28:24 +05:30
Nemo 1aa0be59da Change flags to --timestamps and --durations 2021-07-28 17:22:36 +05:30
Nemo c4b1b42461 feat: Parse as durations IFF first timestamp is >0 2021-07-28 17:22:05 +05:30
dependabot[bot] a710658b49 Bump mocha from 9.0.2 to 9.0.3
Bumps [mocha](https://github.com/mochajs/mocha) from 9.0.2 to 9.0.3.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.0.2...v9.0.3)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 11:22:38 +05:30
Nemo a737d37105 [docs] Update README as per #72 2021-07-21 13:50:48 +05:30
Nemo 7247b7be66 Add a --timestamps-are-durations flag 2021-07-21 13:44:47 +05:30
Nemo 10981c62ce Force timestamps using --timestamps-only 2021-07-21 13:30:42 +05:30
Nemo b0fd29cbdb [ci] Run tests on all supported node versions 2021-07-21 13:22:32 +05:30
Nemo deca378937 Parse durations correctly 2021-07-21 13:20:19 +05:30
Nemo 3fdb7739ff Add testcase for parsing duration
Ref #68
2021-07-21 12:10:28 +05:30
Nemo ce845195cf [dep] Dependency Updates 2021-07-21 12:08:49 +05:30
Nemo d47844fe3b Add some badges 2021-06-28 23:54:47 +05:30
Nemo 3f9eb44d58
Create config.yml 2021-06-28 10:05:14 +00:00
Nemo 3c916c93ec Update issue templates 2021-06-28 09:59:52 +00:00
Nemo ecd52f60d1 [docs] Update output_file as optional in README 2021-06-28 15:22:10 +05:30
15 changed files with 1625 additions and 1206 deletions

3
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,3 @@
github: captn3m0
ko_fi: captn3m0
liberapay: captn3m0

View File

@ -0,0 +1,29 @@
---
name: 'Bug Report: Incorrect CUE sheet'
about: Create a bug report if youtube-cue fails to work on a specific Youtube Video
title: "[BUG] Failed on a Youtube link"
labels: bug
assignees: ''
---
**Youtube URL**
Type the Youtube URL you tried here.
**Command you ran**
Type the complete command you typed, such as:
youtube-cue https://www.youtube.com/watch?v=XsRAAp-Ivuc
**Output**
Give complete output here, if you got any
**Version Information**
Paste the output of `npm list -g --depth=0 youtube-cue` here
**Additional context**
Add any other context about the problem here.

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Need support?
url: https://github.com/captn3m0/youtube-cue/discussions/new?category=q-a
about: Please ask and answer questions here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -1,13 +1,17 @@
on: push
name: Main Workflow
jobs:
runNpmStuff:
tests:
strategy:
matrix:
node: ["18", "20", "21"]
name: Run NPM Stuff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
with:
node-version: '16'
- run: npm install
- run: npm test
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
with:
node-version: ${{matrix.node}}
- run: npm install
- run: npm run lint
- run: npm run test

View File

@ -1,4 +1,5 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@ -6,21 +7,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
## 1.0.4 - 2021-06-28
## 1.0.9
### Changed
- Dependency Updates
- Minimum NodeJS version is now v14
## 1.0.8
### Added
- Dependency Updates
## 1.0.7
### Added
- `--version` is now supported
- An update notification is shown if the package isn't latest.
## 1.0.6 - 2021-07-29
### Added
- Tracklists using duration instead of timestamps are now supported.
## 1.0.5 - 2021-07-21
### Changed
- Dependency Updates
## 1.0.4 - 2021-06-28
### Added
- Support for timestamps in square brackets (#64)
- Improved formatting for helptext
### Changed
- output filename has a default value, and is now optional
## 1.0.3 - 2021-06-28
### Changed
- Dependency Updates
## 1.0.2 - 2021-06-10
### Changed
- Switches from `mocha` to `minimist` to parse arguments. Now down to 9 total (recursive) dependencies.
## 1.01 - 2021-06-10
### Changed
- Dependency Updates

View File

@ -1,4 +1,4 @@
# youtube-cue
# youtube-cue ![npm](https://img.shields.io/npm/v/youtube-cue) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/youtube-cue) ![NPM](https://img.shields.io/npm/l/youtube-cue) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/youtube-cue) [![Total Dependencies](https://img.shields.io/badge/Total%20Dependencies-4-orange)](https://www.npmjs.com/package/youtube-cue)
Generate CUE sheet from timestamps in youtube video description.
@ -8,7 +8,7 @@ Generate CUE sheet from timestamps in youtube video description.
2. The video has timestamps in the video description.
3. The video is publicly available on Youtube.
`youtube-cue` will read the video description, get the timestamps and generate a [CUE sheet][cue] accordingly.
`youtube-cue` will read the video description, get the timestamps and generate a [CUE sheet][cue] accordingly. It will also work if track durations are used instead of timestamps.
## Anti-features
@ -31,21 +31,33 @@ For all of the above, there are better tools available, such as [youtube-dl](htt
You need to pass 2 parameters, a Youtube URL and a output CUE filename. YouTube short URLs (`youtu.be`) are accepted. You can additionally pass a `audio-file` argument which is used for the [`FILE` specified in the CUE file][cuefile].
$ youtube-cue [--audio-file audio.m4a] <youtube_url> <output.cue>
youtube-cue [--audio-file audio.m4a] <youtube_url> [output_file]
Options
--help, Show help
--audio-file, Input Audio File (optional)
--audio-file, Input Audio File (optional) that is written to the CUE sheet
The default audio file is set to %VIDEOTITLE.m4a
The default output file is set to %VIDEOTITLE.cue
where $VIDEOTITLE is the title of the YouTube video.
Generally the parser detects whether numbers are positional timestamps or track durations.
To enforce a desired interpretation you can use these flags:
--timestamps Parse as positional timestamps (relative to the start of the playlist)
--durations Parse as track durations
The above 2 are only needed to force behaviour in
very specific edge cases, they should not be required for most files.
Examples
$ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=THzUassmQwE" output.cue
output.cue saved
$ youtube-cue "https://youtu.be/THzUassmQwE" folklore.cue
folklore.cue saved
$ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=WzpmVxvoBoc" "The Groovy Nobody - Solarium.cue"
"The Groovy Nobody - Solarium.cue" saved
## Personal Usage
I have this in my `.bashrc` to download, split, tag, and import albums:
I have this in my `.bashrc` to download, split, tag, and import albums using beet:
```shell
function ytdl.album() {
@ -61,7 +73,7 @@ function ytdl.album() {
## HACKING
- If this video does not work on a specific video, please attach the complete output
- If it does not work on a specific video, please attach the complete output
- Pull Requests are welcome that add support for a better parser without breaking the existing tests
- Please add tests for any new functionality

View File

@ -1,15 +1,22 @@
#!/usr/bin/env node
import ytdl from 'ytdl-core';
import getArtistTitle from 'get-artist-title'
import {parse} from './src/parser.js'
import {generate} from './src/cue.js'
import minimist from 'minimist'
import ytdl from "ytdl-core";
import getArtistTitle from "get-artist-title";
import { parse } from "./src/parser.js";
import { generate } from "./src/cue.js";
import minimist from "minimist";
import exit from "process";
import updateNotifier from "update-notifier";
import pkg from "./src/package.js";
updateNotifier({ pkg }).notify();
let argv = minimist(process.argv.slice(2), {
string: 'audio-file'
string: "audio-file",
});
if (argv._.length <1 || argv.help ){
if (argv.version) {
console.log(pkg.version);
} else if (argv._.length < 1 || argv.help) {
console.log(`Usage
$ youtube-cue [--audio-file audio.m4a] <youtube_url> [output_file]
@ -22,27 +29,54 @@ if (argv._.length <1 || argv.help ){
where $VIDEOTITLE is the title of the YouTube video.
Generally the parser detects whether numbers are positional timestamps or track durations.
To enforce a desired interpretation you can use these flags:
--timestamps Parse as positional timestamps (relative to the start of the playlist)
--durations Parse as track durations
The above 2 are only needed to force behaviour in very specific edge cases, they should
not be required for most files.
--version Print version
Examples
$ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=THzUassmQwE"
"T A Y L O R S W I F T Folklore [Full album].cue" saved
$ youtube-cue "https://youtu.be/THzUassmQwE" folklore.cue
folklore.cue saved`)
folklore.cue saved`);
} else {
let url = argv._[0]
let url = argv._[0];
ytdl.getInfo(url).then(info=>{
let audioFile = argv['audio-file']? argv['audio-file'] : `${info.videoDetails.title}.m4a`
ytdl.getInfo(url).then((info) => {
let audioFile = argv["audio-file"]
? argv["audio-file"]
: `${info.videoDetails.title}.m4a`;
let output_file = argv._[1]? argv._[1] : `${info.videoDetails.title}.cue`
let output_file = argv._[1] ? argv._[1] : `${info.videoDetails.title}.cue`;
let res = getArtistTitle(info.videoDetails.title,{
let forceTimestamps = argv["timestamps"] ? argv["timestamps"] : false;
let forceDurations = argv["durations"] ? argv["durations"] : false;
if (forceTimestamps && forceDurations) {
console.error("You can't pass both --timestamps and durations");
exit(1);
}
let res = getArtistTitle(info.videoDetails.title, {
defaultArtist: "Unknown Artist",
defaultTitle: info.videoDetails.title
defaultTitle: info.videoDetails.title,
});
let [artist, album] = res
artist = (info.videoDetails.media ? info.videoDetails.media.artist : artist)
let tracks = parse(info.videoDetails.description, {artist})
generate({tracks, artist, audioFile, album}, output_file)
console.log(`"${output_file}" saved`)
})
let [artist, album] = res;
artist = info.videoDetails.media ? info.videoDetails.media.artist : artist;
let tracks = parse(info.videoDetails.description, {
artist,
forceTimestamps,
forceDurations,
length: Number(info.videoDetails.lengthSeconds),
});
generate({ tracks, artist, audioFile, album }, output_file);
console.log(`"${output_file}" saved`);
});
}

2149
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +1,25 @@
{
"name": "youtube-cue",
"version": "1.0.4",
"version": "1.0.10",
"description": "Generates Cue sheet from Youtube URL",
"main": "index.js",
"scripts": {
"test": "mocha"
"test": "mocha",
"lint": "prettier --check *.js src/*.js test/*.js"
},
"bin": "index.js",
"author": "Nemo <npm@captnemo.in>",
"license": "MIT",
"devDependencies": {
"mocha": "^9.0.0"
"mocha": "^10.0.0",
"prettier": "^3.1.0"
},
"dependencies": {
"console-log-level": "^1.4.1",
"get-artist-title": "^1.3.1",
"minimist": "^1.2.5",
"ytdl-core": "^4.8.2"
"minimist": "^1.2.8",
"update-notifier": "^7.0.0",
"ytdl-core": "^4.11.5"
},
"repository": {
"type": "git",

View File

@ -1,21 +1,27 @@
import fs from 'fs';
import fs from "fs";
/** code to create a new CUE file, as per the standard
* with a REM PERFORMER, TITLE, FILE attribute
* and a list of tracks provided as input
*/
// https://en.wikipedia.org/wiki/Cue_sheet_(computing)
export function generate(data, outputFile) {
try {
fs.truncateSync(outputFile)
fs.truncateSync(outputFile);
} catch {}
fs.appendFileSync(outputFile, `REM Generated using youtube-cue\n`);
fs.appendFileSync(outputFile, `PERFORMER "${data.artist}"\n`);
fs.appendFileSync(outputFile, `TITLE "${data.album}"\n`);
fs.appendFileSync(outputFile, `FILE "${data.audioFile}" M4A\n`);
for(var i in data.tracks) {
for (var i in data.tracks) {
let song = data.tracks[i];
let minutes = (song.start.hh * 60) + (song.start.mm)
let minutes = String(song.start.hh * 60 + song.start.mm).padStart(2, "0");
let seconds = String(song.start.ss).padStart(2, "0");
fs.appendFileSync(outputFile, ` TRACK ${song.track} AUDIO\n`);
fs.appendFileSync(outputFile, ` TITLE "${song.title}"\n`);
fs.appendFileSync(outputFile, ` PERFORMER "${song.artist}"\n`);
// Cue File is always MINUTES:SECONDS:FRAME, where FRAME is 00
fs.appendFileSync(outputFile, ` INDEX 01 ${minutes}:${song.start.ss}:00\n`);
fs.appendFileSync(outputFile, ` INDEX 01 ${minutes}:${seconds}:00\n`);
}
}

5
src/package.js Normal file
View File

@ -0,0 +1,5 @@
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const data = require("../package.json");
export default data;

View File

@ -20,94 +20,184 @@
*
* It is suggested to check their lengths and pick one to parse as the Track Title
*/
const TS_REGEX = /^((?<trackl>\d{1,3})\.)? *(?<text_1>.*?) *[\(\[]?(?<start_ts>((?<start_hh>\d{1,2}):)?(?<start_mm>\d{1,2}):(?<start_ss>\d{1,2})) *-? *[\)\]]?(?<end_ts>(?<end_hh>\d{1,2}:)?(?<end_mm>\d{1,2}):(?<end_ss>\d{1,2}))? *((?<trackr>\d{1,3})\.)? *(?<text_2>.*?)$/;
import getArtistTitle from 'get-artist-title'
const TS_REGEX =
/^((?<trackl>\d{1,3})\.)? *(?<text_1>.*?) *[\(\[]?(?<start_ts>((?<start_hh>\d{1,2}):)?(?<start_mm>\d{1,2}):(?<start_ss>\d{1,2})) *-? *[\)\]]?(?<end_ts>(?<end_hh>\d{1,2}:)?(?<end_mm>\d{1,2}):(?<end_ss>\d{1,2}))? *((?<trackr>\d{1,3})\.)? *(?<text_2>.*?)$/;
import getArtistTitle from "get-artist-title";
var _options = {};
function convertTime(h,m,s) {
return (+h) * 60 * 60 + (+m) * 60 + (+s)
// Returns number of total seconds
function convertTime(h, m, s) {
return +h * 60 * 60 + +m * 60 + +s;
}
var filterTimestamp = function(line) {
return TS_REGEX.test(line)
// Only picks out lines which have a timestamp in them
var filterTimestamp = function (line) {
return TS_REGEX.test(line);
};
var firstPass = function(line) {
// Parse each line as per the regex
var firstPass = function (line) {
let matches = line.match(TS_REGEX);
let track = matches.groups['trackl'] ? +matches.groups['trackl'] : (matches.groups['trackr'] ? +matches.groups['trackr'] : null)
let track = matches.groups["trackl"]
? +matches.groups["trackl"]
: matches.groups["trackr"]
? +matches.groups["trackr"]
: null;
return {
track: track,
start: {
ts: matches.groups['start_ts'].length<6 ? `00:${matches.groups['start_ts']}` : matches.groups['start_ts'],
hh: matches.groups['start_hh'] ? +matches.groups['start_hh'] : 0,
ts:
matches.groups["start_ts"].length < 6
? `00:${matches.groups["start_ts"]}`
: matches.groups["start_ts"],
hh: matches.groups["start_hh"] ? +matches.groups["start_hh"] : 0,
// These 2 are always set
mm: +matches.groups['start_mm'],
ss: +matches.groups['start_ss'],
mm: +matches.groups["start_mm"],
ss: +matches.groups["start_ss"],
},
end: (matches.groups['end_ts']!==undefined ? {
ts: matches.groups['end_ts']? matches.groups['end_ts'] : null,
hh: matches.groups['end_hh']? +matches.groups['end_hh'] : null,
mm: matches.groups['end_mm']? +matches.groups['end_mm'] : null,
ss: matches.groups['end_ss']? +matches.groups['end_ss'] : null,
} : null),
end:
matches.groups["end_ts"] !== undefined
? {
ts: matches.groups["end_ts"] ? matches.groups["end_ts"] : null,
hh: matches.groups["end_hh"] ? +matches.groups["end_hh"] : null,
mm: matches.groups["end_mm"] ? +matches.groups["end_mm"] : null,
ss: matches.groups["end_ss"] ? +matches.groups["end_ss"] : null,
}
: null,
_: {
left_text: matches.groups['text_1'],
right_text: matches.groups['text_2']
}
}
left_text: matches.groups["text_1"],
right_text: matches.groups["text_2"],
},
};
};
var calcTimestamp = function(obj) {
if(obj.end) {
obj.end.calc = convertTime(obj.end.hh,obj.end.mm,obj.end.ss)
// Add a calc attribute with total seconds
var calcTimestamp = function (obj) {
if (obj.end) {
obj.end.calc = convertTime(obj.end.hh, obj.end.mm, obj.end.ss);
}
obj.start.calc = convertTime(obj.start.hh,obj.start.mm,obj.start.ss)
return obj
}
obj.start.calc = convertTime(obj.start.hh, obj.start.mm, obj.start.ss);
return obj;
};
var parseTitle = function(obj) {
obj.title = obj._.left_text.length > obj._.right_text.length
? obj._.left_text : obj._.right_text;
return obj
}
// Pick the longer "text" from left or right side.
var parseTitle = function (obj) {
obj.title =
obj._.left_text.length > obj._.right_text.length
? obj._.left_text
: obj._.right_text;
return obj;
};
var parseArtist = function(obj) {
// Parse the text as the title/artist
var parseArtist = function (obj) {
let [artist, title] = getArtistTitle(obj.title, {
defaultArtist: _options.artist,
defaultTitle: obj.title
defaultTitle: obj.title,
});
obj.artist = artist
obj.title = title
return obj
obj.artist = artist;
obj.title = title;
return obj;
};
var addTrack = function(obj, index) {
if (obj.track==null) {
obj.track = index+1
// If track numbers are not present, add them accordingly
var addTrack = function (obj, index) {
if (obj.track == null) {
obj.track = index + 1;
}
return obj
}
return obj;
};
var addEnd = function(obj, index, arr) {
// Add "end" timestamps as next start timestamps
var addEnd = function (obj, index, arr) {
if (!obj.end) {
if(arr.length!=index+1) {
let next = arr[index+1]
obj.end = next.start
return obj
if (arr.length != index + 1) {
let next = arr[index + 1];
obj.end = next.start;
return obj;
}
}
return obj
}
return obj;
};
export function parse (text, options = { artist: 'Unknown' }) {
var timeToObject = function (obj) {
let d = new Date(obj.calc * 1000).toISOString();
obj.hh = +d.substr(11, 2);
obj.mm = +d.substr(14, 2);
obj.ss = +d.substr(17, 2);
obj.ts = d.substr(11, 8);
return obj;
};
// Instead of timestamps, some tracklists use durations
// If durations are provided, use them to re-calculate
// the starting and ending timestamps
var fixDurations = function (list) {
for (let i in list) {
if (i == 0) {
// Set the first one to start of track.
list[i].start.hh = list[i].start.mm = list[i].start.ss = 0;
// And end at the right time
list[i].end = { calc: list[i].start.calc };
list[i].start.calc = 0;
} else {
// All the others tracks start at the end of the previous one
// And end at start time + duration
let previous = list[i - 1];
list[i].end = { calc: previous.end.calc + list[i].start.calc };
list[i].start.calc = previous.end.calc;
}
list[i].start = timeToObject(list[i].start);
list[i].end = timeToObject(list[i].end);
}
};
var dropInvalid = function (e) {
// All tracks should start before the closing time
if (_options.length) return e.start.calc < _options.length;
return true;
};
export function parse(
text,
options = {
artist: "Unknown",
forceTimestamps: false,
forceDurations: false,
},
) {
_options = options;
return text
.split('\n')
let durations = false;
let result = text
.split("\n")
.filter(filterTimestamp)
.map(firstPass)
.map(calcTimestamp)
.map(calcTimestamp);
if (!options.forceTimestamps) {
// If our timestamps are not in increasing order
// Assume that we've been given a duration list instead
if (result[0].start.calc != 0) {
result.forEach((current, index, list) => {
if (index > 0) {
let previous = list[index - 1];
if (current.start.calc < previous.start.calc) {
durations = true;
}
}
});
}
if (durations || options.forceDurations == true) {
fixDurations(result);
}
}
return result
.map(parseTitle)
.map(parseArtist)
.map(addTrack)
.map(addEnd)
.filter(dropInvalid);
}

48
test/cue_test.js Normal file
View File

@ -0,0 +1,48 @@
/*jshint esversion: 6 */
import { strict as assert } from "assert";
import { generate } from "../src/cue.js";
import fs from "fs";
const DATA = {
artist: "Dumbledore",
album: "Curse of the Elder Wand",
audioFile: "audio.m4a",
tracks: [
{
artist: "Unknown",
title: "the 1",
track: 1,
start: { ts: "00:00:00", hh: 0, mm: 0, ss: 0, calc: 0 },
end: { ts: "00:3:9", hh: 0, mm: 3, ss: 9, calc: 189 },
_: { left_text: "", right_text: "the 1" },
},
{
artist: "Unknown",
title: "cardigan",
track: 2,
start: { ts: "00:3:09", hh: 0, mm: 3, ss: 9, calc: 189 },
end: { ts: "00:9:30", hh: 0, mm: 9, ss: 30, calc: 570 },
_: { left_text: "", right_text: "cardigan" },
},
],
};
describe("CUE", function () {
it("should generate with leading zeroes", function () {
generate(DATA, "/tmp/test.cue");
const CUE_EXPECTED = `REM Generated using youtube-cue
PERFORMER "Dumbledore"
TITLE "Curse of the Elder Wand"
FILE "audio.m4a" M4A
TRACK 1 AUDIO
TITLE "the 1"
PERFORMER "Unknown"
INDEX 01 00:00:00
TRACK 2 AUDIO
TITLE "cardigan"
PERFORMER "Unknown"
INDEX 01 03:09:00
`;
assert.equal(CUE_EXPECTED, fs.readFileSync("/tmp/test.cue", "utf-8"));
});
});

View File

@ -5,10 +5,10 @@ import { parse } from "../src/parser.js";
const TEXT = `
00:40 The Coders - Hello World
12:23 This is not the end
1:00 This is not the end
Something else in the middle
1:23:11 Not the last song
01. Screens 0:00 - 5:40
1:23 Not the last song
01. Screens 1:40 - 5:40
02. Inharmonious Slog 5:40 - 10:11
03. The Everyday Push 10:11 - 15:46
04. Storm 15:46 - 19:07
@ -24,21 +24,21 @@ Hello World 48:20
const TEXT_WITH_ARTIST = "12:23 Rolling Stones - Hello World";
describe("Parser", function() {
describe("Parser", function () {
var big_result;
before(function() {
before(function () {
big_result = parse(TEXT);
});
it("should find all timestamps", function() {
it("should find all timestamps", function () {
assert.equal(big_result.length, 15);
});
it("should find artist names", function() {
it("should find artist names", function () {
let result = parse(TEXT_WITH_ARTIST);
assert.equal(result[0].artist, "Rolling Stones");
});
it("should find track numbers", function() {
it("should find track numbers", function () {
assert.equal(big_result[3].track, 1);
assert.equal(big_result[4].track, 2);
assert.equal(big_result[5].track, 3);
@ -51,7 +51,7 @@ describe("Parser", function() {
assert.equal(big_result[12].track, 10);
});
it("should ensure ending timestamps for all", function() {
it("should ensure ending timestamps for all", function () {
assert.deepEqual(big_result[13].end, {
calc: 3023,
hh: 0,
@ -63,20 +63,162 @@ describe("Parser", function() {
assert.deepEqual(big_result[14].end, null);
});
it("should parse timestamps with square brackets", function() {
let result = parse(`[00:00:00] 1. Steve Kroeger x Skye Holland - Through The Dark
[00:02:53] 2. Gabri Ponte x Jerome - Lonely `)
it("should parse timestamps with square brackets", function () {
let result =
parse(`[00:00:00] 1. Steve Kroeger x Skye Holland - Through The Dark
[00:02:53] 2. Gabri Ponte x Jerome - Lonely `);
assert.deepEqual(result[0], {
artist: "Steve Kroeger x Skye Holland",
title: "Through The Dark",
track: 1,
start: { ts: "00:00:00", hh: 0, mm: 0, ss: 0, calc: 0 },
end: { ts: "00:02:53", hh: 0, mm: 2, ss: 53, calc: 173 },
_: { left_text: "", right_text: "Steve Kroeger x Skye Holland - Through The Dark" },
})
artist: "Steve Kroeger x Skye Holland",
title: "Through The Dark",
track: 1,
start: { ts: "00:00:00", hh: 0, mm: 0, ss: 0, calc: 0 },
end: { ts: "00:02:53", hh: 0, mm: 2, ss: 53, calc: 173 },
_: {
left_text: "",
right_text: "Steve Kroeger x Skye Holland - Through The Dark",
},
});
});
it("should parse taylor swift", function() {
it("should parse durations when given", function () {
let result = parse(`1. Artist - Title 6:19
2. Another Artist - Another Title 6:59
3. Yet Another Artist - Yet another title 5:12`);
assert.deepEqual(result[0], {
artist: "Artist",
title: "Title",
track: 1,
start: { ts: "00:00:00", hh: 0, mm: 0, ss: 0, calc: 0 },
end: { ts: "00:06:19", hh: 0, mm: 6, ss: 19, calc: 379 },
_: { left_text: "Artist - Title", right_text: "" },
});
assert.deepEqual(result[1], {
artist: "Another Artist",
title: "Another Title",
track: 2,
start: { ts: "00:06:19", hh: 0, mm: 6, ss: 19, calc: 379 },
end: { ts: "00:13:18", hh: 0, mm: 13, ss: 18, calc: 798 },
_: { left_text: "Another Artist - Another Title", right_text: "" },
});
assert.deepEqual(result[2], {
artist: "Yet Another Artist",
title: "Yet another title",
track: 3,
start: { ts: "00:13:18", hh: 0, mm: 13, ss: 18, calc: 798 },
end: { ts: "00:18:30", hh: 0, mm: 18, ss: 30, calc: 1110 },
_: {
left_text: "Yet Another Artist - Yet another title",
right_text: "",
},
});
});
it("should parse as timestamps if first timestamp is 00:00", function () {
let result = parse(`1. Artist - Title 00:00
2. Another Artist - Another Title 01:00
3. Yet Another Artist - Yet another title 02:00`);
assert.deepEqual(result[0], {
artist: "Artist",
title: "Title",
track: 1,
start: { ts: "00:00:00", hh: 0, mm: 0, ss: 0, calc: 0 },
end: { ts: "00:01:00", hh: 0, mm: 1, ss: 0, calc: 60 },
_: { left_text: "Artist - Title", right_text: "" },
});
assert.deepEqual(result[1], {
artist: "Another Artist",
title: "Another Title",
track: 2,
end: { ts: "00:02:00", hh: 0, mm: 2, ss: 0, calc: 120 },
start: { ts: "00:01:00", hh: 0, mm: 1, ss: 0, calc: 60 },
_: { left_text: "Another Artist - Another Title", right_text: "" },
});
assert.deepEqual(result[2], {
artist: "Yet Another Artist",
title: "Yet another title",
track: 3,
end: null,
start: { ts: "00:02:00", hh: 0, mm: 2, ss: 0, calc: 120 },
_: {
left_text: "Yet Another Artist - Yet another title",
right_text: "",
},
});
});
it("should parse durations as timestamps when forced", function () {
let result = parse(
`1. Artist - Title 5:00
2. Another Artist - Another Title 4:20`,
{ forceTimestamps: true },
);
assert.deepEqual(result[0].end, {
ts: "00:4:20",
hh: 0,
mm: 4,
ss: 20,
calc: 260,
});
assert.deepEqual(result[1].start, {
ts: "00:4:20",
hh: 0,
mm: 4,
ss: 20,
calc: 260,
});
});
it("should parse timestamps as durations when forced", function () {
let result = parse(
`1. Artist - Title 1:00
2. Another Artist - Another Title 1:15`,
{ forceDurations: true },
);
assert.deepEqual(result[0], {
track: 1,
_: { left_text: "Artist - Title", right_text: "" },
title: "Title",
artist: "Artist",
end: {
ts: "00:01:00",
hh: 0,
mm: 1,
ss: 0,
calc: 60,
},
start: {
ts: "00:00:00",
hh: 0,
mm: 0,
ss: 0,
calc: 0,
},
});
assert.deepEqual(result[1], {
track: 2,
_: { left_text: "Another Artist - Another Title", right_text: "" },
title: "Another Title",
artist: "Another Artist",
start: {
ts: "00:01:00",
hh: 0,
mm: 1,
ss: 0,
calc: 60,
},
end: {
ts: "00:02:15",
hh: 0,
mm: 2,
ss: 15,
calc: 135,
},
});
});
it("should parse taylor swift", function () {
let result = parse(`0:00 the 1
3:29 cardigan
9:30 the last great american dynasty