Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Sync iTunes Last Played into the Age and Recent columns

Open
#1,745 2 comments 0 reactions 1 assignee View on GitHub

@mpogue2 is already working on this.

Since Sep 20, 2026.

Assessment

This issue has not been assessed yet.

Description

enhancement Ready for final check

🤖 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:

  1. 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.
  2. Merge it always, and accept that iTunes plays count toward every session.
  3. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mpogue2/SquareDesk

All issues in mpogue2/SquareDesk

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.