Skip to content

Commit

Permalink
Merge pull request #82 from Oceanity/dev
Browse files Browse the repository at this point in the history
Dev -> Main: 0.7.5a
  • Loading branch information
Oceanity committed Aug 30, 2024
2 parents 341e486 + d1264da commit 0a4cd87
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .github/release.yml

changelog:
exclude:
labels:
- ignore-for-release
authors:
- octocat
categories:
- title: Breaking Changes 🛠
labels:
- Semver-Major
- breaking-change
- title: Exciting New Features 🎉
labels:
- Semver-Minor
- enhancement
- feature
- title: Bug Fixes 🐛
labels:
- Semver-Patch
- bugfix
- title: Other Changes
labels:
- "*"
4 changes: 4 additions & 0 deletions changelogs/changelog-0.7.5a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## What's Changed

**Fixes**
- Fixed links from non-english interfaces that include `intl-{country code}` in the URL
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "oceanity-spotify",
"displayName": "Spotify (by Oceanity)",
"scriptOutputName": "oceanitySpotifyIntegration",
"version": "0.7.5",
"version": "0.7.5a",
"description": "Adds Spotify events, effects and variables to Firebot",
"main": "",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/tamperMonkey/lyricsGrabber.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
fetch: originalFetch
} = window;

const version = "0.7.5";
const version = "0.7.5a";

// Consts
const lyricUrlRegex = /https:\/\/spclient\.wg\.spotify\.com\/color-lyrics\/v2\/track\/([a-zA-Z0-9]+)\/image\/.+/;
Expand Down
13 changes: 13 additions & 0 deletions src/utils/spotify/player/track.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ describe("Spotify - Track Service", () => {
expect(track.isTrackUrl(goodUrl)).toBe(true);
});

it("returns true if track url with international link", () => {
let goodUrl = "https://open.spotify.com/intl-ja/track/6EdXJoSUjYU3wotVjhDcKl?si=cce7b8dc26754566";

expect(track.isTrackUrl(goodUrl)).toBe(true);
});

it("returns true if track url with extraneous whitespace", () => {
let goodUrl =
" https://open.spotify.com/track/4PTG3Z6ehGkBFwjybzWkR8?si=ac674684a1d3410c ";
Expand Down Expand Up @@ -154,6 +160,13 @@ describe("Spotify - Track Service", () => {
expect(track.getIdFromTrackUrl(url)).toBe(id);
});

it("returns id from track url with international link", () => {
const id = "4PTG3Z6ehGkBFwjybzWkR8";
const url = `https://open.spotify.com/intl-ja/track/${id}`;

expect(track.getIdFromTrackUrl(url)).toBe(id);
});

it("returns null when url is not a track url", () => {
const id = "4PTG3Z6ehGkBFwjybzWkR8";
const url = `https://open.spotify.com/artist/${id}`;
Expand Down
3 changes: 1 addition & 2 deletions src/utils/spotify/player/track.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { formatMsToTimecode } from "@oceanity/firebot-helpers/string";
import { getBiggestImageUrl } from "@utils/array";
import { SpotifyService } from "@utils/spotify";
import { LargeNumberLike } from "crypto";
import { EventEmitter } from "events";

export class SpotifyTrackService extends EventEmitter {
private readonly spotify: SpotifyService;
private readonly urlRegex: RegExp =
/(?:https?:)\/\/open\.spotify\.com\/track\/(.+?)(?:\?.+)?(?:\W|$)/;
/(?:https?:)\/\/open\.spotify\.com\/(?:intl-[a-z]+\/)?track\/(.+?)(?:\?.+)?(?:\W|$)/;

private _track?: SpotifyTrackDetails | null;
private _trackSummary?: SpotifyTrackSummary;
Expand Down

0 comments on commit 0a4cd87

Please sign in to comment.