Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for disc number (#18) #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Aga-C
Copy link
Member

@Aga-C Aga-C commented Apr 5, 2024

What is it?

  • Bugfix
  • Feature
  • Codebase improvement

Description of the changes in your PR

  • Added support for disc number metadata.
    • Reading that metadata from Audio.Media is supported since API 30, but reading from file since API 10. That's why in manual file scan I haven't added an Android version check.
  • If there's a disc number, it's displayed in an album view.
  • Sorting by track number also considers disc numbering.
  • As I've seen, Android keeps track number as a string, but MediaMetadata.Builder requires it to be a number, so I decided to keep it in our DB as a nullable integer.
    • I decided to keep it as null, not set a default value to 0, because I don't see any reason why someone wouldn't like to set 0 in that metadata.
  • Added a string for formatting disc number with track number, because I assume that in RTL languages the order may be reversed.
  • Also, added zero-padding to track number in case there's a disc number, to make it look prettier.
  • To properly handle cases where there are no disc number, I've decided to:
    • While sorting, set Int.MAX_VALUE instead of null to make sorting consistent with default Kotlin behavior (null as the last value when sorting ascending).
    • While sending track number through bundle, to not lose information about null (it defaults int to 0), I also use a constant value to later replace it with null.

Before/After Screenshots/Screen Record

  • Before:
  • After:

Fixes the following issue(s)

Acknowledgement

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.

Support album containing several disks
1 participant