Skip to content

Commit

Permalink
bump to 2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bushvin committed Oct 4, 2024
1 parent c025f97 commit 9130b39
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,53 @@ media_player:
### Services
#### Service media\_player.play\_media
#### Service mopidy.get_search_result
*This service was originally developed by [Daniele Ricci](https://github.com/daniele-athome)*
Search media based on keywords and return them for use in a script or automation.
**Note:** One of the keyword fields **must** be used: `keyword`, `keyword_album`, `keyword_artist`, `keyword_genre` or `keyword_track_name`

|Service data attribute|Optional|Description|Example|
|-|-|-|-|
|`entity_id`|no|String or list of `entity_id`s to search and return the result to.| |
|`exact`|yes|String. Should the search be an exact match|false|
|`keyword`|yes|String. The keywords to search for. Will search all track fields.|Everlong|
|`keyword_album`|yes|String. The keywords to search for in album titles.|From Mars to Sirius|
|`keyword_artist`|yes|String. The keywords to search for in artists.|Queens of the Stoneage|
|`keyword_genre`|yes|String. The keywords to search for in genres.|rock|
|`keyword_track_name`|yes|String. The keywords to search for in track names.|Lazarus|
|`source`|yes|String. URI sources to search. `local`, `spotify` and `tunein` are the only supported options. Make sure to have these extensions enabled on your Mopidy Server! Separate multiple sources with a comma (,).|local,spotify|

##### Example

```yaml
script:
search_and_play_music:
fields:
[...]
sequence:
- service: mopidy.get_search_result
data:
keyword_artist: "{{ keyword_artist }}"
keyword_track_name: "{{ keyword_track_name }}"
source: local
target:
entity_id: "{{ target }}"
response_variable: music_tracks # service returns something and result will be put into this variable
- if: "{{ music_tracks['media_player.music'].result|length > 0 }}"
then:
- service: media_player.play_media
data:
media_content_id: "{{ music_tracks['media_player.music'].result[0] }}"
media_content_type: music
enqueue: "{{ enqueue }}"
target:
entity_id: "{{ target }}"
```

#### Service media_player.play_media

The `media_content_id` needs to be formatted according to the Mopidy URI scheme. These can be easily found using the *Developer tools*.

Expand Down Expand Up @@ -133,6 +179,10 @@ proxying them through Home Assistant is very resource intensive,
causing delays. Therefore, I have decided to not proxy the art when
using the Media Library for the time being.

## Contributors

- [Daniele Ricci](https://github.com/daniele-athome)

## Testers

- [Jan Gutowski](https://github.com/Switch123456789)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mopidy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"requirements": [
"mopidyapi>=1.1.0"
],
"version": "2.3.4",
"version": "2.4.0",
"zeroconf": [
{
"type": "_mopidy-http._tcp.local."
Expand Down
6 changes: 6 additions & 0 deletions mopidy-CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.4.0] - 2024-10-04

## Added

- `get_search_result` service to look for tracks and return the result

## [2.3.5] - 2024-05-29

### Fixed
Expand Down

0 comments on commit 9130b39

Please sign in to comment.