Skip to content

Indicate changed resource files#554

Merged
RumovZ merged 3 commits intomainfrom
resource-icons
Feb 27, 2026
Merged

Indicate changed resource files#554
RumovZ merged 3 commits intomainfrom
resource-icons

Conversation

@RumovZ
Copy link
Collaborator

@RumovZ RumovZ commented Feb 18, 2026

@bohning, I've reimplemented your feature from #494.
I've taken your icons for the system theme, and chose new Material icons for the dark theme.

Two caveats:

  • Sync status is cached in the Python layer, so updates are only detected at startup, or when the song is reloaded, like after download or song folder change.
  • Scrolling local songs initially is noticeably slower.

@RumovZ RumovZ requested a review from bohning February 18, 2026 10:28
Comment on lines +67 to +76
def is_in_sync(self, folder: Path, force_check: bool = False) -> bool:
"""Check file exists in the given folder and is in sync."""
path = folder.joinpath(self.fname)
return (
path.exists()
and abs(utils.get_mtime(path) - self.mtime) / 1_000_000
< MTIME_TOLERANCE_SECS
)
if force_check or self._is_in_sync is None:
path = folder.joinpath(self.fname)
self._is_in_sync = (
path.exists()
and abs(utils.get_mtime(path) - self.mtime) / 1_000_000
< MTIME_TOLERANCE_SECS
)
return self._is_in_sync
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd make _is_in_sync a property or a function. You could still cache it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How exactly? Given it's a method, using @cache seemed more trouble than it's worth.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant the class attribute. I know it's internal, but it seems like a strange attribute for a resourcefile given that the object has no way of knowing if the resource is currently out of sync. Or did you intend on for updates to the attribute to be added in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see your point, but don't get what you'd like to see instead.
_is_in_sync is itself a cache for is_in_sync(). It wouldn't work as a function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Merging now, but feel free to come back to this.

@RumovZ RumovZ merged commit 1075d59 into main Feb 27, 2026
4 checks passed
@RumovZ RumovZ deleted the resource-icons branch February 27, 2026 18:45
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.

3 participants