mirror of
https://github.com/krateng/maloja.git
synced 2025-04-15 16:30:32 +03:00
Merge branch 'feature-albums' into next_minor_version
This commit is contained in:
commit
112b3db07c
@ -767,6 +767,40 @@ def merge_artists(target_id,source_ids):
|
||||
"status":"success"
|
||||
}
|
||||
|
||||
@api.post("associate_albums_to_artist")
|
||||
@authenticated_function(api=True)
|
||||
@catch_exceptions
|
||||
def associate_albums_to_artist(target_id,source_ids):
|
||||
result = database.associate_albums_to_artist(target_id,source_ids)
|
||||
if result:
|
||||
return {
|
||||
"status":"success",
|
||||
"desc":f"{result['target']} was added as album artist of {', '.join(src['albumtitle'] for src in result['sources'])}"
|
||||
}
|
||||
|
||||
@api.post("associate_tracks_to_artist")
|
||||
@authenticated_function(api=True)
|
||||
@catch_exceptions
|
||||
def associate_tracks_to_artist(target_id,source_ids):
|
||||
result = database.associate_tracks_to_artist(target_id,source_ids)
|
||||
if result:
|
||||
return {
|
||||
"status":"success",
|
||||
"desc":f"{result['target']} was added as artist for {', '.join(src['title'] for src in result['sources'])}"
|
||||
}
|
||||
|
||||
@api.post("associate_tracks_to_album")
|
||||
@authenticated_function(api=True)
|
||||
@catch_exceptions
|
||||
def associate_tracks_to_album(target_id,source_ids):
|
||||
result = database.associate_tracks_to_album(target_id,source_ids)
|
||||
if result:
|
||||
return {
|
||||
"status":"success",
|
||||
"desc":f"{', '.join(src['title'] for src in result['sources'])} were added to {result['target']['albumtitle']}"
|
||||
}
|
||||
|
||||
|
||||
@api.post("reparse_scrobble")
|
||||
@authenticated_function(api=True)
|
||||
@catch_exceptions
|
||||
|
@ -265,6 +265,43 @@ def merge_albums(target_id,source_ids):
|
||||
|
||||
|
||||
|
||||
@waitfordb
|
||||
def associate_albums_to_artist(target_id,source_ids):
|
||||
sources = [sqldb.get_album(id) for id in source_ids]
|
||||
target = sqldb.get_artist(target_id)
|
||||
log(f"Adding {sources} into {target}")
|
||||
sqldb.add_artists_to_albums(artist_ids=[target_id],album_ids=source_ids)
|
||||
result = {'sources':sources,'target':target}
|
||||
dbcache.invalidate_entity_cache()
|
||||
dbcache.invalidate_caches()
|
||||
|
||||
return result
|
||||
|
||||
@waitfordb
|
||||
def associate_tracks_to_artist(target_id,source_ids):
|
||||
sources = [sqldb.get_track(id) for id in source_ids]
|
||||
target = sqldb.get_artist(target_id)
|
||||
log(f"Adding {sources} into {target}")
|
||||
sqldb.add_artists_to_tracks(artist_ids=[target_id],track_ids=source_ids)
|
||||
result = {'sources':sources,'target':target}
|
||||
dbcache.invalidate_entity_cache()
|
||||
dbcache.invalidate_caches()
|
||||
|
||||
return result
|
||||
|
||||
@waitfordb
|
||||
def associate_tracks_to_album(target_id,source_ids):
|
||||
sources = [sqldb.get_track(id) for id in source_ids]
|
||||
target = sqldb.get_album(target_id)
|
||||
log(f"Adding {sources} into {target}")
|
||||
sqldb.add_tracks_to_albums({src:target_id for src in source_ids})
|
||||
result = {'sources':sources,'target':target}
|
||||
dbcache.invalidate_entity_cache()
|
||||
dbcache.invalidate_caches()
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@waitfordb
|
||||
def get_scrobbles(dbconn=None,**keys):
|
||||
@ -574,6 +611,18 @@ def album_info(dbconn=None,**keys):
|
||||
}
|
||||
|
||||
|
||||
|
||||
### TODO: FIND COOL ALGORITHM TO SELECT FEATURED STUFF
|
||||
@waitfordb
|
||||
def get_featured(dbconn=None):
|
||||
# temporary stand-in
|
||||
result = {
|
||||
"artist": get_charts_artists(timerange=alltime())[0]['artist'],
|
||||
"album": get_charts_albums(timerange=alltime())[0]['album'],
|
||||
"track": get_charts_tracks(timerange=alltime())[0]['track']
|
||||
}
|
||||
return result
|
||||
|
||||
def get_predefined_rulesets(dbconn=None):
|
||||
validchars = "-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
|
||||
|
@ -555,7 +555,7 @@ def edit_scrobble(scrobble_id,scrobbleupdatedict,dbconn=None):
|
||||
|
||||
dbconn.execute(op)
|
||||
|
||||
|
||||
# edit function only for primary db information (not linked fields)
|
||||
@connection_provider
|
||||
def edit_artist(id,artistupdatedict,dbconn=None):
|
||||
|
||||
@ -578,6 +578,7 @@ def edit_artist(id,artistupdatedict,dbconn=None):
|
||||
|
||||
return True
|
||||
|
||||
# edit function only for primary db information (not linked fields)
|
||||
@connection_provider
|
||||
def edit_track(id,trackupdatedict,dbconn=None):
|
||||
|
||||
@ -600,6 +601,7 @@ def edit_track(id,trackupdatedict,dbconn=None):
|
||||
|
||||
return True
|
||||
|
||||
# edit function only for primary db information (not linked fields)
|
||||
@connection_provider
|
||||
def edit_album(id,albumupdatedict,dbconn=None):
|
||||
|
||||
@ -623,6 +625,37 @@ def edit_album(id,albumupdatedict,dbconn=None):
|
||||
return True
|
||||
|
||||
|
||||
### Edit associations
|
||||
|
||||
@connection_provider
|
||||
def add_artists_to_tracks(track_ids,artist_ids,dbconn=None):
|
||||
|
||||
op = DB['trackartists'].insert().values([
|
||||
{'track_id':track_id,'artist_id':artist_id}
|
||||
for track_id in track_ids for artist_id in artist_ids
|
||||
])
|
||||
|
||||
result = dbconn.execute(op)
|
||||
clean_db(dbconn=dbconn)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@connection_provider
|
||||
def add_artists_to_albums(album_ids,artist_ids,dbconn=None):
|
||||
|
||||
op = DB['albumartists'].insert().values([
|
||||
{'album_id':album_id,'artist_id':artist_id}
|
||||
for album_id in album_ids for artist_id in artist_ids
|
||||
])
|
||||
|
||||
result = dbconn.execute(op)
|
||||
clean_db(dbconn=dbconn)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
||||
### Merge
|
||||
|
||||
@connection_provider
|
||||
|
@ -227,6 +227,13 @@ def resolve_image(artist_id=None,track_id=None,album_id=None):
|
||||
table = 'albums'
|
||||
getfunc, entity_id = database.sqldb.get_album, album_id
|
||||
|
||||
if (entitytype == 'track') and malojaconfig["USE_ALBUM_ARTWORK_FOR_TRACKS"]:
|
||||
track = database.sqldb.get_track(entity_id)
|
||||
if track.get("album"):
|
||||
entity_id = database.sqldb.get_album_id(track["album"])
|
||||
entitytype = 'album'
|
||||
getfunc = database.sqldb.get_album
|
||||
|
||||
# is another thread already working on this?
|
||||
with image_resolve_controller_lock:
|
||||
if entity_id in image_resolve_controller[table]:
|
||||
@ -234,6 +241,9 @@ def resolve_image(artist_id=None,track_id=None,album_id=None):
|
||||
else:
|
||||
image_resolve_controller[table].add(entity_id)
|
||||
|
||||
|
||||
|
||||
|
||||
try:
|
||||
entity = getfunc(entity_id)
|
||||
|
||||
|
@ -189,8 +189,7 @@ malojaconfig = Configuration(
|
||||
"parse_remix_artists":(tp.Boolean(), "Parse Remix Artists", False)
|
||||
},
|
||||
"Web Interface":{
|
||||
"default_range_charts_artists":(tp.Choice({'alltime':'All Time','year':'Year','month':"Month",'week':'Week'}), "Default Range Artist Charts", "year"),
|
||||
"default_range_charts_tracks":(tp.Choice({'alltime':'All Time','year':'Year','month':"Month",'week':'Week'}), "Default Range Track Charts", "year"),
|
||||
"default_range_startpage":(tp.Choice({'alltime':'All Time','year':'Year','month':"Month",'week':'Week'}), "Default Range for Startpage Stats", "year"),
|
||||
"default_step_pulse":(tp.Choice({'year':'Year','month':"Month",'week':'Week','day':'Day'}), "Default Pulse Step", "month"),
|
||||
"charts_display_tiles":(tp.Boolean(), "Display Chart Tiles", False),
|
||||
"album_showcase":(tp.Boolean(), "Display Album Showcase", True, "Display a graphical album showcase for artist overview pages instead of a chart list"),
|
||||
|
@ -23,6 +23,9 @@
|
||||
{% include 'icons/merge.jinja' %}
|
||||
{% include 'icons/merge_mark.jinja' %}
|
||||
{% include 'icons/merge_cancel.jinja' %}
|
||||
{% include 'icons/add_album.jinja' %}
|
||||
{% include 'icons/association_mark.jinja' %}
|
||||
{% include 'icons/association_cancel.jinja' %}
|
||||
<script>showValidMergeIcons();</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -33,6 +33,7 @@
|
||||
{% include 'icons/merge.jinja' %}
|
||||
{% include 'icons/merge_mark.jinja' %}
|
||||
{% include 'icons/merge_cancel.jinja' %}
|
||||
{% include 'icons/add_artist.jinja' %}
|
||||
<script>showValidMergeIcons();</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
6
maloja/web/jinja/icons/add_album.jinja
Normal file
6
maloja/web/jinja/icons/add_album.jinja
Normal file
@ -0,0 +1,6 @@
|
||||
<div title="Add to Album" id="associatealbumicon" class="clickable_icon" onclick="associate()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M2 4.75C2 3.784 2.784 3 3.75 3h4.971a1.75 1.75 0 0 1 1.447.765l1.404 2.063a.25.25 0 0 0 .207.11h8.471c.966 0 1.75.783 1.75 1.75V19.25A1.75 1.75 0 0 1 20.25 21H4.75a.75.75 0 0 1 0-1.5h15.5a.25.25 0 0 0 .25-.25V7.688a.25.25 0 0 0-.25-.25h-8.471a1.751 1.751 0 0 1-1.447-.766L8.928 4.609a.252.252 0 0 0-.207-.109H3.75a.25.25 0 0 0-.25.25v3.5a.75.75 0 0 1-1.5 0v-3.5Z"></path>
|
||||
<path d="m9.308 12.5-2.104-2.236a.75.75 0 1 1 1.092-1.028l3.294 3.5a.75.75 0 0 1 0 1.028l-3.294 3.5a.75.75 0 1 1-1.092-1.028L9.308 14H4.09a2.59 2.59 0 0 0-2.59 2.59v3.16a.75.75 0 0 1-1.5 0v-3.16a4.09 4.09 0 0 1 4.09-4.09h5.218Z"></path>
|
||||
</svg>
|
||||
</div>
|
5
maloja/web/jinja/icons/add_album_confirm.jinja
Normal file
5
maloja/web/jinja/icons/add_album_confirm.jinja
Normal file
@ -0,0 +1,5 @@
|
||||
<div title="Add Track to this Album" id="addalbumconfirmicon" class="clickable_icon" onclick="addAlbum()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M2 4.75C2 3.784 2.784 3 3.75 3h4.971c.58 0 1.12.286 1.447.765l1.404 2.063c.046.069.124.11.207.11h8.471c.966 0 1.75.783 1.75 1.75V19.25A1.75 1.75 0 0 1 20.25 21H3.75A1.75 1.75 0 0 1 2 19.25Z"></path>
|
||||
</svg>
|
||||
</div>
|
5
maloja/web/jinja/icons/add_artist.jinja
Normal file
5
maloja/web/jinja/icons/add_artist.jinja
Normal file
@ -0,0 +1,5 @@
|
||||
<div title="Add Artist" id="associateartisticon" class="clickable_icon" onclick="associate()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M4 9.5a5 5 0 1 1 7.916 4.062 7.973 7.973 0 0 1 5.018 7.166.75.75 0 1 1-1.499.044 6.469 6.469 0 0 0-12.932 0 .75.75 0 0 1-1.499-.044 7.972 7.972 0 0 1 5.059-7.181A4.994 4.994 0 0 1 4 9.5ZM9 6a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7Zm10.25-5a.75.75 0 0 1 .75.75V4h2.25a.75.75 0 0 1 0 1.5H20v2.25a.75.75 0 0 1-1.5 0V5.5h-2.25a.75.75 0 0 1 0-1.5h2.25V1.75a.75.75 0 0 1 .75-.75Z"></path>
|
||||
</svg>
|
||||
</div>
|
5
maloja/web/jinja/icons/add_artist_confirm.jinja
Normal file
5
maloja/web/jinja/icons/add_artist_confirm.jinja
Normal file
@ -0,0 +1,5 @@
|
||||
<div title="Add this Artist to Track" id="addartistconfirmicon" class="clickable_icon" onclick="addArtist()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M12 2.5a5.25 5.25 0 0 0-2.519 9.857 9.005 9.005 0 0 0-6.477 8.37.75.75 0 0 0 .727.773H20.27a.75.75 0 0 0 .727-.772 9.005 9.005 0 0 0-6.477-8.37A5.25 5.25 0 0 0 12 2.5Z"></path>
|
||||
</svg>
|
||||
</div>
|
7
maloja/web/jinja/icons/association_cancel.jinja
Normal file
7
maloja/web/jinja/icons/association_cancel.jinja
Normal file
@ -0,0 +1,7 @@
|
||||
<div title="Cancel Track Association" id="associationcancelicon" class="clickable_icon" onclick="cancelAssociate()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M2.345 20.595 8.47 14.47q.219-.22.53-.22.311 0 .53.22.22.219.22.53 0 .311-.22.53l-6.125 6.125q-.219.22-.53.22-.311 0-.53-.22-.22-.219-.22-.53 0-.311.22-.53Z"></path>
|
||||
<path d="m16.72 11.97.358-.358a6.738 6.738 0 0 1 2.326-1.518l1.896-.738a.25.25 0 0 0 .086-.409l-6.333-6.333a.25.25 0 0 0-.409.086l-.521 1.34a8.663 8.663 0 0 1-2.243 3.265.75.75 0 0 1-1.01-1.11 7.132 7.132 0 0 0 1.854-2.699l.521-1.34a1.75 1.75 0 0 1 2.869-.603l6.333 6.333a1.75 1.75 0 0 1-.603 2.869l-1.896.737a5.26 5.26 0 0 0-1.81 1.18l-.358.358a.749.749 0 1 1-1.06-1.06Zm-12.549-.738a1.75 1.75 0 0 1 .757-2.92l3.366-.962.412 1.443-3.366.961a.25.25 0 0 0-.108.417l8.597 8.597a.25.25 0 0 0 .417-.108l.961-3.366 1.443.412-.962 3.366a1.75 1.75 0 0 1-2.92.757Z"></path>
|
||||
<path d="m3.405 2.095 18.75 18.75q.22.219.22.53 0 .311-.22.53-.219.22-.53.22-.311 0-.53-.22L2.345 3.155q-.22-.219-.22-.53 0-.311.22-.53.219-.22.53-.22.311 0 .53.22Z"></path>
|
||||
</svg>
|
||||
</div>
|
5
maloja/web/jinja/icons/association_mark.jinja
Normal file
5
maloja/web/jinja/icons/association_mark.jinja
Normal file
@ -0,0 +1,5 @@
|
||||
<div title="Mark to associate artists or album" id="associationmarkicon" class="clickable_icon" onclick="markForAssociate()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="m16.114 1.553 6.333 6.333a1.75 1.75 0 0 1-.603 2.869l-1.63.633a5.67 5.67 0 0 0-3.395 3.725l-1.131 3.959a1.75 1.75 0 0 1-2.92.757L9 16.061l-5.595 5.594a.749.749 0 1 1-1.06-1.06L7.939 15l-3.768-3.768a1.75 1.75 0 0 1 .757-2.92l3.959-1.131a5.666 5.666 0 0 0 3.725-3.395l.633-1.63a1.75 1.75 0 0 1 2.869-.603ZM5.232 10.171l8.597 8.597a.25.25 0 0 0 .417-.108l1.131-3.959A7.17 7.17 0 0 1 19.67 9.99l1.63-.634a.25.25 0 0 0 .086-.409l-6.333-6.333a.25.25 0 0 0-.409.086l-.634 1.63a7.17 7.17 0 0 1-4.711 4.293L5.34 9.754a.25.25 0 0 0-.108.417Z"></path>
|
||||
</svg>
|
||||
</div>
|
@ -1,7 +1,7 @@
|
||||
<td style="opacity:0.5;text-align:center;">
|
||||
<div class="tile" style="opacity:0.5;text-align:center;">
|
||||
<svg height="96px" viewBox="0 0 24 24" width="96px">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M4.27 3L3 4.27l9 9v.28c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4v-1.73L19.73 21 21 19.73 4.27 3zM14 7h4V3h-6v5.18l2 2z"/>
|
||||
</svg>
|
||||
<br/>No scrobbles yet!
|
||||
</td>
|
||||
</div>
|
||||
|
@ -6,40 +6,26 @@
|
||||
{% endif %}
|
||||
|
||||
{% set charts_14 = charts | fixlength(14) %}
|
||||
{% set charts_cycler = cycler(*charts_14) %}
|
||||
|
||||
|
||||
|
||||
<table class="tiles_top"><tr>
|
||||
{% for segment in range(3) %}
|
||||
{% if charts_14[0] is none and loop.first %}
|
||||
{% include 'icons/nodata.jinja' %}
|
||||
{% else %}
|
||||
<td>
|
||||
{% set segmentsize = segment+1 %}
|
||||
<table class="tiles_{{ segmentsize }}x{{ segmentsize }} tiles_sub">
|
||||
{% for row in range(segmentsize) -%}
|
||||
<tr>
|
||||
{% for col in range(segmentsize) %}
|
||||
{% set entry = charts_cycler.next() %}
|
||||
{% if entry is not none %}
|
||||
{% set album = entry.album %}
|
||||
{% set rank = entry.rank %}
|
||||
<td>
|
||||
<a href="{{ links.url(album) }}">
|
||||
<div class="lazy" data-bg="{{ images.get_album_image(album) }}"'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ album.albumtitle }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
{% else -%}
|
||||
<td></td>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</tr>
|
||||
{%- endfor -%}
|
||||
</table>
|
||||
</td>
|
||||
<div class="tiles">
|
||||
{% if charts_14[0] is none %}
|
||||
{% include 'icons/nodata.jinja' %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr></table>
|
||||
{% for entry in charts_14 %}
|
||||
{% if entry is not none %}
|
||||
{% set album = entry.album %}
|
||||
{% set rank = entry.rank %}
|
||||
<div class="tile">
|
||||
<a href="{{ links.url(album) }}">
|
||||
<div class="lazy" data-bg="{{ images.get_album_image(album) }}"'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ album.albumtitle }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
@ -6,40 +6,26 @@
|
||||
{% endif %}
|
||||
|
||||
{% set charts_14 = charts | fixlength(14) %}
|
||||
{% set charts_cycler = cycler(*charts_14) %}
|
||||
|
||||
|
||||
|
||||
<table class="tiles_top"><tr>
|
||||
{% for segment in range(3) %}
|
||||
{% if charts_14[0] is none and loop.first %}
|
||||
{% include 'icons/nodata.jinja' %}
|
||||
{% else %}
|
||||
<td>
|
||||
{% set segmentsize = segment+1 %}
|
||||
<table class="tiles_{{ segmentsize }}x{{ segmentsize }} tiles_sub">
|
||||
{% for row in range(segmentsize) -%}
|
||||
<tr>
|
||||
{% for col in range(segmentsize) %}
|
||||
{% set entry = charts_cycler.next() %}
|
||||
{% if entry is not none %}
|
||||
{% set artist = entry.artist %}
|
||||
{% set rank = entry.rank %}
|
||||
<td>
|
||||
<a href="{{ links.url(artist) }}">
|
||||
<div class="lazy" data-bg="{{ images.get_artist_image(artist) }}"'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ artist }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
{% else -%}
|
||||
<td></td>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</tr>
|
||||
{%- endfor -%}
|
||||
</table>
|
||||
</td>
|
||||
<div class="tiles">
|
||||
{% if charts_14[0] is none %}
|
||||
{% include 'icons/nodata.jinja' %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr></table>
|
||||
{% for entry in charts_14 %}
|
||||
{% if entry is not none %}
|
||||
{% set artist = entry.artist %}
|
||||
{% set rank = entry.rank %}
|
||||
<div class="tile">
|
||||
<a href="{{ links.url(artist) }}">
|
||||
<div class="lazy" data-bg="{{ images.get_artist_image(artist) }}"'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ artist }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
@ -6,39 +6,26 @@
|
||||
{% endif %}
|
||||
|
||||
{% set charts_14 = charts | fixlength(14) %}
|
||||
{% set charts_cycler = cycler(*charts_14) %}
|
||||
|
||||
|
||||
<table class="tiles_top"><tr>
|
||||
{% for segment in range(3) %}
|
||||
{% if charts_14[0] is none and loop.first %}
|
||||
{% include 'icons/nodata.jinja' %}
|
||||
{% else %}
|
||||
<td>
|
||||
{% set segmentsize = segment+1 %}
|
||||
<table class="tiles_{{ segmentsize }}x{{ segmentsize }} tiles_sub">
|
||||
{% for row in range(segmentsize) -%}
|
||||
<tr>
|
||||
{% for col in range(segmentsize) %}
|
||||
{% set entry = charts_cycler.next() %}
|
||||
{% if entry is not none %}
|
||||
{% set track = entry.track %}
|
||||
{% set rank = entry.rank %}
|
||||
<td>
|
||||
<a href="{{ links.url(track) }}">
|
||||
<div class="lazy" data-bg="{{ images.get_track_image(track) }}")'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ track.title }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
{% else -%}
|
||||
<td></td>
|
||||
{%- endif %}
|
||||
{%- endfor -%}
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
</table>
|
||||
</td>
|
||||
<div class="tiles">
|
||||
{% if charts_14[0] is none %}
|
||||
{% include 'icons/nodata.jinja' %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr></table>
|
||||
{% for entry in charts_14 %}
|
||||
{% if entry is not none %}
|
||||
{% set track = entry.track %}
|
||||
{% set rank = entry.rank %}
|
||||
<div class="tile">
|
||||
<a href="{{ links.url(track) }}">
|
||||
<div class="lazy" data-bg="{{ images.get_track_image(track) }}"'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ track.title }}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
45
maloja/web/jinja/partials/info_album.jinja
Normal file
45
maloja/web/jinja/partials/info_album.jinja
Normal file
@ -0,0 +1,45 @@
|
||||
{% import 'snippets/links.jinja' as links %}
|
||||
{% import 'partials/awards_album.jinja' as awards %}
|
||||
|
||||
{% set album = filterkeys.album %}
|
||||
{% set info = dbc.album_info({'album':album}) %}
|
||||
|
||||
{% set encodedalbum = mlj_uri.uriencode({'album':album}) %}
|
||||
|
||||
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
{% if adminmode %}
|
||||
<div
|
||||
class="changeable-image" data-uploader="b64=>upload('{{ encodedalbum }}',b64)"
|
||||
style="background-image:url('{{ images.get_album_image(album) }}');"
|
||||
title="Drag & Drop to upload new image"
|
||||
></div>
|
||||
{% else %}
|
||||
<div style="background-image:url('{{ images.get_album_image(album) }}');">
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text">
|
||||
<span>{{ links.links(album.artists) }}</span><br/>
|
||||
<h1 id="main_entity_name" class="headerwithextra">{{ info.album.albumtitle | e }}</h1>
|
||||
{# awards.certs(album) #}
|
||||
<span class="rank"><a href="/charts_albums?max=100">#{{ info.position }}</a></span>
|
||||
<br/>
|
||||
|
||||
<p class="stats">
|
||||
<a href="{{ mlj_uri.create_uri("/scrobbles",filterkeys) }}">{{ info['scrobbles'] }} Scrobbles</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{{ awards.medals(info) }}
|
||||
{{ awards.topweeks(info) }}
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
59
maloja/web/jinja/partials/info_artist.jinja
Normal file
59
maloja/web/jinja/partials/info_artist.jinja
Normal file
@ -0,0 +1,59 @@
|
||||
{% import 'snippets/links.jinja' as links %}
|
||||
{% import 'partials/awards_artist.jinja' as awards %}
|
||||
|
||||
|
||||
{% set artist = filterkeys.artist %}
|
||||
{% set info = db.artist_info(artist=artist) %}
|
||||
|
||||
{% set credited = info.get('replace') %}
|
||||
{% set included = info.get('associated') %}
|
||||
|
||||
{% if credited is not none %}
|
||||
{% set competes = false %}
|
||||
{% else %}
|
||||
{% set credited = artist %}
|
||||
{% set competes = true %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
{% if adminmode %}
|
||||
<div
|
||||
class="changeable-image" data-uploader="b64=>upload('{{ encodedartist }}',b64)"
|
||||
style="background-image:url('{{ images.get_artist_image(artist) }}');"
|
||||
title="Drag & Drop to upload new image"
|
||||
></div>
|
||||
{% else %}
|
||||
<div style="background-image:url('{{ images.get_artist_image(artist) }}');">
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1 id="main_entity_name" class="headerwithextra">{{ info.artist | e }}</h1>
|
||||
{% if competes and info['scrobbles']>0 %}<span class="rank"><a href="/charts_artists?max=100">#{{ info.position }}</a></span>{% endif %}
|
||||
<br/>
|
||||
{% if competes and included %}
|
||||
<span>associated: {{ links.links(included) }}</span>
|
||||
{% elif not competes %}
|
||||
<span>Competing under {{ links.link(credited) }} (#{{ info.position }})</span>
|
||||
{% endif %}
|
||||
|
||||
<p class="stats">
|
||||
<a href="{{ mlj_uri.create_uri("/scrobbles",filterkeys) }}">{{ info['scrobbles'] }} Scrobbles</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
{% if competes %}
|
||||
{{ awards.medals(info) }}
|
||||
{{ awards.topweeks(info) }}
|
||||
{% endif %}
|
||||
{{ awards.certs(artist) }}
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
48
maloja/web/jinja/partials/info_track.jinja
Normal file
48
maloja/web/jinja/partials/info_track.jinja
Normal file
@ -0,0 +1,48 @@
|
||||
{% import 'snippets/links.jinja' as links %}
|
||||
|
||||
{% set track = filterkeys.track %}
|
||||
{% set info = dbc.track_info({'track':track}) %}
|
||||
|
||||
{% import 'partials/awards_track.jinja' as awards %}
|
||||
|
||||
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
{% if adminmode %}
|
||||
<div
|
||||
class="changeable-image" data-uploader="b64=>upload('{{ encodedtrack }}',b64)"
|
||||
style="background-image:url('{{ images.get_track_image(track) }}');"
|
||||
title="Drag & Drop to upload new image"
|
||||
></div>
|
||||
{% else %}
|
||||
<div style="background-image:url('{{ images.get_track_image(track) }}');">
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text">
|
||||
<span>{{ links.links(track.artists) }}</span><br/>
|
||||
<h1 id="main_entity_name" class="headerwithextra">{{ info.track.title | e }}</h1>
|
||||
{{ awards.certs(track) }}
|
||||
<span class="rank"><a href="/charts_tracks?max=100">#{{ info.position }}</a></span>
|
||||
<br/>
|
||||
{% if info.track.album %}
|
||||
from {{ links.link(info.track.album) }}<br/>
|
||||
{% endif %}
|
||||
|
||||
<p class="stats">
|
||||
{% if adminmode %}<button type="button" onclick="scrobble('{{ encodedtrack }}')">Scrobble now</button>{% endif %}
|
||||
<a href="{{ mlj_uri.create_uri("/scrobbles",filterkeys) }}">{{ info['scrobbles'] }} Scrobbles</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{{ awards.medals(info) }}
|
||||
{{ awards.topweeks(info) }}
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
@ -1,5 +1,5 @@
|
||||
{% macro link(entity) -%}
|
||||
{% if entity is mapping and 'title' in entity or 'albumtitle' in entity %}
|
||||
{% if entity is mapping and ('title' in entity or 'albumtitle' in entity) %}
|
||||
{% set name = entity.title or entity.albumtitle %}
|
||||
{% else %}
|
||||
{% set name = entity %}
|
||||
|
@ -3,109 +3,44 @@
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
<script>document.addEventListener('DOMContentLoaded',function() {
|
||||
showRange('topartists','{{ settings["DEFAULT_RANGE_CHARTS_ARTISTS"] }}');
|
||||
showRange('toptracks','{{ settings["DEFAULT_RANGE_CHARTS_TRACKS"] }}');
|
||||
showRange('pulse','{{ settings["DEFAULT_STEP_PULSE"] }}');
|
||||
})</script>
|
||||
<script src="/rangeselect.js"></script>
|
||||
<script src="/rangeselect.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded',function() {
|
||||
for (let type of ["topartists","toptracks","topalbums","pulse"]) {
|
||||
var val = localStorage.getItem("rangeselect_" + type);
|
||||
if (val != null) {
|
||||
showRange(type,val);
|
||||
}
|
||||
else {
|
||||
showRange(type,'{{ settings["DEFAULT_RANGE_STARTPAGE"] }}');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="/cookies.js"></script>
|
||||
<link rel="stylesheet" href="/static/css/startpage.css" />
|
||||
{% endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
|
||||
<!-- ARTIST CHARTS -->
|
||||
<h1><a class="stat_link_topartists" href="/charts_artists?in=alltime">Top Artists</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('topartists','{{ r.identifier }}')" class="stat_selector_topartists selector_topartists_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/>
|
||||
<div id="startpage">
|
||||
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span class="stat_module_topartists topartists_{{ r.identifier }}" style="display:none;">
|
||||
{%- with limitkeys = {"timerange":r.range} -%}
|
||||
{% include 'partials/charts_artists_tiles.jinja' %}
|
||||
{%- endwith -%}
|
||||
</span>
|
||||
{%- endfor %}
|
||||
{% for module in ['charts_artists','charts_tracks','charts_albums','pulse','lastscrobbles','featured'] %}
|
||||
<section id="start_page_module_{{ module }}" style="grid-area: {{ module }}">
|
||||
<!-- MODULE: {{ module }} -->
|
||||
|
||||
{% include 'startpage_modules/' + module + '.jinja' %}
|
||||
|
||||
|
||||
<!-- END MODULE: {{ module }} -->
|
||||
</section>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
||||
<!-- TRACK CHARTS -->
|
||||
<h1><a class="stat_link_toptracks" href="/charts_tracks?in=alltime">Top Tracks</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('toptracks','{{ r.identifier }}')" class="stat_selector_toptracks selector_toptracks_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span class="stat_module_toptracks toptracks_{{ r.identifier }}" style="display:none;">
|
||||
{%- with limitkeys = {"timerange":r.range} -%}
|
||||
{% include 'partials/charts_tracks_tiles.jinja' %}
|
||||
{%- endwith -%}
|
||||
</span>
|
||||
{%- endfor %}
|
||||
|
||||
|
||||
<div class="sidelist">
|
||||
<!-- SCROBBLES -->
|
||||
|
||||
<h1><a href="/scrobbles">Last Scrobbles</a></h1>
|
||||
|
||||
{% for range in xcurrent %}
|
||||
<span class="stats">{{ range.localisation }}</span>
|
||||
<a href='/scrobbles?in={{ range.identifier }}'>{{ dbc.get_scrobbles_num({'timerange':range.range}) }}</a>
|
||||
{% endfor %}
|
||||
<br/><br/>
|
||||
|
||||
<span class="stat_module">
|
||||
|
||||
|
||||
{%- with amountkeys = {"perpage":12,"page":0}, shortTimeDesc=True -%}
|
||||
{% include 'partials/scrobbles.jinja' %}
|
||||
{%- endwith -%}
|
||||
</span>
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- PULSE -->
|
||||
<h1><a class="stat_link_pulse" href="/pulse?trail=1&step=month">Pulse</a></h1>
|
||||
|
||||
{% for range in xranges -%}
|
||||
<span onclick="showRangeManual('pulse','{{ range.identifier }}')" class="stat_selector_pulse selector_pulse_{{ range.identifier }}">
|
||||
{{ range.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
<br/><br/>
|
||||
|
||||
{% for range in xranges -%}
|
||||
<span class="stat_module_pulse pulse_{{ range.identifier }}" style="display:none;">
|
||||
{%- with limitkeys={"since":range.firstrange},delimitkeys={"step":range.identifier} -%}
|
||||
{% include 'partials/pulse.jinja' %}
|
||||
{%- endwith -%}
|
||||
</span>
|
||||
{%- endfor %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{%- endblock %}
|
||||
|
19
maloja/web/jinja/startpage_modules/charts_albums.jinja
Normal file
19
maloja/web/jinja/startpage_modules/charts_albums.jinja
Normal file
@ -0,0 +1,19 @@
|
||||
<h1><a class="stat_link_topalbums" href="/charts_albums?in=alltime">Top Albums</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('topalbums','{{ r.identifier }}')" class="stat_selector_topalbums selector_topalbums_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<section class="stat_module_topalbums topalbums_{{ r.identifier }}" style="display:none;">
|
||||
{%- with limitkeys = {"timerange":r.range} -%}
|
||||
{% include 'partials/charts_albums_tiles.jinja' %}
|
||||
{%- endwith -%}
|
||||
</section>
|
||||
{%- endfor %}
|
19
maloja/web/jinja/startpage_modules/charts_artists.jinja
Normal file
19
maloja/web/jinja/startpage_modules/charts_artists.jinja
Normal file
@ -0,0 +1,19 @@
|
||||
<h1><a class="stat_link_topartists" href="/charts_artists?in=alltime">Top Artists</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('topartists','{{ r.identifier }}')" class="stat_selector_topartists selector_topartists_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<section class="stat_module_topartists topartists_{{ r.identifier }}" style="display:none;">
|
||||
{%- with limitkeys = {"timerange":r.range} -%}
|
||||
{% include 'partials/charts_artists_tiles.jinja' %}
|
||||
{%- endwith -%}
|
||||
</section>
|
||||
{%- endfor %}
|
19
maloja/web/jinja/startpage_modules/charts_tracks.jinja
Normal file
19
maloja/web/jinja/startpage_modules/charts_tracks.jinja
Normal file
@ -0,0 +1,19 @@
|
||||
<h1><a class="stat_link_toptracks" href="/charts_tracks?in=alltime">Top Tracks</a></h1>
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<span onclick="showRangeManual('toptracks','{{ r.identifier }}')" class="stat_selector_toptracks selector_toptracks_{{ r.identifier }}">
|
||||
{{ r.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
||||
{% for r in xcurrent -%}
|
||||
<section class="stat_module_toptracks toptracks_{{ r.identifier }}" style="display:none;">
|
||||
{%- with limitkeys = {"timerange":r.range} -%}
|
||||
{% include 'partials/charts_tracks_tiles.jinja' %}
|
||||
{%- endwith -%}
|
||||
</section>
|
||||
{%- endfor %}
|
62
maloja/web/jinja/startpage_modules/featured.jinja
Normal file
62
maloja/web/jinja/startpage_modules/featured.jinja
Normal file
@ -0,0 +1,62 @@
|
||||
<!-- TODO: THIS IS PRELIMINARY. not sure if i want to keep this, but for now let's fill up that empty slot on the start page -->
|
||||
|
||||
<h1>Featured</h1>
|
||||
|
||||
{% set featured = dbc.get_featured() %}
|
||||
|
||||
{% set entitytypes = [
|
||||
{'identifier':'artist','localisation':"Artist", 'template':"info_artist.jinja", 'filterkeys':{"artist": featured.artist } },
|
||||
{'identifier':'track','localisation':"Track", 'template':"info_track.jinja", 'filterkeys':{"track": featured.track } },
|
||||
{'identifier':'album','localisation':"Album", 'template':"info_album.jinja", 'filterkeys':{"album": featured.album } }
|
||||
] %}
|
||||
|
||||
|
||||
{% for t in entitytypes -%}
|
||||
<span onclick="showFeatured('{{ t.identifier }}')" class="stat_selector_featured stat_selector_featured_{{ t.identifier }}">
|
||||
{{ t.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
|
||||
<br/><br/><br/>
|
||||
|
||||
|
||||
{% for t in entitytypes -%}
|
||||
<section class="stat_module_featured featured_{{ t.identifier }}" style="display:none;">
|
||||
{%- with filterkeys = t.filterkeys -%}
|
||||
|
||||
{% include 'partials/' + t.template %}
|
||||
{%- endwith -%}
|
||||
</section>
|
||||
{%- endfor %}
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function showFeatured(t) {
|
||||
// Make all modules disappear
|
||||
var modules = document.getElementsByClassName("stat_module_featured");
|
||||
for (var i=0;i<modules.length;i++) {
|
||||
modules[i].setAttribute("style","display:none;");
|
||||
}
|
||||
|
||||
// Make requested module appear
|
||||
var reactivate = document.getElementsByClassName("featured_" + t);
|
||||
for (var i=0;i<reactivate.length;i++) {
|
||||
reactivate[i].setAttribute("style","");
|
||||
}
|
||||
|
||||
// Set all selectors to unselected
|
||||
var selectors = document.getElementsByClassName("stat_selector_featured");
|
||||
for (var i=0;i<selectors.length;i++) {
|
||||
selectors[i].setAttribute("style","");
|
||||
}
|
||||
|
||||
// Set the active selector to selected
|
||||
var reactivate = document.getElementsByClassName("stat_selector_featured_" + t);
|
||||
for (var i=0;i<reactivate.length;i++) {
|
||||
reactivate[i].setAttribute("style","opacity:0.5;");
|
||||
}
|
||||
}
|
||||
</script>
|
15
maloja/web/jinja/startpage_modules/lastscrobbles.jinja
Normal file
15
maloja/web/jinja/startpage_modules/lastscrobbles.jinja
Normal file
@ -0,0 +1,15 @@
|
||||
<h1><a href="/scrobbles">Last Scrobbles</a></h1>
|
||||
|
||||
{% for range in xcurrent %}
|
||||
<span class="stats">{{ range.localisation }}</span>
|
||||
<a href='/scrobbles?in={{ range.identifier }}'>{{ dbc.get_scrobbles_num({'timerange':range.range}) }}</a>
|
||||
{% endfor %}
|
||||
<br/><br/>
|
||||
|
||||
<span class="stat_module">
|
||||
|
||||
|
||||
{%- with amountkeys = {"perpage":12,"page":0}, shortTimeDesc=True -%}
|
||||
{% include 'partials/scrobbles.jinja' %}
|
||||
{%- endwith -%}
|
||||
</span>
|
17
maloja/web/jinja/startpage_modules/pulse.jinja
Normal file
17
maloja/web/jinja/startpage_modules/pulse.jinja
Normal file
@ -0,0 +1,17 @@
|
||||
<h1><a class="stat_link_pulse" href="/pulse?trail=1&step=month">Pulse</a></h1>
|
||||
|
||||
{% for range in xranges -%}
|
||||
<span onclick="showRangeManual('pulse','{{ range.identifier }}')" class="stat_selector_pulse selector_pulse_{{ range.identifier }}">
|
||||
{{ range.localisation }}
|
||||
</span>
|
||||
{{ "|" if not loop.last }}
|
||||
{%- endfor %}
|
||||
<br/><br/>
|
||||
|
||||
{% for range in xranges -%}
|
||||
<span class="stat_module_pulse pulse_{{ range.identifier }}" style="display:none;">
|
||||
{%- with limitkeys={"since":range.firstrange},delimitkeys={"step":range.identifier} -%}
|
||||
{% include 'partials/pulse.jinja' %}
|
||||
{%- endwith -%}
|
||||
</span>
|
||||
{%- endfor %}
|
@ -28,6 +28,8 @@
|
||||
{% include 'icons/merge.jinja' %}
|
||||
{% include 'icons/merge_mark.jinja' %}
|
||||
{% include 'icons/merge_cancel.jinja' %}
|
||||
{% include 'icons/association_mark.jinja' %}
|
||||
{% include 'icons/association_cancel.jinja' %}
|
||||
<script>showValidMergeIcons();</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -209,7 +209,7 @@ div#notification_area {
|
||||
div#notification_area div.notification {
|
||||
background-color:white;
|
||||
width:400px;
|
||||
height:50px;
|
||||
min-height:50px;
|
||||
margin-bottom:7px;
|
||||
padding:9px;
|
||||
opacity:0.4;
|
||||
@ -800,53 +800,78 @@ table.misc td {
|
||||
|
||||
|
||||
|
||||
div.tiles {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(18, calc(100% / 18));
|
||||
grid-template-rows: repeat(6, calc(100% / 6));
|
||||
grid-auto-flow: row dense;
|
||||
|
||||
aspect-ratio: 3 / 1;
|
||||
|
||||
|
||||
|
||||
table.tiles_top td {
|
||||
padding:0px;
|
||||
border:0px;
|
||||
}
|
||||
|
||||
table.tiles_top:hover td td {
|
||||
div.tiles div {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-size: cover;
|
||||
background-position:top center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.tiles:hover div {
|
||||
opacity:0.5;
|
||||
filter: grayscale(80%);
|
||||
}
|
||||
table.tiles_top:hover td td:hover {
|
||||
div.tiles:hover div:hover {
|
||||
opacity:1;
|
||||
filter: grayscale(0%);
|
||||
}
|
||||
|
||||
table.tiles_top, table.tiles_sub {
|
||||
border-collapse: collapse;
|
||||
div.tiles div.tile:nth-child(1) {
|
||||
grid-column: span 6;
|
||||
grid-row: span 6;
|
||||
|
||||
font-size:100%
|
||||
}
|
||||
|
||||
div.tiles div.tile:nth-child(2),
|
||||
div.tiles div.tile:nth-child(3),
|
||||
div.tiles div.tile:nth-child(4),
|
||||
div.tiles div.tile:nth-child(5) {
|
||||
grid-column: span 3;
|
||||
grid-row: span 3;
|
||||
|
||||
font-size:80%
|
||||
}
|
||||
|
||||
div.tiles div.tile:nth-child(2),
|
||||
div.tiles div.tile:nth-child(4) {
|
||||
grid-column-start: 7;
|
||||
grid-column-end: span 3;
|
||||
}
|
||||
div.tiles div.tile:nth-child(3),
|
||||
div.tiles div.tile:nth-child(5) {
|
||||
grid-column-start: 10;
|
||||
grid-column-end: span 3;
|
||||
}
|
||||
|
||||
div.tiles div.tile:nth-child(6),
|
||||
div.tiles div.tile:nth-child(7),
|
||||
div.tiles div.tile:nth-child(8),
|
||||
div.tiles div.tile:nth-child(9),
|
||||
div.tiles div.tile:nth-child(10),
|
||||
div.tiles div.tile:nth-child(11),
|
||||
div.tiles div.tile:nth-child(12),
|
||||
div.tiles div.tile:nth-child(13),
|
||||
div.tiles div.tile:nth-child(14) {
|
||||
grid-column: span 2;
|
||||
grid-row: span 2;
|
||||
|
||||
font-size:60%
|
||||
}
|
||||
|
||||
|
||||
|
||||
table.tiles_top>tbody>tr>td {
|
||||
height:300px;
|
||||
width:300px;
|
||||
}
|
||||
|
||||
|
||||
table.tiles_sub {
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
table.tiles_sub div {
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
table.tiles_top td div {
|
||||
background-size:cover;
|
||||
background-position:top center;
|
||||
vertical-align:bottom;
|
||||
}
|
||||
|
||||
table.tiles_top td span {
|
||||
div.tiles span {
|
||||
background-color:rgba(0,0,0,0.7);
|
||||
display: inline-block;
|
||||
margin-top:2%;
|
||||
@ -854,48 +879,21 @@ table.tiles_top td span {
|
||||
max-width: 67%;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
table.tiles_top td a:hover {
|
||||
div.tiles span {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
div.tiles a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tiles_1x1 td {
|
||||
height:100%;
|
||||
width:100%;
|
||||
font-size:100%
|
||||
}
|
||||
table.tiles_2x2 td {
|
||||
height:50%;
|
||||
width:50%;
|
||||
font-size:80%
|
||||
}
|
||||
table.tiles_3x3 td {
|
||||
height:33.333%;
|
||||
width:33.333%;
|
||||
font-size:60%
|
||||
}
|
||||
table.tiles_4x4 td {
|
||||
font-size:50%
|
||||
}
|
||||
table.tiles_5x5 td {
|
||||
font-size:40%
|
||||
}
|
||||
|
||||
/* Safari fix */
|
||||
table.tiles_sub.tiles_3x3 td div {
|
||||
min-height: 100px;
|
||||
min-width: 100px;
|
||||
}
|
||||
table.tiles_sub.tiles_2x2 td div {
|
||||
min-height: 150px;
|
||||
min-width: 150px;
|
||||
}
|
||||
table.tiles_sub.tiles_1x1 td div {
|
||||
min-height: 300px;
|
||||
min-width: 300px;
|
||||
}
|
||||
table.tiles_sub a span {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
div#showcase_container {
|
||||
@ -986,35 +984,3 @@ span.stat_module_pulse, span.stat_module_topartists, span.stat_module_toptracks
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
**
|
||||
** SIDE LIST ON START PAGE
|
||||
**
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
@media (min-width: 1600px) {
|
||||
div.sidelist {
|
||||
position:absolute;
|
||||
right:0px;
|
||||
top:0px;
|
||||
width:40%;
|
||||
height:100%;
|
||||
--current-bg-color: var(--base-color-light); /* drag this information through inheritances */
|
||||
background-color: var(--current-bg-color);
|
||||
padding-left:30px;
|
||||
padding-right:30px;
|
||||
}
|
||||
}
|
||||
|
||||
div.sidelist table {
|
||||
width:100%;
|
||||
table-layout:fixed;
|
||||
}
|
||||
|
||||
div.sidelist table.list td.time {
|
||||
width:17%;
|
||||
}
|
||||
|
49
maloja/web/static/css/startpage.css
Normal file
49
maloja/web/static/css/startpage.css
Normal file
@ -0,0 +1,49 @@
|
||||
div#startpage {
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
|
||||
display: fixed;
|
||||
grid-column-gap: 25px;
|
||||
grid-row-gap: 25px;
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 2201px) {
|
||||
div#startpage {
|
||||
grid-template-columns: 30vw 30vw 30vw;
|
||||
grid-template-rows: 45vh 45vh;
|
||||
|
||||
grid-template-areas:
|
||||
"charts_artists charts_tracks charts_albums"
|
||||
"lastscrobbles featured pulse";
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1401px) and (max-width: 2200px) {
|
||||
div#startpage {
|
||||
grid-template-columns: 45vw 45vw;
|
||||
grid-template-rows: 45vh 45vh 45vh;
|
||||
|
||||
grid-template-areas:
|
||||
"charts_artists lastscrobbles"
|
||||
"charts_tracks pulse"
|
||||
"charts_albums featured";
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1400px) {
|
||||
div#startpage {
|
||||
grid-template-columns: 90vw;
|
||||
|
||||
grid-template-areas:
|
||||
"charts_artists"
|
||||
"charts_tracks"
|
||||
"charts_albums"
|
||||
"lastscrobbles"
|
||||
"pulse";
|
||||
}
|
||||
|
||||
#start_page_module_featured {
|
||||
display: none;
|
||||
}
|
||||
}
|
@ -190,6 +190,8 @@ function doneEditing() {
|
||||
// MERGING
|
||||
|
||||
function showValidMergeIcons() {
|
||||
|
||||
// merge
|
||||
const lcst = window.sessionStorage;
|
||||
var key = "marked_for_merge_" + entity_type;
|
||||
var current_stored = (lcst.getItem(key) || '').split(",");
|
||||
@ -218,6 +220,81 @@ function showValidMergeIcons() {
|
||||
}
|
||||
}
|
||||
|
||||
// mark for association
|
||||
if ((entity_type == 'track') || (entity_type == 'album')) {
|
||||
const lcst = window.sessionStorage;
|
||||
var key = "marked_for_associate_" + entity_type;
|
||||
var current_stored = (lcst.getItem(key) || '').split(",");
|
||||
current_stored = current_stored.filter((x)=>x).map((x)=>parseInt(x));
|
||||
|
||||
var associationmarkicon = document.getElementById('associationmarkicon');
|
||||
var associationcancelicon = document.getElementById('associationcancelicon');
|
||||
|
||||
associationmarkicon.classList.add('hide');
|
||||
associationcancelicon.classList.add('hide');
|
||||
|
||||
|
||||
if (current_stored.length == 0) {
|
||||
associationmarkicon.classList.remove('hide');
|
||||
}
|
||||
else {
|
||||
associationcancelicon.classList.remove('hide');
|
||||
|
||||
if (current_stored.includes(entity_id)) {
|
||||
|
||||
}
|
||||
else {
|
||||
associationmarkicon.classList.remove('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (entity_type == 'track') {
|
||||
associationmarkicon.title = "Mark this track to add to album or add artist";
|
||||
}
|
||||
else {
|
||||
associationmarkicon.title = "Mark this album to add artist";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// association confirm
|
||||
if ((entity_type == 'artist') || (entity_type == 'album')) {
|
||||
var target_entity_types = {artist:['album','track'], album:['track']};
|
||||
var to_associate = {};
|
||||
var to_associate_all = [];
|
||||
for (var target_entity_type of target_entity_types[entity_type]) {
|
||||
const lcst = window.sessionStorage;
|
||||
var key = "marked_for_associate_" + target_entity_type;
|
||||
var current_stored = (lcst.getItem(key) || '').split(",");
|
||||
to_associate[target_entity_type] = current_stored.filter((x)=>x).map((x)=>parseInt(x));
|
||||
to_associate_all = to_associate_all.concat(to_associate[target_entity_type]);
|
||||
}
|
||||
|
||||
var associateicon = document.getElementById('associate' + entity_type + 'icon');
|
||||
|
||||
associateicon.classList.add('hide');
|
||||
|
||||
|
||||
if (to_associate_all.length == 0) {
|
||||
|
||||
}
|
||||
else {
|
||||
associateicon.classList.remove('hide');
|
||||
if (entity_type == 'artist') {
|
||||
associateicon.title = "Add this artist to " + to_associate['album'].length + " albums and " + to_associate['track'].length + " tracks";
|
||||
}
|
||||
else {
|
||||
associateicon.title = "Add " + to_associate['track'].length + " tracks to this album";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -233,6 +310,19 @@ function markForMerge() {
|
||||
showValidMergeIcons();
|
||||
}
|
||||
|
||||
function markForAssociate() {
|
||||
const lcst = window.sessionStorage;
|
||||
var key = "marked_for_associate_" + entity_type;
|
||||
var current_stored = (lcst.getItem(key) || '').split(",");
|
||||
current_stored = current_stored.filter((x)=>x).map((x)=>parseInt(x));
|
||||
current_stored.push(entity_id);
|
||||
current_stored = [...new Set(current_stored)];
|
||||
lcst.setItem(key,current_stored); //this already formats it correctly
|
||||
var whattoadd = ((entity_type == 'track') ? "Artists or Album" : "Artists")
|
||||
notify("Marked " + entity_name + " to add " + whattoadd,"Currently " + current_stored.length + " marked!")
|
||||
showValidMergeIcons();
|
||||
}
|
||||
|
||||
function merge() {
|
||||
const lcst = window.sessionStorage;
|
||||
var key = "marked_for_merge_" + entity_type;
|
||||
@ -262,6 +352,47 @@ function merge() {
|
||||
lcst.removeItem(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function associate() {
|
||||
const lcst = window.sessionStorage;
|
||||
var target_entity_types = {artist:['album','track'], album:['track']};
|
||||
for (var target_entity_type of target_entity_types[entity_type]) {
|
||||
var key = "marked_for_associate_" + target_entity_type;
|
||||
console.log('get',key);
|
||||
var current_stored = (lcst.getItem(key) || '').split(",");
|
||||
current_stored = current_stored.filter((x)=>x).map((x)=>parseInt(x));
|
||||
|
||||
if (current_stored.length != 0) {
|
||||
callback_func = function(req){
|
||||
if (req.status == 200) {
|
||||
//window.location.reload();
|
||||
showValidMergeIcons();
|
||||
notifyCallback(req);
|
||||
}
|
||||
else {
|
||||
notifyCallback(req);
|
||||
}
|
||||
};
|
||||
|
||||
neo.xhttpreq(
|
||||
"/apis/mlj_1/associate_" + target_entity_type + "s_to_" + entity_type,
|
||||
data={
|
||||
'source_ids':current_stored,
|
||||
'target_id':entity_id
|
||||
},
|
||||
method="POST",
|
||||
callback=callback_func,
|
||||
json=true
|
||||
);
|
||||
|
||||
lcst.removeItem(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cancelMerge() {
|
||||
const lcst = window.sessionStorage;
|
||||
var key = "marked_for_merge_" + entity_type;
|
||||
@ -269,3 +400,10 @@ function cancelMerge() {
|
||||
showValidMergeIcons();
|
||||
notify("Cancelled merge!","")
|
||||
}
|
||||
function cancelAssociate() {
|
||||
const lcst = window.sessionStorage;
|
||||
var key = "marked_for_associate_" + entity_type;
|
||||
lcst.setItem(key,[]);
|
||||
showValidMergeIcons();
|
||||
notify("Cancelled association!","")
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ localStorage = window.localStorage;
|
||||
|
||||
function showRange(identifier,unit) {
|
||||
// Make all modules disappear
|
||||
modules = document.getElementsByClassName("stat_module_" + identifier);
|
||||
var modules = document.getElementsByClassName("stat_module_" + identifier);
|
||||
for (var i=0;i<modules.length;i++) {
|
||||
//modules[i].setAttribute("style","width:0px;overflow:hidden;")
|
||||
// cheesy trick to make the allocated space always whatever the biggest module needs
|
||||
@ -11,19 +11,19 @@ function showRange(identifier,unit) {
|
||||
}
|
||||
|
||||
// Make requested module appear
|
||||
reactivate = document.getElementsByClassName(identifier + "_" + unit);
|
||||
var reactivate = document.getElementsByClassName(identifier + "_" + unit);
|
||||
for (var i=0;i<reactivate.length;i++) {
|
||||
reactivate[i].setAttribute("style","");
|
||||
}
|
||||
|
||||
// Set all selectors to unselected
|
||||
selectors = document.getElementsByClassName("stat_selector_" + identifier);
|
||||
var selectors = document.getElementsByClassName("stat_selector_" + identifier);
|
||||
for (var i=0;i<selectors.length;i++) {
|
||||
selectors[i].setAttribute("style","");
|
||||
}
|
||||
|
||||
// Set the active selector to selected
|
||||
reactivate = document.getElementsByClassName("selector_" + identifier + "_" + unit);
|
||||
var reactivate = document.getElementsByClassName("selector_" + identifier + "_" + unit);
|
||||
for (var i=0;i<reactivate.length;i++) {
|
||||
reactivate[i].setAttribute("style","opacity:0.5;");
|
||||
}
|
||||
@ -43,16 +43,3 @@ function showRangeManual(identifier,unit) {
|
||||
//neo.setCookie("rangeselect_" + identifier,unit);
|
||||
localStorage.setItem("rangeselect_" + identifier,unit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded',function() {
|
||||
for (let type of ["topartists","toptracks","pulse"]) {
|
||||
var val = localStorage.getItem("rangeselect_" + type);
|
||||
if (val != null) {
|
||||
showRange(type,val);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user