Skip to content

Fix Apple Music library parsing and PDF/HTML export - #15

Open
gamebits wants to merge 5 commits into
tombly:masterfrom
gamebits:fix/cursor
Open

gamebits wants to merge 5 commits into
tombly:masterfrom
gamebits:fix/cursor

Conversation

@gamebits

@gamebits gamebits commented Jul 3, 2026

Copy link
Copy Markdown

Summary

This pull request restores Super Analyzer for modern Apple Music library exports and fixes broken Share-menu exports (PDF/HTML). It also updates documentation and adds a fat-JAR build script.

This PR and its code were written using Cursor in privacy mode.

Library parsing (FileParser)

  • Replace Vector playlist lookups with HashSet for faster track membership checks
  • Detect the Music playlist more robustly (single-line or split <key>Music</key> / <true/>)
  • Add phase logging so large libraries show progress in the terminal
  • Improve null-safety and progress-bar accounting during parse

Share export fixes (Share, HomeWindow)

  • Fix Swing deadlock on macOS by showing save dialogs on the UI thread before starting background export
  • Render chart PNGs on the EDT during PDF/HTML export
  • Fix crash in Album Likes chart when albums have no genre (ColorSeriesXYDataSet)
  • Ensure PDF documents are closed in a finally block (fixes zero-byte PDFs on error)
  • Fix HTML template reading and complete multi-chart HTML export

Other

  • Lazy-init combo box items in Analysis for export paths
  • Add build-jar.sh to produce a runnable fat JAR (build/super-analyzer.jar)
  • Update README.md, in-app help (SuperAnalyzer.properties, help.html) for Apple Music export workflow and Java 8+ requirements
  • Update .gitignore to exclude build artifacts, JARs, and library XML exports

Test plan

  • ./build.sh compiles without errors
  • ./build-jar.sh produces build/super-analyzer.jar
  • java -jar build/super-analyzer.jar launches the UI
  • Analyze an exported Library.xml from Apple Music; confirm terminal shows Phase 1/2 progress and analysis completes
  • Share → Save Analysis as PDF produces a non-empty PDF with all charts
  • Share → Save Analysis as HTML produces a folder with index.html and all chart PNGs
  • Share → Save Chart as Image still works for an individual chart
  • Help panel shows updated Apple Music instructions and version 3.6

## Summary

This pull request restores Super Analyzer for modern Apple Music library exports and fixes broken Share-menu exports (PDF/HTML). It also updates documentation and adds a fat-JAR build script.

This PR and its code were written using [Cursor in privacy mode](https://cursor.com/data-use).

### Library parsing (`FileParser`)

- Replace `Vector` playlist lookups with `HashSet` for faster track membership checks
- Detect the Music playlist more robustly (single-line or split `<key>Music</key>` / `<true/>`)
- Add phase logging so large libraries show progress in the terminal
- Improve null-safety and progress-bar accounting during parse

### Share export fixes (`Share`, `HomeWindow`)

- Fix Swing deadlock on macOS by showing save dialogs on the UI thread before starting background export
- Render chart PNGs on the EDT during PDF/HTML export
- Fix crash in Album Likes chart when albums have no genre (`ColorSeriesXYDataSet`)
- Ensure PDF documents are closed in a `finally` block (fixes zero-byte PDFs on error)
- Fix HTML template reading and complete multi-chart HTML export

### Other

- Lazy-init combo box items in `Analysis` for export paths
- Add `build-jar.sh` to produce a runnable fat JAR (`build/super-analyzer.jar`)
- Update `README.md`, in-app help (`SuperAnalyzer.properties`, `help.html`) for Apple Music export workflow and Java 8+ requirements
- Update `.gitignore` to exclude build artifacts, JARs, and library XML exports

## Test plan

- [ ] `./build.sh` compiles without errors
- [ ] `./build-jar.sh` produces `build/super-analyzer.jar`
- [ ] `java -jar build/super-analyzer.jar` launches the UI
- [ ] Analyze an exported `Library.xml` from Apple Music; confirm terminal shows Phase 1/2 progress and analysis completes
- [ ] **Share → Save Analysis as PDF** produces a non-empty PDF with all charts
- [ ] **Share → Save Analysis as HTML** produces a folder with `index.html` and all chart PNGs
- [ ] **Share → Save Chart as Image** still works for an individual chart
- [ ] Help panel shows updated Apple Music instructions and version **3.6**

@elskewe elskewe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been quite a while since I've worked on SuperAnalyzer (or with Java for that matter) but here are some things I noticed. I never used the sharing options, but if they do work now that is great :)

Comment thread src/net/nosleep/superanalyzer/analysis/FileParser.java
Comment thread src/net/nosleep/superanalyzer/Share.java Outdated
Comment thread src/net/nosleep/superanalyzer/Share.java
Ken Gagne added 2 commits July 11, 2026 08:38
Restores inline code comments that Cursor had unnecessarily removed.
Extract shared view-export logic into `runViewExport()` so `exportViewImage()`
and `exportViewImages()` no longer duplicate the `SwingUtilities.invokeAndWait`
wrapper, view creation, and error handling.

Refactor `addPdfChartImages()` to call `exportViewImages()` instead of
inlining the same export logic again.

@elskewe elskewe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment. Apart from that, it looks good and also compiles and runs :)

Comment thread build-jar.sh Outdated
Avoid duplicating the class/resource build steps by reusing `build.sh`, then keep fat-JAR packaging in `build-jar.sh`.

@elskewe elskewe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me :)

Bumping to v3.8, since the last GitHub release eight years ago was v3.7.
@gamebits

Copy link
Copy Markdown
Author

Yay! Thanks, @elskewe!

I just pushed one more small change, that being to Constants.java: it still had the version as 3.6, even though the latest GitHub release was 3.7. I've bumped it to 3.8.

Should be good to merge!

@elskewe

elskewe commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Should be good to merge!

@tombly do you have anything to add?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants