Skip to content

Commit

Permalink
Merge pull request #39 from Chaphasilor/dev
Browse files Browse the repository at this point in the history
2024 second patch
  • Loading branch information
Chaphasilor authored Jan 2, 2025
2 parents 9e35ae3 + e186d22 commit 32eacc8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
## Welcome to Jellyfin Rewind 2024!

> [!IMPORTANT]
> Jellyfin Rewind 2024 **will launch on December 31st 2024** (2024-12-31)!
> Jellyfin Rewind 2025 **will launch on December 31st 2025** (2025-12-31)!
> If you want to be notified when it's time to review your listening habits of this year, **subscribe to release updates** by `watch`ing this repository.
> See you soon! - Chaphasilor
> See you then! - Chaphasilor
### How to use

Expand Down
5 changes: 0 additions & 5 deletions src/aggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ export function generateTopTrackInfo(itemInfo, playbackReportJSON) {
missingPlaybackReportItems += 1
}

// if (item.ArtistItems.find(artist => artist.Name === `ACRAZE`)) {
// console.log(`item.ArtistItems:`, item.ArtistItems)
// // TODO figure out how to consolidate artists with the same name but different IDs
// }

const track = new Track({
name: item.Name || `Unknown Track`,
id: item.Id,
Expand Down
18 changes: 9 additions & 9 deletions src/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ state.features = [
</div>
</div>
<div class="absolute bottom-20 left-0 w-full flex flex-col items-center gap-3">
<div>Streamed <span class="font-semibold">${() => showAsNumber(state.rewindReport.artists?.[state.settings.rankingMetric]?.[0]?.playCount[state.settings.dataSource])}</span> times.</div>
<div>Listened to <span class="font-semibold">${() => showAsNumber(state.rewindReport.artists?.[state.settings.rankingMetric]?.[0]?.uniquePlayedTracks[state.settings.dataSource])}</span> unique tracks <br>for <span class="font-semibold">${() => showAsNumber(state.rewindReport.artists?.[state.settings.rankingMetric]?.[0]?.totalPlayDuration[state.settings.dataSource].toFixed(0))}</span> minutes.</div>
<div>Streamed <span class="font-semibold">${() => showAsNumber(state.rewindReport.artists?.[state.settings.rankingMetric]?.[0]?.playCount?.[state.settings.dataSource])}</span> times.</div>
<div>Listened to <span class="font-semibold">${() => showAsNumber(state.rewindReport.artists?.[state.settings.rankingMetric]?.[0]?.uniquePlayedTracks?.[state.settings.dataSource])}</span> unique tracks <br>for <span class="font-semibold">${() => showAsNumber(state.rewindReport.artists?.[state.settings.rankingMetric]?.[0]?.totalPlayDuration[state.settings.dataSource].toFixed(0))}</span> minutes.</div>
</div>
</div>
<div class="fixed -top-16 blur-xl brightness-75 bg-gray-800 -left-40 md:translate-x-1/3 w-[125vh] h-[125vh] z-[-1] rotate-[17deg]">
Expand Down Expand Up @@ -626,14 +626,14 @@ state.features = [
<h3 class="text-2xl font-medium">...compared to last year!</h3>
<div class="mt-24 w-full px-6 flex flex-col items-center gap-2">
<div class="font-semibold text-xl">This year, you played <span class="font-semibold text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.totalPlays[state.settings.dataSource]).toFixed(0)) : `???`}</span> tracks ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.totalPlays[state.settings.dataSource] >= 0) ? `more` : `less`} than in ${() => state.rewindReport?.featureDelta?.year}.</div>
<div class="font-semibold text-xl">This year, you had <span class="font-semibold text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.totalPlays[state.settings.dataSource]).toFixed(0)) : `???`}</span> ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.totalPlays[state.settings.dataSource] >= 0) ? `more` : `less`} streams than in ${() => state.rewindReport?.featureDelta?.year ?? (state.rewindReport?.year - 1)}.</div>
</div>
<div class="mt-28 w-full px-10 flex flex-col items-center gap-3">
<span class="font-semibold text-xl mb-3">Additionally, you listened to</span>
<div><span class="font-semibold text-xl"><span class="text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.tracks)) : `???`}</span> ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.tracks >= 0) ? `more` : `less`} tracks.</div>
<div><span class="font-semibold text-xl"><span class="text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.artists)) : `???`}</span> ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.artists >= 0) ? `more` : `less`} artists.</div>
<div><span class="font-semibold text-xl"><span class="text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.albums)) : `???`}</span> ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.albums >= 0) ? `more` : `less`} albums.</div>
<span class="font-semibold text-xl mb-3">You listened to</span>
<div><span class="font-semibold text-xl"><span class="text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.tracks)) : `???`}</span> ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.tracks >= 0) ? `more` : `less`} unique tracks.</div>
<div><span class="font-semibold text-xl"><span class="text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.artists)) : `???`}</span> ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.artists >= 0) ? `more` : `less`} unique artists.</div>
<div><span class="font-semibold text-xl"><span class="text-3xl text-sky-500 font-quicksand">${() => state.extraFeatures.listeningActivityDifference ? showAsNumber(Math.abs(state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.albums)) : `???`}</span> ${() => (!state.extraFeatures.listeningActivityDifference || state.rewindReport?.featureDelta?.listeningActivityDifference?.uniquePlays.albums >= 0) ? `more` : `less`} unique albums.</div>
</div>
<div class="mt-24 w-full px-6 flex flex-col items-center gap-2">
Expand Down Expand Up @@ -986,11 +986,11 @@ state.features = [
buildFeature(`summary`, html`
<div class="h-full p-4 flex flex-col justify-around">
<h2 class="text-2xl mt-8 font-quicksand leading-8 flex flex-col items-center gap-1.5 text-center font-semibold text-gray-800 dark:text-gray-200">
<span>${() => state.auth?.config?.user?.name}'s</span>
<span>${() => state.rewindReport?.user?.name}'s</span>
<div class="w-full flex flex-col items-center">
<img class="h-20" src="${() => state.settings.darkMode ? '/media/banner-dark.svg' : '/media/banner-light.svg'}" alt="Jellyfin Rewind Logo">
</div>
<span>Report</span>
<span>Report <span class="text-[#00A4DC] text-2xl font-semibold font-quicksand">${() => state.rewindReport?.year}</span></span>
</h2>
<div class="grid grid-cols-2 place-items-stretch gap-1 w-full mt-6 pb-20 text-gray-800 dark:text-gray-100">
Expand Down
2 changes: 1 addition & 1 deletion src/offline-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const uploadOfflinePlaybackQuery = (offlinePlays, auth) => {
(DateCreated, UserId, ItemId, ItemType, ItemName, PlaybackMethod, ClientName, DeviceName, PlayDuration)
VALUES
${offlinePlays.map(play =>
`( '${play.timestamp.toISOString().slice(0, 19).replace(`T`, ` `)}.0000000', '${auth.config.user.id}', '${play.itemId}', 'Audio', '${play.artist?.replaceAll?.(`'`, `''`)} - ${play.title?.replaceAll?.(`'`, `''`)} (${play.album?.replaceAll?.(`'`, `''`)})', 'OfflinePlay', '${play.client?.replaceAll?.(`'`, `''`)}', '${play.device.replaceAll(`'`, `''`)}', ${play.playDuration ?? 0})`
`( '${play.timestamp.toISOString().slice(0, 19).replace(`T`, ` `)}.0000000', '${play.userId ?? auth.config.user.id}', '${play.itemId}', 'Audio', '${play.artist?.replaceAll?.(`'`, `''`)} - ${play.title?.replaceAll?.(`'`, `''`)} (${play.album?.replaceAll?.(`'`, `''`)})', 'OfflinePlay', '${play.client?.replaceAll?.(`'`, `''`)}', '${play.device.replaceAll(`'`, `''`)}', ${play.playDuration ?? 0})`
).join(`,`)}
`
}
Expand Down
26 changes: 19 additions & 7 deletions src/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const viewStart = html`
class="px-2 py-1 rounded-lg text-sm border-[#00A4DC] border-2 hover:bg-[#0085B2] font-medium text-gray-700 dark:text-gray-200 mt-8 flex flex-row gap-4 items-center mx-auto hover:text-white"
@click="${() => state.currentView = `importReportForViewing`}"
>
<span>Import an Existing Report Instead</span>
<span>View an Existing Report Instead</span>
</button>
</div>
Expand Down Expand Up @@ -466,6 +466,8 @@ const viewUser = html`
</ul>
</div>
${() => buttonLogOut}
</div>
`

Expand Down Expand Up @@ -856,15 +858,15 @@ const viewImportOfflinePlayback = html`
${() => header}
<div class="flex flex-col gap-4 text-lg font-medium leading-6 text-gray-500 dark:text-gray-400 mt-10 w-full mx-auto text-balance text-center">
<div class="flex flex-col gap-4 text-lg font-medium leading-6 text-gray-500 dark:text-gray-400 mt-4 w-full mx-auto text-balance text-center">
<p class="">We noticed you've been using Finamp's beta version to listen to music.</p>
<p class="">Finamp keeps track of your playback history even when you're not connected to your server, and you can now import that history!</p>
<p class="">Imported plays will only be added to the Playback Reporting addon's database, but can then used to generate a more accurate Rewind report for you in the following steps.</p>
<p class="text-orange-500">Make sure to only import this once!</p>
</div>
<button
class="px-2 py-1 rounded-lg text-sm border-[#00A4DC] border-2 hover:bg-[#0085B2] font-medium text-gray-700 dark:text-gray-200 mt-2 flex flex-row gap-4 items-center mx-auto hover:text-white"
class="px-2 py-1 rounded-lg text-sm border-gray-500 border-2 hover:bg-gray-600 dark:border-gray-400 dark:hover:bg-gray-300 font-medium text-gray-700 dark:text-gray-200 mt-4 flex flex-row gap-4 items-center mx-auto hover:text-white"
@click="${() => state.finampOfflineExportDialogOpen = true}"
>
<span>How can I import my offline plays?</span>
Expand Down Expand Up @@ -896,7 +898,7 @@ const viewImportOfflinePlayback = html`
${() => state.importingOfflinePlayback ? html`
<p class="mt-8 px-10 text-xl text-balance font-semibold text-gray-600 dark:text-gray-300">Importing, please wait a few seconds...</p>
` : html`
<p class="mt-12 px-10 text-balance font-semibold text-gray-600 dark:text-gray-300">Already imported your offline plays or don't have any?</p>
<p class="mt-4 px-10 text-balance font-semibold text-gray-600 dark:text-gray-300">Already imported your offline plays or don't have any?</p>
<button
class="px-2 py-1 rounded-lg text-sm border-[#00A4DC] border-2 hover:bg-[#0085B2] font-medium text-gray-700 dark:text-gray-200 mt-2 flex flex-row gap-4 items-center mx-auto hover:text-white"
@click="${() => state.currentView = `importLastYearsReport`}"
Expand Down Expand Up @@ -953,6 +955,16 @@ const viewImportLastYearsReport = html`
>
<span>Continue without last year's report</span>
</button>
${() => !state.auth.config.user.isAdmin ? html`
<button
class="px-2 py-1 rounded-lg text-sm border-gray-500 border-2 hover:bg-gray-600 dark:border-gray-400 dark:hover:bg-gray-300 font-medium text-gray-700 dark:text-gray-200 mt-20 flex flex-row gap-4 items-center mx-auto hover:text-white"
@click="${() => state.currentView = `importOfflinePlayback`}"
>
<span>Using Finamp's beta? Import offline playback now!</span>
</button>
` : null}
`
}
` : html`
Expand Down Expand Up @@ -1075,9 +1087,9 @@ const viewLoad = html`
const buttonLogOut = html`
<button
class="px-4 py-2 rounded-xl border-2 border-red-400 hover:bg-red-500 dark:border-red-600 dark:hover:bg-red-700 font-medium mt-20 flex flex-row gap-3 items-center mx-auto text-red-500 hover:text-white"
@click="${() => {
state.auth.destroySession()
deleteRewind()
@click="${async () => {
await state.auth.destroySession()
await deleteRewind()
state.currentView = `start`
}}"
>
Expand Down

0 comments on commit 32eacc8

Please sign in to comment.