Skip to content

Play Random Album from Specific Genre? #1637

Discussion options

You must be logged in to vote

until this is natively implemented I hacked together a script to achieve what I wanted.
This script does a mass search for "ARTISTNAME" returns 9 results (can increase the number) then plays a random URI from the list.
Works great! Thanks for making this so flexible!

alias: Random Album
sequence:
  - service: mass.search
    data:
      limit: 9
      name: ARTISTNAME
      artist: ARTISTNAME
      media_type:
        - album
    response_variable: results
  - service: mass.play_media
    metadata: {}
    data:
      media_id: "{{ results.albums[range(1, 10) | random].uri }}"
    target:
      device_id: XYZ
mode: single

Replies: 4 comments 11 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@marcelveldt
Comment options

@ministryofsillywalks
Comment options

@ministryofsillywalks
Comment options

Comment options

You must be logged in to vote
4 replies
@OzGav
Comment options

@ministryofsillywalks
Comment options

@JDogg016
Comment options

@OzGav
Comment options

Answer selected by ministryofsillywalks
Comment options

You must be logged in to vote
4 replies
@OzGav
Comment options

@napalmcsr
Comment options

@marcelveldt
Comment options

@napalmcsr
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants