Sync iTunes Last Played into the Age and Recent columns
@mpogue2 is already working on this.
Since Sep 20, 2026.
Assessment
This issue has not been assessed yet.
Description
🤖 Generated with Claude Code
Split out of #1740, where this was item 3. The other five items of that issue are implemented; this one was deliberately set aside, because it is really about the Age and Recent columns rather than about Apple Music import.
What's wanted: a song that was last played in Music.app rather than in SquareDesk should still show a sensible Age and Recent. Today the Age column only knows about plays that happened inside SquareDesk, so a track played in Music yesterday looks like it has never been played.
The rule from the original issue is max(iTunes, SquareDesk) — whichever play happened more recently wins.
The implementation is small
The metadata plumbing added for #1740 items 2 and 6 did the hard part. What's left:
1. Read the fields. ITLibMediaItem exposes lastPlayedDate (an NSDate) and playCount directly. In readAllPlaylists() (mainwindow_applemusic.mm) this is one line each, and there is already an NSISO8601DateFormatter in that function for modifiedDate, so the date can be carried as an ISO 8601 string exactly the way modifiedDate already is. Add the two fields to PlaylistTrack.
2. Keep them per path. getAppleMusicInfo() already builds appleMusicMetaByPath; the last-played date can ride along in the same place, the way Album/Composer/Year/Duration do.
3. Use the more recent of the two. In darkLoadMusicList(), the Age cell is built from agesByFilename, which SongSettings::getSongAges() fills with julianday('now') - julianday(max(played_on)) per song. Recent is then derived from age by ageToRecent(). So for an Apple Music track, take whichever of the two ages is smaller and let Recent follow from it — no new column, no new query, no DB write.
One real design question
getSongAges() filters by session_rowid unless "Show All Song Ages" is on:
SELECT filename, julianday('now') - julianday(max(played_on))
FROM songs JOIN song_plays ON song_plays.song_rowid=songs.rowid
WHERE session_rowid = :session_rowid
GROUP BY songs.rowid
An iTunes play belongs to no session. So folding it in unconditionally would make a song look recently played in a session where it was never played, which is exactly what the per-session Age column exists to prevent.
Options, roughly in order of preference:
- Merge the iTunes date only in the "Show All Song Ages" view, and leave per-session ages purely SquareDesk's. Least surprising, and matches what each view already means.
- Merge it always, and accept that iTunes plays count toward every session.
- Make it a preference in Preferences > Apple Music, next to the filter and Type settings.
This should be decided before writing the code — it is the only part of this item that isn't mechanical.
Deliberately not included
playCount, skipCount and skipDate are all available from ITLibMediaItem too, and were left out of the #1740 column work on the grounds that they belong with this item rather than with the metadata columns. If they are wanted as columns, the machinery from #1740 item 2 makes each one a small addition.
- Dominant language
- C++
- Stars
- 14
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mpogue2/SquareDesk
-
enhancement Ready for final check
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
mpogue2/SquareDesk#1818 · 1 comment ·
-
bug Ready for final check
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
mpogue2/SquareDesk#1758 · 1 comment ·
-
bug Linux only
Difficulty 1/5 Under an hour Newbie friendliness 75/100
mpogue2/SquareDesk#204 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
mpogue2/SquareDesk#172 · 4 comments ·
-
bug Ready for final check
Difficulty 4/5 3-5 days Newbie friendliness 45/100
mpogue2/SquareDesk#1819 · 1 comment ·
All issues in mpogue2/SquareDesk
Similar issues
-
good first issue invalid
Difficulty 1/5 Under an hour Newbie friendliness 72/100
DanielJerolm/gpcc#74 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
patrick-hudson/put.gd-desktop#808 ·
Maintainers usually reply within 1 day
-
DPI change is not fully handled in the cascading window on WindowsPossibly taken @yukawa claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
launch-client --save-creds creates creds/<account>/ with mode 755, not 700Possibly taken @metis-sprock claimed this today. Openbacklog bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
EchoTools/nevr-runtime#1471 ·
Maintainers usually reply within 1 day