1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Reorganized search provider link snippet

This commit is contained in:
Krateng 2020-09-25 05:38:01 +02:00
parent 13f2746171
commit 85f19a8b72
No known key found for this signature in database
GPG Key ID: 46735607861C6FCE
2 changed files with 20 additions and 25 deletions

View File

@ -60,30 +60,25 @@
{% macro link_search(entity) -%} {% macro link_search(entity) -%}
{% set track = entity.title %} {% set searchstr = (entity.artists + [entity.title]) | join(" ") | urlencode %}
{% set artists = entity.artists|join(' ') %}
{% if settings('TRACK_SEARCH_PROVIDER') == 'YouTube' %} {% set searchprovider = settings('TRACK_SEARCH_PROVIDER') | lower | replace(' ','') %}
{% set provider = 'https://www.youtube.com/results?search_query=' %} {% set searchproviders =
{% elif settings('TRACK_SEARCH_PROVIDER') == 'YouTube Music' %} {
{% set provider = 'https://music.youtube.com/search?q=' %} "youtube":'https://www.youtube.com/results?search_query=',
{% elif settings('TRACK_SEARCH_PROVIDER') == 'Spotify' %} "youtubemusic":'https://music.youtube.com/search?q=',
{% set provider = 'https://open.spotify.com/search/' %} "spotify":'https://open.spotify.com/search/',
{% elif settings('TRACK_SEARCH_PROVIDER') == 'Tidal' %} "tidal":'https://listen.tidal.com/search/tracks?q=',
{% set provider = 'https://listen.tidal.com/search/tracks?q=' %} "soundcloud":'https://soundcloud.com/search?q=',
{% elif settings('TRACK_SEARCH_PROVIDER') == 'SoundCloud' %} "amazonmusic":'https://music.amazon.com/search/',
{% set provider = 'https://soundcloud.com/search?q=' %} "deezer":'https://www.deezer.com/search/',
{% elif settings('TRACK_SEARCH_PROVIDER') == 'Amazon Music' %} "apple":'https://music.apple.com/us/search/song?term='
{% set provider = 'https://music.amazon.com/search/' %} }
{% elif settings('TRACK_SEARCH_PROVIDER') == 'Deezer' %} %}
{% set provider = 'https://www.deezer.com/search/' %}
{% elif settings('TRACK_SEARCH_PROVIDER') == 'Apple' %}
{% set provider = 'https://music.apple.com/us/search/song?term=' %}
{% else %}
{% set provider = 'https://duckduckgo.com/?q=' %}
{% endif %}
{% set icon = '<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="w-6 h-6" viewBox="0 0 20 20"><path d="M18 3a1 1 0 00-1.196-.98l-10 2A1 1 0 006 5v9.114A4.369 4.369 0 005 14c-1.657 0-3 .895-3 2s1.343 2 3 2 3-.895 3-2V7.82l8-1.6v5.894A4.37 4.37 0 0015 12c-1.657 0-3 .895-3 2s1.343 2 3 2 3-.895 3-2V3z"/></svg>' %} {% set link = searchproviders.get(searchprovider,'https://duckduckgo.com/?q=') + searchstr %}
<a href="{{ provider }}{{ artists }} {{ track }}">{{ icon }}</a> <a href="{{ link }}">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="w-6 h-6" viewBox="0 0 20 20"><path d="M18 3a1 1 0 00-1.196-.98l-10 2A1 1 0 006 5v9.114A4.369 4.369 0 005 14c-1.657 0-3 .895-3 2s1.343 2 3 2 3-.895 3-2V7.82l8-1.6v5.894A4.37 4.37 0 0015 12c-1.657 0-3 .895-3 2s1.343 2 3 2 3-.895 3-2V3z"/></svg>
</a>
{%- endmacro %} {%- endmacro %}

View File

@ -66,10 +66,10 @@
<h1><a href="/scrobbles">Last Scrobbles</a></h1> <h1><a href="/scrobbles">Last Scrobbles</a></h1>
{% for range in xcurrent -%} {% for range in xcurrent %}
<span class="stats">{{ range.localisation }}</span> <span class="stats">{{ range.localisation }}</span>
<a href='/scrobbles?in={{ range.identifier }}'>{{ db.get_scrobbles_num(timerange=range.range) }}</a> <a href='/scrobbles?in={{ range.identifier }}'>{{ db.get_scrobbles_num(timerange=range.range) }}</a>
{%- endfor %} {% endfor %}
<br/><br/> <br/><br/>
<span class="stat_module"> <span class="stat_module">