@audiofool/moondog 0.4.0-beta.3 → 0.4.0-beta.4
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.
- package/README.md +19 -8
- package/package.json +1 -1
- package/scripts/moondog.mjs +95 -103
- package/src/core/apple-library-source-status.mjs +64 -18
- package/src/core/apple-projection-domain-services.mjs +63 -52
- package/src/core/capability-catalog.mjs +18 -2
- package/src/core/import-source-history.mjs +28 -0
- package/src/core/library-draft.mjs +16 -0
- package/src/core/library-names.mjs +12 -0
- package/src/core/library-store.mjs +361 -23
- package/src/core/listener-avoids.mjs +31 -0
- package/src/core/listening-action.mjs +41 -0
- package/src/core/listening-moment.mjs +67 -0
- package/src/core/listening-now.mjs +69 -28
- package/src/core/listening-profile-domain-services.mjs +28 -18
- package/src/core/listening-scope.mjs +119 -0
- package/src/core/moondog-application.mjs +1003 -267
- package/src/core/play-follower.mjs +73 -37
- package/src/core/portable-playlist.mjs +125 -0
- package/src/core/profile-discovery-draft.mjs +35 -0
- package/src/core/track-title.mjs +70 -4
- package/src/i18n/import-history.mjs +647 -0
- package/src/i18n/messages/de.mjs +3 -3
- package/src/i18n/messages/en.mjs +3 -3
- package/src/i18n/messages/es.mjs +3 -3
- package/src/i18n/messages/fr.mjs +3 -3
- package/src/i18n/messages/it.mjs +3 -3
- package/src/i18n/messages/ja.mjs +3 -3
- package/src/i18n/messages/ko.mjs +3 -3
- package/src/i18n/messages/pt.mjs +3 -3
- package/src/i18n/messages/zh-Hant.mjs +3 -3
- package/src/i18n/messages/zh.mjs +3 -3
- package/src/i18n/screen/es.mjs +89 -26
- package/src/i18n/screen/ja.mjs +88 -25
- package/src/i18n/screen/pt.mjs +89 -26
- package/src/i18n/screen/zh.mjs +88 -25
- package/src/importers/apple-music-library/import-batch.mjs +64 -32
- package/src/importers/apple-music-library/normalize.mjs +36 -6
- package/src/importers/apple-music-library/save-time.mjs +17 -0
- package/src/importers/zip-reader.mjs +24 -2
- package/src/integrations/apple-music/catalog-playlist-reader.mjs +111 -0
- package/src/integrations/apple-music/catalog.mjs +84 -25
- package/src/integrations/apple-music/song-id.mjs +13 -0
- package/src/integrations/apple-music/terminal-preview-player.mjs +154 -44
- package/src/integrations/listenbrainz/history-file.mjs +63 -35
- package/src/integrations/netease/ncm-cli-player.mjs +355 -68
- package/src/integrations/netease/queue-occurrence.mjs +138 -0
- package/src/integrations/playlist-links.mjs +93 -30
- package/src/integrations/public-playlists.mjs +21 -15
- package/src/integrations/spotify/account-data-history.mjs +9 -10
- package/src/integrations/spotify/account-data-profile.mjs +1 -0
- package/src/integrations/spotify/extended-streaming-history.mjs +57 -52
- package/src/integrations/spotify/history-archive.mjs +8 -18
- package/src/integrations/spotify/library-snapshot.mjs +2 -1
- package/src/integrations/spotify/service.mjs +29 -11
- package/src/integrations/spotify/web-api-client.mjs +2 -2
- package/src/integrations/stable-audio/local-generator.mjs +13 -5
- package/src/integrations/youtube-music/takeout.mjs +12 -8
- package/src/memory/local-memory-store.mjs +479 -27
- package/src/memory/reflection-worker.mjs +1 -0
- package/src/profile/apple-library-import.mjs +56 -2
- package/src/profile/history-import.mjs +58 -27
- package/src/profile/listener-corrections.mjs +2 -4
- package/src/profile/listener-profile-build.mjs +128 -45
- package/src/profile/listener-profile-store.mjs +25 -4
- package/src/profile/listener-profile-verification.mjs +11 -5
- package/src/profile/listener-profile-worker.mjs +24 -8
- package/src/profile/listening-history-store.mjs +944 -367
- package/src/profile/listening-profile-projection.mjs +123 -156
- package/src/profile/local-file-import.mjs +172 -0
- package/src/profile/moondog-suggestions.mjs +40 -11
- package/src/profile/profile-exploration.mjs +36 -6
- package/src/profile/recorded-measures.mjs +5 -0
- package/src/profile/spotify-archive-taste.mjs +41 -65
- package/src/runtime/pi/agent-runtime.mjs +360 -215
- package/src/runtime/pi/custom-endpoints.mjs +30 -8
- package/src/runtime/pi/memory-agent-runtime.mjs +43 -3
- package/src/runtime/pi/playback-rules.mjs +100 -0
- package/src/runtime/pi/profile-build-runtime.mjs +81 -24
- package/src/surfaces/cli/brand-components.mjs +9 -6
- package/src/surfaces/cli/command-completions.mjs +8 -1
- package/src/surfaces/cli/format-output.mjs +207 -34
- package/src/surfaces/cli/history-import-view.mjs +130 -21
- package/src/surfaces/cli/listenbrainz-command.mjs +7 -2
- package/src/surfaces/cli/listener-profile-command.mjs +67 -10
- package/src/surfaces/cli/listening-menu.mjs +3 -0
- package/src/surfaces/cli/profile-command.mjs +1 -0
- package/src/surfaces/cli/spotify-command.mjs +17 -25
- package/src/surfaces/cli/taste-period.mjs +22 -0
- package/src/surfaces/cli/taste-profile-model.mjs +52 -32
- package/src/surfaces/cli/tui.mjs +557 -170
- package/src/surfaces/html/tasteprint.mjs +181 -93
- package/src/surfaces/import-source-history.mjs +80 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { recentListeningPeriod } from "../cli/taste-period.mjs";
|
|
2
|
+
import { musicProviderLabel } from "../../profile/music-providers.mjs";
|
|
3
|
+
|
|
1
4
|
const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/gu;
|
|
2
5
|
const BIDI_CONTROLS = /[\u202a-\u202e\u2066-\u2069]/gu;
|
|
3
6
|
|
|
@@ -117,7 +120,7 @@ function monthlyActivityCellSignal(item) {
|
|
|
117
120
|
};
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
function monthlyActivitySignal(item) {
|
|
123
|
+
function monthlyActivitySignal(item, coverage) {
|
|
121
124
|
if (!isPlainObject(item) || item.timezone !== "UTC") return null;
|
|
122
125
|
const firstMonth = cleanText(item.first_month, 7);
|
|
123
126
|
const lastMonth = cleanText(item.last_month, 7);
|
|
@@ -177,6 +180,8 @@ function monthlyActivitySignal(item) {
|
|
|
177
180
|
active_month_count: activeMonthCount,
|
|
178
181
|
omitted_earlier_month_count: omittedEarlierMonthCount,
|
|
179
182
|
peak_listening_minutes: peakListeningMinutes,
|
|
183
|
+
all_plays_timed: Number.isSafeInteger(coverage.events_with_played_duration) && coverage.events_with_played_duration > 0 &&
|
|
184
|
+
coverage.events_with_played_duration === coverage.effective_listening_events,
|
|
180
185
|
months,
|
|
181
186
|
};
|
|
182
187
|
}
|
|
@@ -772,9 +777,9 @@ function dateValue(value) {
|
|
|
772
777
|
|
|
773
778
|
function durationDays(earliest, latest) {
|
|
774
779
|
if (!earliest || !latest) return null;
|
|
775
|
-
const
|
|
776
|
-
if (!Number.isFinite(
|
|
777
|
-
return Math.
|
|
780
|
+
const start = Date.parse(earliest), end = Date.parse(latest);
|
|
781
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) return null;
|
|
782
|
+
return Math.floor(end / 86_400_000) - Math.floor(start / 86_400_000) + 1;
|
|
778
783
|
}
|
|
779
784
|
|
|
780
785
|
function metric(item) {
|
|
@@ -835,6 +840,9 @@ export function createTasteprintView(
|
|
|
835
840
|
throw new TypeError("Tasteprint generatedAt must be an ISO timestamp.");
|
|
836
841
|
}
|
|
837
842
|
const coverage = isPlainObject(profile.coverage) ? profile.coverage : {};
|
|
843
|
+
const metrics = collectionMetrics(coverage);
|
|
844
|
+
const appleExportDate = metrics.length && coverage.tracks_observed > 0 && profile.source?.kind === "provider_library_snapshot"
|
|
845
|
+
? dateValue(profile.source.captured_at) : null;
|
|
838
846
|
const behavior = isPlainObject(profile.listening_behavior)
|
|
839
847
|
? profile.listening_behavior
|
|
840
848
|
: {};
|
|
@@ -854,8 +862,8 @@ export function createTasteprintView(
|
|
|
854
862
|
const listeningRange = isPlainObject(source.listening_range)
|
|
855
863
|
? source.listening_range
|
|
856
864
|
: {};
|
|
857
|
-
const earliest = dateValue(listeningRange.earliest);
|
|
858
|
-
const latest = dateValue(listeningRange.latest);
|
|
865
|
+
const earliest = dateValue(listeningRange.earliest) ?? dateValue(coverage.earliest_played_at);
|
|
866
|
+
const latest = dateValue(listeningRange.latest) ?? dateValue(coverage.latest_played_at);
|
|
859
867
|
const enduringArtists = list(behavior.enduring_artists, 10, artistSignal);
|
|
860
868
|
const recentArtists = list(behavior.recent_artists, 10, artistSignal);
|
|
861
869
|
const longArcRanks = new Map(
|
|
@@ -874,6 +882,10 @@ export function createTasteprintView(
|
|
|
874
882
|
network_requests: "none",
|
|
875
883
|
},
|
|
876
884
|
profile_version: cleanText(profile.profile_version, 80) || "unknown",
|
|
885
|
+
...(metrics.length ? { collection: {
|
|
886
|
+
metrics,
|
|
887
|
+
apple_export_day: appleExportDate ? new Date(appleExportDate).toISOString().slice(0, 10) : null,
|
|
888
|
+
} } : {}),
|
|
877
889
|
coverage: compactObject({
|
|
878
890
|
effective_listening_events: optionalNumber(
|
|
879
891
|
coverage.effective_listening_events,
|
|
@@ -884,6 +896,7 @@ export function createTasteprintView(
|
|
|
884
896
|
{ integer: true },
|
|
885
897
|
),
|
|
886
898
|
listening_hours: optionalNumber(coverage.listening_hours),
|
|
899
|
+
events_with_played_duration: optionalNumber(coverage.events_with_played_duration, { integer: true }),
|
|
887
900
|
listening_tracks: optionalNumber(coverage.listening_tracks, {
|
|
888
901
|
integer: true,
|
|
889
902
|
}),
|
|
@@ -983,7 +996,7 @@ export function createTasteprintView(
|
|
|
983
996
|
history_arc: list(behavior.history_arc, 20, historyArcSignal).sort(
|
|
984
997
|
(left, right) => left.year - right.year,
|
|
985
998
|
),
|
|
986
|
-
monthly_activity: monthlyActivitySignal(behavior.monthly_activity),
|
|
999
|
+
monthly_activity: monthlyActivitySignal(behavior.monthly_activity, coverage),
|
|
987
1000
|
listening_seasons: listeningSeasonsSignal(behavior.listening_seasons),
|
|
988
1001
|
artist_relationships: list(
|
|
989
1002
|
behavior.artist_relationships,
|
|
@@ -1136,9 +1149,11 @@ export function createTasteprintView(
|
|
|
1136
1149
|
strong_preferences: list(profile.strong_preferences, 10, (item) => {
|
|
1137
1150
|
if (!isPlainObject(item)) return null;
|
|
1138
1151
|
const label = cleanText(item.label);
|
|
1139
|
-
return
|
|
1140
|
-
|
|
1141
|
-
: null
|
|
1152
|
+
if (!label) return null;
|
|
1153
|
+
return compactObject({ label, artist_credit: cleanText(item.artist_credit),
|
|
1154
|
+
entity_type: ["track", "artist", "album"].includes(item.entity_type) ? item.entity_type : null,
|
|
1155
|
+
source: item.source === "Apple Music library preference" ? "Apple Music" : null,
|
|
1156
|
+
signal: cleanText(item.signal) });
|
|
1142
1157
|
}),
|
|
1143
1158
|
saved_tracks: list(curated.saved_tracks, 10, trackSignal),
|
|
1144
1159
|
playlist_anchors: list(curated.playlist_anchors, 10, trackSignal),
|
|
@@ -1179,9 +1194,11 @@ export function createTasteprintView(
|
|
|
1179
1194
|
highlights: list(provider.highlights, 6, highlight),
|
|
1180
1195
|
metrics: list(provider.metrics, 10, metric),
|
|
1181
1196
|
},
|
|
1182
|
-
limitations:
|
|
1183
|
-
|
|
1184
|
-
|
|
1197
|
+
limitations: metrics.length ? [
|
|
1198
|
+
"The collection shows what the source held when it was read. Listening dates and time require individual play records.",
|
|
1199
|
+
...(coverage.aggregate_play_count > 0 ? ["An Apple Music play count is a cumulative total for one track. It gives no date or duration for an individual play."] : []),
|
|
1200
|
+
...(coverage.loved_or_favorited > 0 ? ["Apple Music shows which tracks were marked as favorites when the library was exported. The export has no date for that choice."] : []),
|
|
1201
|
+
] : list(profile.limitations, 8, (item) => cleanText(item, 500)).filter(Boolean),
|
|
1185
1202
|
};
|
|
1186
1203
|
}
|
|
1187
1204
|
|
|
@@ -1214,10 +1231,58 @@ function dateLabel(value) {
|
|
|
1214
1231
|
}
|
|
1215
1232
|
|
|
1216
1233
|
function spanLabel(days) {
|
|
1217
|
-
if (!Number.isFinite(days)) return "Your listening
|
|
1218
|
-
if (days >= 730) return
|
|
1219
|
-
if (days >= 60) return
|
|
1220
|
-
return
|
|
1234
|
+
if (!Number.isFinite(days)) return "Your listening history";
|
|
1235
|
+
if (days >= 730) return `Your history spans ${number(days / 365.25, 1)} years`;
|
|
1236
|
+
if (days >= 60) return `Your history spans ${number(days / 30.44, 1)} months`;
|
|
1237
|
+
return days === 1 ? "One day in your listening history" : `Your history spans ${number(days)} days`;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
function durationMetric(coverage) {
|
|
1241
|
+
const timed = coverage.events_with_played_duration;
|
|
1242
|
+
const plays = coverage.effective_listening_events;
|
|
1243
|
+
if (Number.isInteger(timed) && timed < plays) {
|
|
1244
|
+
return { value: `${number(timed)} of ${number(plays)}`, label: "plays with recorded duration" };
|
|
1245
|
+
}
|
|
1246
|
+
// Profiles report hours to the nearest tenth, including zero for a short listening session.
|
|
1247
|
+
return { value: coverage.listening_hours === 0 && timed > 0 ? "<0.1" : number(coverage.listening_hours, 1), label: "listening hours" };
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
// Library snapshots describe saved music. Only individual plays measure listening time.
|
|
1251
|
+
function collectionMetrics(coverage) {
|
|
1252
|
+
if (!isPlainObject(coverage) || coverage.effective_listening_events > 0 || coverage.profiled_listening_events > 0 ||
|
|
1253
|
+
coverage.listening_tracks > 0 || coverage.listening_hours > 0) return [];
|
|
1254
|
+
const metrics = [];
|
|
1255
|
+
const add = (count, singular, plural) => {
|
|
1256
|
+
if (Number.isSafeInteger(count) && count >= 0) metrics.push({ value: number(count), label: count === 1 ? singular : plural });
|
|
1257
|
+
};
|
|
1258
|
+
const sources = Array.isArray(coverage.collection_sources) ? coverage.collection_sources.slice(0, 12).filter(isPlainObject) : [];
|
|
1259
|
+
const serviceName = source => cleanText(musicProviderLabel(source.system), 60) || "Imported music";
|
|
1260
|
+
if (coverage.tracks_observed > 0) add(coverage.tracks_observed, "Apple Music library track", "Apple Music library tracks");
|
|
1261
|
+
if (coverage.collection_tracks > 0) {
|
|
1262
|
+
const names = new Set(sources.filter(source => source.tracks > 0).map(serviceName));
|
|
1263
|
+
const [name] = names;
|
|
1264
|
+
const collection = names.size === 1 && name && name !== "Imported music" ? `${name} collection` : "imported collection";
|
|
1265
|
+
add(coverage.collection_tracks, `track in your ${collection}`, `tracks in your ${collection}`);
|
|
1266
|
+
} else {
|
|
1267
|
+
for (const source of sources.filter(source => source.tracks > 0)) {
|
|
1268
|
+
add(source.tracks, `track in your ${serviceName(source)} collection`, `tracks in your ${serviceName(source)} collection`);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
if (coverage.tracks_observed > 0) {
|
|
1272
|
+
add(coverage.loved_or_favorited, "loved or favorited Apple Music track", "loved or favorited Apple Music tracks");
|
|
1273
|
+
// This coverage field counts tracks with a counter, regardless of what each counter reported.
|
|
1274
|
+
add(coverage.aggregate_play_count, "Apple Music track with a play count", "Apple Music tracks with play counts");
|
|
1275
|
+
}
|
|
1276
|
+
const saved = coverage.saved_tracks ?? coverage.spotify_saved_tracks;
|
|
1277
|
+
const memberships = coverage.playlist_memberships ?? coverage.spotify_playlist_memberships;
|
|
1278
|
+
if (saved > 0) add(saved, "saved track", "saved tracks");
|
|
1279
|
+
if (memberships > 0) add(memberships, "playlist entry", "playlist entries");
|
|
1280
|
+
for (const source of sources) {
|
|
1281
|
+
const service = serviceName(source);
|
|
1282
|
+
if (source.saved_albums > 0) add(source.saved_albums, `saved ${service} album`, `saved ${service} albums`);
|
|
1283
|
+
if (source.followed_artists > 0) add(source.followed_artists, `followed ${service} artist`, `followed ${service} artists`);
|
|
1284
|
+
}
|
|
1285
|
+
return metrics;
|
|
1221
1286
|
}
|
|
1222
1287
|
|
|
1223
1288
|
function percentage(value, total) {
|
|
@@ -1253,11 +1318,7 @@ function artistRows(items, { recent = false } = {}) {
|
|
|
1253
1318
|
? `${number(item.distinct_tracks)} ${item.distinct_tracks === 1 ? "track" : "tracks"}`
|
|
1254
1319
|
: null,
|
|
1255
1320
|
].filter(Boolean);
|
|
1256
|
-
const orbit = recent
|
|
1257
|
-
? Number.isInteger(item.long_arc_rank)
|
|
1258
|
-
? `#${item.long_arc_rank} across the years`
|
|
1259
|
-
: "new lately"
|
|
1260
|
-
: "";
|
|
1321
|
+
const orbit = recent && Number.isInteger(item.long_arc_rank) ? `#${item.long_arc_rank} overall` : "";
|
|
1261
1322
|
return `<li>
|
|
1262
1323
|
<div class="rank-number">${String(index + 1).padStart(2, "0")}</div>
|
|
1263
1324
|
<div class="rank-content">
|
|
@@ -1309,7 +1370,7 @@ function historyArcRows(items) {
|
|
|
1309
1370
|
<div class="bar" aria-hidden="true"><i style="width:${width}%"></i></div>
|
|
1310
1371
|
${details.length > 0 ? `<small>${escapeHtml(details.join(" / "))}</small>` : ""}
|
|
1311
1372
|
</div>
|
|
1312
|
-
<div class="arc-artist"><span>
|
|
1373
|
+
<div class="arc-artist"><span>A leading artist</span><strong>${escapeHtml(item.top_artist?.name ?? "Unknown artist")}</strong>${topArtistDetails.length > 0 ? `<small>${escapeHtml(topArtistDetails.join(" / "))}</small>` : ""}</div>
|
|
1313
1374
|
</li>`;
|
|
1314
1375
|
})
|
|
1315
1376
|
.join("")}
|
|
@@ -1411,6 +1472,19 @@ function signalList(items) {
|
|
|
1411
1472
|
.join("")}</ul>`;
|
|
1412
1473
|
}
|
|
1413
1474
|
|
|
1475
|
+
function preferenceSignalList(items) {
|
|
1476
|
+
const types = { track: "Song", artist: "Artist", album: "Album" };
|
|
1477
|
+
return signalList(items.map(item => {
|
|
1478
|
+
const label = [item.label, item.artist_credit].filter(Boolean).join(" / ");
|
|
1479
|
+
const evidence = item.signal
|
|
1480
|
+
?.replace(/^You explicitly said you like this (track|artist)$/u, "Liked by you")
|
|
1481
|
+
.replace(/^(.+) playlist anchor$/u, "On a playlist from $1")
|
|
1482
|
+
.replace(/^Saved album$/u, "Saved")
|
|
1483
|
+
.replace(/^Followed artist$/u, "Followed");
|
|
1484
|
+
return { label, signal: [types[item.entity_type], item.source, evidence].filter(Boolean).join(" / ") };
|
|
1485
|
+
}));
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1414
1488
|
function correctionSignalList(items, stance) {
|
|
1415
1489
|
if (items.length === 0) {
|
|
1416
1490
|
return `<p class="empty">${stance === "avoid" ? "You have not kept anything out." : "You have not marked anything as a like."}</p>`;
|
|
@@ -1686,16 +1760,13 @@ const pulseMonthLabels = Object.freeze([
|
|
|
1686
1760
|
["D", "December"],
|
|
1687
1761
|
]);
|
|
1688
1762
|
|
|
1689
|
-
function listeningPulseLevel(listeningMinutes, peakListeningMinutes) {
|
|
1690
|
-
if (listeningMinutes <= 0 || peakListeningMinutes <= 0) return 0;
|
|
1691
|
-
return Math.max(
|
|
1692
|
-
1,
|
|
1693
|
-
Math.min(4, Math.ceil(Math.sqrt(listeningMinutes / peakListeningMinutes) * 4)),
|
|
1694
|
-
);
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
1763
|
function monthlyActivityGrid(activity) {
|
|
1698
1764
|
if (!activity) return "";
|
|
1765
|
+
// The monthly projection sums recorded time. Only complete duration coverage
|
|
1766
|
+
// lets those sums compare months, or a zero describe a measured duration.
|
|
1767
|
+
const byTime = activity.all_plays_timed;
|
|
1768
|
+
const peak = byTime ? activity.peak_listening_minutes : Math.max(...activity.months.map(month => month.event_count));
|
|
1769
|
+
const unit = byTime ? "minutes" : "plays";
|
|
1699
1770
|
const byMonth = new Map(activity.months.map((month) => [month.month, month]));
|
|
1700
1771
|
const firstYear = Number(activity.first_month.slice(0, 4));
|
|
1701
1772
|
const lastYear = Number(activity.last_month.slice(0, 4));
|
|
@@ -1712,12 +1783,16 @@ function monthlyActivityGrid(activity) {
|
|
|
1712
1783
|
if (!month) {
|
|
1713
1784
|
return '<span class="pulse-cell is-outside" aria-hidden="true"></span>';
|
|
1714
1785
|
}
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
)
|
|
1786
|
+
const value = byTime ? month.listening_minutes : month.event_count;
|
|
1787
|
+
const level = month.event_count === 0 ? 0 : Math.max(1, Math.ceil(4 * Math.sqrt(value / Math.max(1, peak))));
|
|
1788
|
+
const details = [`${number(month.event_count)} ${month.event_count === 1 ? "play" : "plays"}`];
|
|
1789
|
+
if (byTime || month.listening_minutes > 0) {
|
|
1790
|
+
const minutes = month.listening_minutes === 1 ? "minute" : "minutes";
|
|
1791
|
+
details.push(`${number(month.listening_minutes)} ${byTime ? minutes : `recorded ${minutes}`}`);
|
|
1792
|
+
}
|
|
1793
|
+
details.push(`${number(month.distinct_tracks)} ${month.distinct_tracks === 1 ? "track" : "tracks"}`);
|
|
1719
1794
|
const description = month.event_count > 0
|
|
1720
|
-
? `${long} ${year}: ${
|
|
1795
|
+
? `${long} ${year}: ${details.join(", ")}.`
|
|
1721
1796
|
: `${long} ${year}: nothing in your history.`;
|
|
1722
1797
|
return `<span class="pulse-cell level-${level}" role="gridcell" title="${escapeHtml(description)}" aria-label="${escapeHtml(description)}"></span>`;
|
|
1723
1798
|
}).join("");
|
|
@@ -1733,8 +1808,8 @@ function monthlyActivityGrid(activity) {
|
|
|
1733
1808
|
<div class="listening-pulse-grid" role="grid" aria-label="Listening by month, in UTC">
|
|
1734
1809
|
<span class="pulse-corner" aria-hidden="true">UTC</span>${monthHeaders}${rows.join("")}
|
|
1735
1810
|
</div>
|
|
1736
|
-
<div class="pulse-legend" aria-label="
|
|
1737
|
-
<p class="pulse-boundary">${escapeHtml(`${boundedCopy} Darker means more
|
|
1811
|
+
<div class="pulse-legend" aria-label="Monthly listening intensity in ${unit}"><span>Less</span><i class="pulse-cell level-1"></i><i class="pulse-cell level-2"></i><i class="pulse-cell level-3"></i><i class="pulse-cell level-4"></i><span>More</span></div>
|
|
1812
|
+
<p class="pulse-boundary">${escapeHtml(`${boundedCopy} Darker means more ${unit}, compared with your own busiest month. A blank cell means no history was kept for that month, not that you stopped listening.`)}</p>
|
|
1738
1813
|
</div>`;
|
|
1739
1814
|
}
|
|
1740
1815
|
|
|
@@ -1779,7 +1854,7 @@ function listeningSeasonsPanel(activity) {
|
|
|
1779
1854
|
</div>
|
|
1780
1855
|
<p class="season-mix-label"><span>${escapeHtml(`${number(season.first_observed_tracks)} new`)}</span><span>${escapeHtml(`${number(season.returning_tracks)} heard before`)}</span></p>
|
|
1781
1856
|
<dl class="season-anchors">
|
|
1782
|
-
<div><dt>
|
|
1857
|
+
<div><dt>A leading artist</dt><dd>${escapeHtml(leading.name)}</dd></div>
|
|
1783
1858
|
<div><dt>Top song</dt><dd>${escapeHtml(signature.label)}<span>${escapeHtml(signature.artist_credit)}</span></dd></div>
|
|
1784
1859
|
</dl>
|
|
1785
1860
|
<small>${escapeHtml(`${number(season.active_month_count)} of ${number(season.retained_month_count)} months with listening / ${partial}`)}</small>
|
|
@@ -1788,12 +1863,12 @@ function listeningSeasonsPanel(activity) {
|
|
|
1788
1863
|
.join("");
|
|
1789
1864
|
const previewCopy = activity.preview_omitted_season_count > 0
|
|
1790
1865
|
? `Showing the latest ${number(activity.preview_season_count)} of ${number(activity.represented_season_count)} seasons; ${number(activity.preview_omitted_active_season_count)} earlier seasons with listening are left out here.`
|
|
1791
|
-
: `Showing all ${number(activity.represented_season_count)} seasons.`;
|
|
1866
|
+
: activity.represented_season_count === 1 ? "Showing one season." : `Showing all ${number(activity.represented_season_count)} seasons.`;
|
|
1792
1867
|
const projectionCopy = activity.omitted_earlier_season_count > 0
|
|
1793
1868
|
? ` ${number(activity.omitted_earlier_season_count)} even earlier seasons, ${number(activity.omitted_earlier_active_season_count)} of them with listening, go back further than Moondog keeps (80 seasons).`
|
|
1794
1869
|
: "";
|
|
1795
1870
|
return `<article class="panel listening-seasons-panel" id="listening-seasons">
|
|
1796
|
-
<div class="listening-seasons-heading"><div><span class="panel-label">Three months at a time, in UTC</span><h3>Listening Seasons</h3></div><strong>${escapeHtml(`${number(activity.active_season_count)} seasons with listening`)}</strong></div>
|
|
1871
|
+
<div class="listening-seasons-heading"><div><span class="panel-label">Three months at a time, in UTC</span><h3>Listening Seasons</h3></div><strong>${escapeHtml(`${number(activity.active_season_count)} ${activity.active_season_count === 1 ? "season" : "seasons"} with listening`)}</strong></div>
|
|
1797
1872
|
<p class="panel-intro">What filled each quarter of the year. The top artist and song describe those months only, not your mood or what was happening in your life.</p>
|
|
1798
1873
|
<div class="listening-seasons-grid">${cards}</div>
|
|
1799
1874
|
<p class="listening-seasons-boundary">${escapeHtml(`${previewCopy}${projectionCopy} New means new to your history, which is not always when you found it. An empty season means no history was kept, not that you stopped listening.`)}</p>
|
|
@@ -1836,6 +1911,8 @@ function crossFormatIdentityCoverage(coverage) {
|
|
|
1836
1911
|
export function renderTasteprintHtml(profile, options = {}) {
|
|
1837
1912
|
const view = createTasteprintView(profile, options);
|
|
1838
1913
|
const coverage = view.coverage;
|
|
1914
|
+
const collection = view.collection?.metrics ?? [];
|
|
1915
|
+
const duration = durationMetric(coverage);
|
|
1839
1916
|
const context = view.behavior.context;
|
|
1840
1917
|
const profiledEvents =
|
|
1841
1918
|
context.effective_events_profiled ?? coverage.profiled_listening_events;
|
|
@@ -1847,9 +1924,8 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
1847
1924
|
const rangeLabel = view.timeline.earliest && view.timeline.latest
|
|
1848
1925
|
? `${dateLabel(view.timeline.earliest)} to ${dateLabel(view.timeline.latest)}`
|
|
1849
1926
|
: "Your history";
|
|
1850
|
-
const
|
|
1851
|
-
const rediscoveryQuietDays =
|
|
1852
|
-
context.rediscovery_quiet_days ?? recentWindow;
|
|
1927
|
+
const recentPeriod = recentListeningPeriod(profile);
|
|
1928
|
+
const rediscoveryQuietDays = context.rediscovery_quiet_days ?? context.recent_window_days ?? 90;
|
|
1853
1929
|
const listenerCorrectionCount =
|
|
1854
1930
|
view.deliberate.listener_preferences.length +
|
|
1855
1931
|
view.deliberate.listener_avoids.length;
|
|
@@ -1895,8 +1971,9 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
1895
1971
|
: null,
|
|
1896
1972
|
hasProviderSnapshot ? "what Spotify says about you" : null,
|
|
1897
1973
|
].filter(Boolean);
|
|
1898
|
-
const heroCopy =
|
|
1899
|
-
|
|
1974
|
+
const heroCopy = collection.length ? "A snapshot of the music you keep. Measuring listening time requires individual play records."
|
|
1975
|
+
: `A reading of ${naturalList(heroDimensions)}. No single number gets to define your taste.`;
|
|
1976
|
+
const listeningSectionLinks = collection.length ? [] : [
|
|
1900
1977
|
{ href: "#taste-shape", label: "Shine On" },
|
|
1901
1978
|
...(view.behavior.monthly_activity
|
|
1902
1979
|
? [{ href: "#listening-pulse", label: "Months" }]
|
|
@@ -1913,13 +1990,16 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
1913
1990
|
? [{ href: "#listening-patterns", label: "Stretches" }]
|
|
1914
1991
|
: []),
|
|
1915
1992
|
{ href: "#tracks-that-stay", label: "Quiet and back" },
|
|
1993
|
+
];
|
|
1994
|
+
const sectionLinks = [
|
|
1995
|
+
...listeningSectionLinks,
|
|
1916
1996
|
...(listenerCorrectionCount > 0
|
|
1917
1997
|
? [{ href: "#listener-corrections", label: "What you told me" }]
|
|
1918
1998
|
: []),
|
|
1919
1999
|
...(hasProfileChoiceSignals || hasFacetSignals
|
|
1920
2000
|
? [{ href: "#profile-evidence", label: hasProfileChoiceSignals ? "Kept on purpose" : "Artists and genres" }]
|
|
1921
2001
|
: []),
|
|
1922
|
-
{ href: "#playback-flow", label: "How you listen" },
|
|
2002
|
+
...(collection.length ? [] : [{ href: "#playback-flow", label: "How you listen" }]),
|
|
1923
2003
|
...(hasProviderSnapshot
|
|
1924
2004
|
? [{ href: "#provider-snapshot", label: "Spotify's view" }]
|
|
1925
2005
|
: []),
|
|
@@ -1932,7 +2012,7 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
1932
2012
|
|
|
1933
2013
|
const choicePanels = [
|
|
1934
2014
|
view.deliberate.strong_preferences.length > 0
|
|
1935
|
-
? `<article class="panel"><
|
|
2015
|
+
? `<article class="panel"><h3>Likes, ratings, and collection</h3>${preferenceSignalList(view.deliberate.strong_preferences)}</article>`
|
|
1936
2016
|
: "",
|
|
1937
2017
|
view.deliberate.saved_tracks.length > 0
|
|
1938
2018
|
? `<article class="panel"><span class="panel-label">Your library</span><h3>Saved songs</h3>${trackRows(view.deliberate.saved_tracks)}</article>`
|
|
@@ -1958,12 +2038,10 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
1958
2038
|
? `<div class="facet-block"><h3>Genres</h3>${tagCloud(view.facets.genres)}</div>`
|
|
1959
2039
|
: "",
|
|
1960
2040
|
].filter(Boolean);
|
|
1961
|
-
const profileEvidenceHeading = hasProfileChoiceSignals
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
: "Artists and genres";
|
|
1966
|
-
const profileEvidenceCopy = hasProfileChoiceSignals
|
|
2041
|
+
const profileEvidenceHeading = hasProfileChoiceSignals ? "Kept on purpose" : "Artists and genres";
|
|
2042
|
+
const profileEvidenceCopy = collection.length
|
|
2043
|
+
? (hasProfileChoiceSignals ? "Choices recorded in your music collection." : "Artists and genres in your music collection.")
|
|
2044
|
+
: hasProfileChoiceSignals
|
|
1967
2045
|
? hasFacetSignals
|
|
1968
2046
|
? "Songs you saved, loved, followed, put on playlists, or searched for. These are choices you made, kept apart from what you only played. The artist and genre summary sits apart too, because it is a summary, not a choice."
|
|
1969
2047
|
: "Songs you saved, loved, followed, put on playlists, or searched for. These are choices you made, kept apart from what you only played."
|
|
@@ -2194,7 +2272,7 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
2194
2272
|
|
|
2195
2273
|
.overview {
|
|
2196
2274
|
display: grid;
|
|
2197
|
-
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
2275
|
+
grid-template-columns: repeat(var(--metric-columns, 4), minmax(0, 1fr));
|
|
2198
2276
|
gap: 14px;
|
|
2199
2277
|
margin: 24px 0;
|
|
2200
2278
|
}
|
|
@@ -2957,11 +3035,13 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
2957
3035
|
<body>
|
|
2958
3036
|
<main class="shell">
|
|
2959
3037
|
<header class="hero">
|
|
2960
|
-
<p class="eyebrow">Moondog listening report, private</p>
|
|
2961
|
-
<h1>${escapeHtml(spanLabel(view.timeline.days))}
|
|
3038
|
+
<p class="eyebrow">Moondog ${collection.length ? "collection" : "listening"} report, private</p>
|
|
3039
|
+
<h1>${collection.length ? "Your music collection" : escapeHtml(spanLabel(view.timeline.days))}</h1>
|
|
2962
3040
|
<p class="hero-copy">${escapeHtml(heroCopy)}</p>
|
|
2963
3041
|
<div class="hero-meta" aria-label="Tasteprint snapshot metadata">
|
|
2964
|
-
|
|
3042
|
+
${view.collection?.apple_export_day ? `<div><span>Apple Music library export</span><strong>${escapeHtml(dateLabel(view.collection.apple_export_day))}</strong></div>`
|
|
3043
|
+
: collection.length ? '<div><span>Source</span><strong>Music collection</strong></div>'
|
|
3044
|
+
: `<div><span>Your history</span><strong>${escapeHtml(rangeLabel)}</strong></div>`}
|
|
2965
3045
|
<div><span>Made</span><strong>${escapeHtml(generatedLabel)}</strong></div>
|
|
2966
3046
|
<div><span>Version</span><strong>${escapeHtml(view.profile_version)}</strong></div>
|
|
2967
3047
|
</div>
|
|
@@ -2972,22 +3052,23 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
2972
3052
|
<div><strong>Private, made on this machine</strong><p>This page is about you. It loads nothing from the internet. Share it only if you are happy for others to see the artists, tracks, and numbers on it.</p></div>
|
|
2973
3053
|
</aside>
|
|
2974
3054
|
|
|
2975
|
-
<section class="overview" aria-label="Listening coverage">
|
|
3055
|
+
<section class="overview" aria-label="${collection.length ? "Collection coverage" : "Listening coverage"}"${collection.length ? ` style="--metric-columns: ${Math.min(collection.length, 4)}"` : ""}>
|
|
3056
|
+
${collection.length ? collection.map(({ value, label }) => metricCard(value, label)).join("") : `
|
|
2976
3057
|
${metricCard(number(coverage.effective_listening_events), "plays", `${number(coverage.profiled_listening_events)} counted in rankings`)}
|
|
2977
|
-
${metricCard(
|
|
3058
|
+
${metricCard(duration.value, duration.label, rangeLabel)}
|
|
2978
3059
|
${metricCard(number(coverage.listening_tracks), "tracks", resolvedShare === null ? "matching unknown" : `${number(resolvedShare, 1)}% matched to a known song`)}
|
|
2979
|
-
${metricCard(number(coverage.spotify_playlist_memberships), "songs on playlists", `${number(coverage.spotify_saved_tracks)} saved songs`)}
|
|
3060
|
+
${metricCard(number(coverage.spotify_playlist_memberships), "songs on playlists", `${number(coverage.spotify_saved_tracks)} saved songs`)}`}
|
|
2980
3061
|
</section>
|
|
2981
3062
|
|
|
2982
3063
|
${crossFormatIdentityCoverage(coverage)}
|
|
2983
3064
|
|
|
2984
3065
|
${sectionNavigator}
|
|
2985
3066
|
|
|
2986
|
-
|
|
2987
|
-
<div class="section-heading"><h2>Shine On</h2><p>
|
|
3067
|
+
${collection.length ? "" : `<section class="section dark" id="taste-shape">
|
|
3068
|
+
<div class="section-heading"><h2>Shine On</h2><p>Your top artists over the full history and near its end. Bars compare within each list only.</p></div>
|
|
2988
3069
|
<div class="two-column">
|
|
2989
|
-
<article class="panel"><span class="panel-label">All of your history</span><h3>
|
|
2990
|
-
<article class="panel"><span class="panel-label"
|
|
3070
|
+
<article class="panel"><span class="panel-label">All of your history</span><h3>Top artists overall</h3>${artistRows(view.behavior.enduring_artists)}</article>
|
|
3071
|
+
<article class="panel"><span class="panel-label">${escapeHtml(recentPeriod)}</span><h3>Lately</h3>${artistRows(view.behavior.recent_artists, { recent: true })}</article>
|
|
2991
3072
|
</div>
|
|
2992
3073
|
</section>
|
|
2993
3074
|
|
|
@@ -3022,9 +3103,9 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
3022
3103
|
${view.behavior.historical_return_tracks.length > 0 ? `<article class="panel rediscovery-panel"><span class="panel-label">Back after ${escapeHtml(number(context.historical_return_minimum_gap_days ?? 180))}+ days away</span><h3>Coming Back to Life</h3><p class="panel-intro">Music that came back: songs that found their way back after long gaps. That is a pattern, not proof you missed them or left them on purpose.</p>${trackRows(view.behavior.historical_return_tracks)}</article>` : ""}
|
|
3023
3104
|
<div class="two-column">
|
|
3024
3105
|
<article class="panel"><span class="panel-label">All of your history</span><h3>Most played</h3>${trackRows(view.behavior.repeat_tracks)}</article>
|
|
3025
|
-
<article class="panel"><span class="panel-label"
|
|
3106
|
+
<article class="panel"><span class="panel-label">${escapeHtml(recentPeriod)}</span><h3>Recently</h3>${trackRows(view.behavior.recent_tracks)}</article>
|
|
3026
3107
|
</div>
|
|
3027
|
-
</section
|
|
3108
|
+
</section>`}
|
|
3028
3109
|
|
|
3029
3110
|
${listenerCorrectionCount > 0 ? `<section class="section" id="listener-corrections">
|
|
3030
3111
|
<div class="section-heading"><h2>What you told me</h2><p>Your own choices. They count for more than play counts, you can undo them any time, and they never rewrite your history.</p></div>
|
|
@@ -3036,7 +3117,7 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
3036
3117
|
|
|
3037
3118
|
${profileEvidenceSection}
|
|
3038
3119
|
|
|
3039
|
-
|
|
3120
|
+
${collection.length ? "" : `<section class="section dark" id="playback-flow">
|
|
3040
3121
|
<div class="section-heading"><h2>How you listen</h2><p>How songs started, ended, and played. These overlap, and none of them says what you like.</p></div>
|
|
3041
3122
|
<div class="behavior-grid">
|
|
3042
3123
|
${behaviorCard(context.direct_selection_starts, context.start_reason_events, "Picked yourself", "Songs you started directly. A choice in the moment, not a measure of how much you cared.", "plays with a start reason")}
|
|
@@ -3047,7 +3128,7 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
3047
3128
|
${behaviorCard(context.offline_events, context.offline_state_events, "Offline", "Played without a connection. Nothing more than that.", "plays with offline data")}
|
|
3048
3129
|
</div>
|
|
3049
3130
|
<p class="context-note">Percentages only count plays where Spotify recorded that detail. ${escapeHtml(number(context.incognito_events_excluded))} private-session plays were left out of the rankings.</p>
|
|
3050
|
-
</section
|
|
3131
|
+
</section>`}
|
|
3051
3132
|
|
|
3052
3133
|
${providerSection}
|
|
3053
3134
|
|
|
@@ -3056,7 +3137,7 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
3056
3137
|
<div class="limitations">${view.limitations.map((item) => `<p>${escapeHtml(item)}</p>`).join("")}</div>
|
|
3057
3138
|
</section>
|
|
3058
3139
|
|
|
3059
|
-
<footer><span>Moondog listening report / private, made on this machine / works offline</span><span>Generated ${escapeHtml(view.generated_at)}</span></footer>
|
|
3140
|
+
<footer><span>Moondog ${collection.length ? "collection" : "listening"} report / private, made on this machine / works offline</span><span>Generated ${escapeHtml(view.generated_at)}</span></footer>
|
|
3060
3141
|
</main>
|
|
3061
3142
|
</body>
|
|
3062
3143
|
</html>
|
|
@@ -3066,7 +3147,9 @@ export function renderTasteprintHtml(profile, options = {}) {
|
|
|
3066
3147
|
export function renderTasteprintCardHtml(profile, options = {}) {
|
|
3067
3148
|
const view = createTasteprintView(profile, options);
|
|
3068
3149
|
const coverage = view.coverage;
|
|
3069
|
-
const
|
|
3150
|
+
const duration = durationMetric(coverage);
|
|
3151
|
+
const collection = view.collection?.metrics ?? [];
|
|
3152
|
+
const recentPeriod = recentListeningPeriod(profile);
|
|
3070
3153
|
const enduringArtists = view.behavior.enduring_artists.slice(0, 3);
|
|
3071
3154
|
const recentArtists = view.behavior.recent_artists.slice(0, 2);
|
|
3072
3155
|
const repeatTracks = view.behavior.repeat_tracks.slice(0, 2);
|
|
@@ -3077,7 +3160,7 @@ export function renderTasteprintCardHtml(profile, options = {}) {
|
|
|
3077
3160
|
? `${dateLabel(view.timeline.earliest)} to ${dateLabel(view.timeline.latest)}`
|
|
3078
3161
|
: "Bounded local profile range";
|
|
3079
3162
|
const topArtist = enduringArtists[0]?.name;
|
|
3080
|
-
const headline = topArtist
|
|
3163
|
+
const headline = collection.length ? "Your music collection." : topArtist
|
|
3081
3164
|
? `${topArtist}, shining on.`
|
|
3082
3165
|
: "Your listening, so far.";
|
|
3083
3166
|
const boundary =
|
|
@@ -3096,12 +3179,9 @@ export function renderTasteprintCardHtml(profile, options = {}) {
|
|
|
3096
3179
|
? `${number(item.distinct_tracks)} ${item.distinct_tracks === 1 ? "track" : "tracks"}`
|
|
3097
3180
|
: null,
|
|
3098
3181
|
].filter(Boolean);
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
: "new lately"
|
|
3103
|
-
: `#${index + 1} across the years`;
|
|
3104
|
-
return `<li><span class="rank">${String(index + 1).padStart(2, "0")}</span><div><strong>${escapeHtml(item.name)}</strong><small>${escapeHtml([relationship, ...details].join(" / "))}</small></div></li>`;
|
|
3182
|
+
const overallRank = recent ? item.long_arc_rank : index + 1;
|
|
3183
|
+
if (Number.isInteger(overallRank)) details.unshift(`#${overallRank} overall`);
|
|
3184
|
+
return `<li><span class="rank">${String(index + 1).padStart(2, "0")}</span><div><strong>${escapeHtml(item.name)}</strong><small>${escapeHtml(details.join(" / "))}</small></div></li>`;
|
|
3105
3185
|
})
|
|
3106
3186
|
.join("")}</ol>`
|
|
3107
3187
|
: '<p class="empty-card">Nothing here yet.</p>';
|
|
@@ -3251,7 +3331,7 @@ export function renderTasteprintCardHtml(profile, options = {}) {
|
|
|
3251
3331
|
|
|
3252
3332
|
.metrics {
|
|
3253
3333
|
display: grid;
|
|
3254
|
-
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
3334
|
+
grid-template-columns: repeat(var(--metric-columns, 3), minmax(0, 1fr));
|
|
3255
3335
|
gap: 1px;
|
|
3256
3336
|
margin-top: auto;
|
|
3257
3337
|
border: 1px solid #42413d;
|
|
@@ -3465,6 +3545,12 @@ export function renderTasteprintCardHtml(profile, options = {}) {
|
|
|
3465
3545
|
|
|
3466
3546
|
.empty-card { margin: 0; color: #68625a; font-size: 11px; font-style: italic; }
|
|
3467
3547
|
|
|
3548
|
+
.collection-card { width: min(680px, 100%); min-height: 0; grid-template-columns: 1fr; }
|
|
3549
|
+
.collection-card .identity { min-height: 0; }
|
|
3550
|
+
.collection-card .card-kicker { margin-top: 36px; }
|
|
3551
|
+
.collection-card .metrics { margin-top: 26px; }
|
|
3552
|
+
.collection-card .content { grid-template-rows: auto auto; }
|
|
3553
|
+
|
|
3468
3554
|
@media (max-width: 820px) {
|
|
3469
3555
|
body { padding: 10px; place-items: start center; }
|
|
3470
3556
|
.taste-card { min-height: 0; grid-template-columns: 1fr; border-radius: 22px; }
|
|
@@ -3491,33 +3577,35 @@ export function renderTasteprintCardHtml(profile, options = {}) {
|
|
|
3491
3577
|
</style>
|
|
3492
3578
|
</head>
|
|
3493
3579
|
<body>
|
|
3494
|
-
<main class="taste-card" data-artifact="moondog-tasteprint-card/1">
|
|
3580
|
+
<main class="taste-card${collection.length ? " collection-card" : ""}" data-artifact="moondog-tasteprint-card/1">
|
|
3495
3581
|
<section class="identity" aria-labelledby="card-title">
|
|
3496
3582
|
<div class="brand-row"><span>Moondog</span><span>Private recap</span></div>
|
|
3497
|
-
<p class="card-kicker">Tasteprint card /
|
|
3583
|
+
<p class="card-kicker">Tasteprint card / ${collection.length ? "music collection" : "listening history"}</p>
|
|
3498
3584
|
<h1 id="card-title">${escapeHtml(headline)}</h1>
|
|
3499
|
-
<p class="span">${escapeHtml(spanLabel(view.timeline.days))}
|
|
3500
|
-
<div class="metrics" aria-label="Listening coverage">
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3585
|
+
<p class="span">${collection.length ? "Measuring listening time requires individual play records." : `${escapeHtml(spanLabel(view.timeline.days))}.`}</p>
|
|
3586
|
+
<div class="metrics" aria-label="${collection.length ? "Collection coverage" : "Listening coverage"}"${collection.length ? ` style="--metric-columns: ${Math.min(collection.length, 3)}"` : ""}>
|
|
3587
|
+
${(collection.length ? collection.slice(0, 3) : [duration,
|
|
3588
|
+
{ value: number(coverage.listening_tracks), label: "tracks" }, { value: number(coverage.effective_listening_events), label: "plays" },
|
|
3589
|
+
]).map(({ value, label }) => `<div class="metric"><strong>${escapeHtml(value)}</strong><span>${escapeHtml(label)}</span></div>`).join("")}
|
|
3504
3590
|
</div>
|
|
3505
3591
|
</section>
|
|
3506
3592
|
|
|
3507
3593
|
<section class="content" aria-label="Tasteprint recap">
|
|
3508
3594
|
<header class="content-header">
|
|
3509
|
-
<p class="content-title">Private listening recap</p>
|
|
3510
|
-
|
|
3595
|
+
<p class="content-title">Private ${collection.length ? "collection" : "listening"} recap</p>
|
|
3596
|
+
${view.collection?.apple_export_day
|
|
3597
|
+
? `<p class="content-range">Apple Music library export · ${escapeHtml(dateLabel(view.collection.apple_export_day))}</p>`
|
|
3598
|
+
: collection.length ? "" : `<p class="content-range">${escapeHtml(rangeLabel)}</p>`}
|
|
3511
3599
|
</header>
|
|
3512
3600
|
|
|
3513
|
-
|
|
3601
|
+
${collection.length ? "" : `<section class="long-arc" aria-labelledby="long-arc-title">
|
|
3514
3602
|
<h2 id="long-arc-title">Shine On</h2>
|
|
3515
3603
|
${artistItems(enduringArtists)}
|
|
3516
3604
|
</section>
|
|
3517
3605
|
|
|
3518
3606
|
<div class="signal-grid">
|
|
3519
3607
|
<section class="signal-panel" aria-labelledby="recent-title">
|
|
3520
|
-
<span class="panel-label"
|
|
3608
|
+
<span class="panel-label">${escapeHtml(recentPeriod)}</span>
|
|
3521
3609
|
<h2 id="recent-title">Lately</h2>
|
|
3522
3610
|
${artistItems(recentArtists, { recent: true })}
|
|
3523
3611
|
</section>
|
|
@@ -3526,15 +3614,15 @@ export function renderTasteprintCardHtml(profile, options = {}) {
|
|
|
3526
3614
|
<h2 id="tracks-title">Most played</h2>
|
|
3527
3615
|
${trackItems}
|
|
3528
3616
|
</section>
|
|
3529
|
-
</div
|
|
3617
|
+
</div>`}
|
|
3530
3618
|
|
|
3531
3619
|
<div>
|
|
3532
3620
|
<aside class="boundary" aria-label="Interpretation and privacy boundary">
|
|
3533
3621
|
<span class="boundary-mark" aria-hidden="true">L</span>
|
|
3534
3622
|
<div>
|
|
3535
3623
|
<strong>Read it before you share it</strong>
|
|
3536
|
-
<p
|
|
3537
|
-
|
|
3624
|
+
<p>${collection.length ? "Check the collection details before sharing your card." : "This card is about you. Check every artist, track, date, and number on it before you share it."}</p>
|
|
3625
|
+
${collection.length ? "" : `<p>${escapeHtml(boundary)}</p>`}
|
|
3538
3626
|
${correctionCount > 0 ? `<span class="direct-signal">${escapeHtml(number(correctionCount))} of your own ${correctionCount === 1 ? "choice" : "choices"} applied</span>` : ""}
|
|
3539
3627
|
</div>
|
|
3540
3628
|
</aside>
|