Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/userscripts/smartlink_importer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Test link: [bfan.link/elan](https://bfan.link/elan)

### DistroKid HyperFollow

Provider destinations are read directly from DistroKid HyperFollow’s rendered store links. DistroKid’s store identifiers are normalized, including its legacy Google identifier for YouTube Music, and iTunes links are treated as downloads.
Provider destinations are read directly from DistroKid HyperFollow’s rendered store links. Legacy Google Play Music and Napster links are ignored, and iTunes links are treated as downloads.

Test link: [distrokid.com/hyperfollow/timerival/stride](https://distrokid.com/hyperfollow/timerival/stride)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ServiceElement } from '~/userscripts/smartlink_importer/utils/type
import { nextCacheKey } from './common';

const SERVICE_ALIASES: Readonly<Record<string, string>> = {
google: 'youtubemusic',
google: 'googleplay',
};

export function distrokidServiceName(store: string): string {
Expand Down
2 changes: 1 addition & 1 deletion src/userscripts/smartlink_importer/utils/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const HARMONY_SERVICE_PREFERENCE = ['spotify', 'tidal', 'deezer', 'bandcamp', 'apple', 'itunes'] as const;

const TRACKING_PARAMETER_NAMES = new Set(['at', 'ct', 'ffm', 'lid', 'ref', 'ref_', 'si', 'src', 'tag']);
const IGNORED_SERVICES = new Set(['junodownload']);
const IGNORED_SERVICES = new Set(['googleplay', 'junodownload', 'napster']);
const PHYSICAL_MEDIA_SERVICES = new Set(['amazoncdvinyl', 'barnesnoble', 'hmvjapan', 'imusic', 'sanity', 'towerrecords']);
const FREE_STREAMING_SERVICES = new Set(['boomplay', 'deezer', 'spotify', 'youtube']);
const STREAMING_SERVICES = new Set(['amazon', 'apple', 'itunes', 'kkbox', 'pandora', 'qobuz', 'soundcloud', 'tidal', 'youtubemusic']);
Expand Down
10 changes: 9 additions & 1 deletion tests/smartlink-importer/logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ describe('Smartlink importer shared logic', () => {
expect(chooseHarmonyLink(links.slice(0, 2))?.service).toBe('tidal');
});

it('ignores sunset Juno Download services', () => {
it('ignores discontinued services', () => {
expect(isIgnoredService('googleplay')).toBe(true);
expect(isIgnoredService('junodownload')).toBe(true);
expect(isIgnoredService('napster')).toBe(true);
expect(isIgnoredService('beatport')).toBe(false);
});

Expand Down Expand Up @@ -176,6 +178,12 @@ describe('Smartlink importer shared logic', () => {

it('provides a shared reason for links that should be skipped', () => {
expect(skipReasonForServiceLink('junodownload', 'Buy', 'https://example.com/release')).toBe('Ignored service');
expect(skipReasonForServiceLink('googleplay', 'Listen', 'https://play.google.com/store/music/album/example')).toBe(
'Ignored service',
);
expect(skipReasonForServiceLink('napster', 'Listen', 'https://us.napster.com/artist/example/album/example')).toBe(
'Ignored service',
);
expect(skipReasonForServiceLink('unknown-store', 'Buy Vinyl', 'https://example.com/release')).toBe('Physical-media link');
expect(skipReasonForServiceLink('tidal', 'Play', 'https://tidal.com/search?q=example')).toBe('Search fallback');
expect(skipReasonForServiceLink('youtube', 'Play', 'https://www.youtube.com/results?search_query=example')).toBe('Search fallback');
Expand Down
2 changes: 1 addition & 1 deletion tests/smartlink-importer/site-logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('Smartlink importer site adapters', () => {
it('maps DistroKid HyperFollow store identifiers and actions', () => {
expect(distrokidServiceName('spotify')).toBe('spotify');
expect(distrokidServiceName('applemusic')).toBe('apple');
expect(distrokidServiceName('google')).toBe('youtubemusic');
expect(distrokidServiceName('google')).toBe('googleplay');
expect(distrokidServiceAction('itunes')).toBe('Download');
expect(distrokidServiceAction('deezer')).toBe('Listen');
});
Expand Down
Loading