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

Add attribute for Sonic Analysis #814

Merged
merged 2 commits into from
Sep 13, 2021
Merged

Add attribute for Sonic Analysis #814

merged 2 commits into from
Sep 13, 2021

Conversation

blacktwin
Copy link
Collaborator

@blacktwin blacktwin commented Aug 13, 2021

Description

Adds attribute that denotes whether an Audio object has been Sonically Analyzed.

Sonic Analysis is a new feature from Plex.

Requirements

  • Requires the latest Plex Media Server v1.24.0
  • Server OS: macOS, Windows, and Linux only
  • Server CPU: ARM CPUs are not supported

Example

plex = PlexServer(PLEX_URL, PLEX_TOKEN, session=sess)

albumAnalyzed = 0
music = plex.library.section("Music")
totalAlbums = len(music.albums())
for album in music.albums():
    if album.musicAnalysisVersion:
        albumAnalyzed += 1

print(f"Albums Total: {totalAlbums}"
      f"\nScanned: {albumAnalyzed}"
      f"\nLeft: {totalAlbums - albumAnalyzed}")

tracksAnalyzed = 0
totalTracks= len(music.searchTracks())
for track in music.searchTracks():
    if track.musicAnalysisVersion:
        tracksAnalyzed += 1

print(f"Tracks Total: {totalTracks}"
      f"\nScanned: {tracksAnalyzed}"
      f"\nLeft: {totalTracks - tracksAnalyzed}")

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods
  • I have added tests when applicable

@blacktwin blacktwin changed the title Added attribute for Sonic Analysis Add attribute for Sonic Analysis Aug 13, 2021
@JonnyWong16
Copy link
Collaborator

Do we need to disable Sonic Analysis for our tests?

https://github.com/pkkid/python-plexapi/blob/master/tools/plex-bootstraptest.py#L488

@property
def hasSonicAnalysis(self):
""" Returns True if the audio has been sonically analyzed. """
return self.musicAnalysisVersion == 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe >= 1 for future proofing.

@blacktwin
Copy link
Collaborator Author

Do we need to disable Sonic Analysis for our tests?

https://github.com/pkkid/python-plexapi/blob/master/tools/plex-bootstraptest.py#L488

It's not enabled by default so I don't think so.

@jjlawren jjlawren merged commit 168f1d3 into master Sep 13, 2021
@jjlawren jjlawren deleted the sonicAnalysis branch September 13, 2021 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants