takemehomezaptoorg

Untitled

Oct 7th, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. # Plex server details
  2. baseurl = 'http://192.168.0.47:32400'
  3. token = 'WgxN5MCyBmTxAVmJMPr8' # Your Plex token
  4.  
  5. # Connect to Plex server
  6. plex = PlexServer(baseurl, token)
  7.  
  8. # Get currently playing media from the server
  9. print("Currently Playing Media on the Plex Server:")
  10. sessions = plex.sessions() # Get all active sessions
  11.  
  12. if not sessions:
  13. print("No media is currently being played on the server.")
  14. else:
  15. for session in sessions:
  16. client_title = session.player.title # Access the client title
  17. media_title = session.title # Access the media title
  18. media_type = session.type # Access the media type
  19. print(f"\nClient: {client_title}")
  20. print(f" Playing: {media_title} ({media_type})")
  21.  
  22. # Additional details for media
  23. if hasattr(session, 'grandparentTitle'):
  24. print(f" Series: {session.grandparentTitle}") # For TV shows
  25. if hasattr(session, 'year'):
  26. print(f" Year: {session.year}") # For movies
  27. if hasattr(session, 'summary'):
  28. print(f" Summary: {session.summary}") # Summary of the media
Advertisement
Add Comment
Please, Sign In to add comment