mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Moved image handling to top level module
This commit is contained in:
parent
be4ed055ff
commit
9f8e691924
@ -165,7 +165,6 @@ These solutions allow you to directly setup scrobbling to your Maloja server:
|
||||
* [Multi Scrobbler](https://github.com/FoxxMD/multi-scrobbler) Desktop Application
|
||||
* [Cmus-maloja-scrobbler](https://git.sr.ht/~xyank/cmus-maloja-scrobbler) Script
|
||||
* [OngakuKiroku](https://github.com/Atelier-Shiori/OngakuKiroku) Desktop Application (Mac)
|
||||
* [Albula](https://github.com/krateng/albula) Music Server
|
||||
* [Maloja Scrobbler](https://chrome.google.com/webstore/detail/maloja-scrobbler/cfnbifdmgbnaalphodcbandoopgbfeeh) Chromium Extension (also included in the repository) for Plex Web, Spotify, Bandcamp, Soundcloud or Youtube Music
|
||||
|
||||
### Native API
|
||||
|
@ -17,7 +17,7 @@ from ..globalconf import malojaconfig, data_dir
|
||||
|
||||
from ..__pkginfo__ import VERSION
|
||||
from ..malojauri import uri_to_internal, compose_querystring, internal_to_uri
|
||||
from .. import utilities
|
||||
from .. import images
|
||||
from ._apikeys import api_key_correct, checkAPIkey
|
||||
from . import apikeystore
|
||||
|
||||
@ -343,7 +343,7 @@ def add_picture(b64,artist:Multi=[],title=None):
|
||||
if title is not None: keys.append("title",title)
|
||||
k_filter, _, _, _, _ = uri_to_internal(keys)
|
||||
if "track" in k_filter: k_filter = k_filter["track"]
|
||||
utilities.set_image(b64,**k_filter)
|
||||
images.set_image(b64,**k_filter)
|
||||
|
||||
|
||||
@api.post("newrule")
|
||||
|
@ -1,5 +1,5 @@
|
||||
import re
|
||||
#from . import utilities
|
||||
#from . import images
|
||||
from doreah import tsv
|
||||
from .globalconf import data_dir, malojaconfig
|
||||
|
||||
|
@ -3,7 +3,7 @@ from bottle import request, response, FormsDict, HTTPError
|
||||
|
||||
# rest of the project
|
||||
from ..cleanup import CleanerAgent, CollectorAgent
|
||||
from .. import utilities
|
||||
from .. import images
|
||||
from ..malojatime import register_scrobbletime, time_stamps, ranges, alltime
|
||||
from ..malojauri import uri_to_internal, internal_to_uri, compose_querystring
|
||||
from ..thirdparty import proxy_scrobble_all
|
||||
|
@ -272,8 +272,11 @@ data_directories = {
|
||||
"clients":pthj(dir_settings['config']),
|
||||
"settings":pthj(dir_settings['config']),
|
||||
"css":pthj(dir_settings['config'],"custom_css"),
|
||||
"logs":pthj(dir_settings['logs']),
|
||||
"cache":pthj(dir_settings['cache']),
|
||||
|
||||
"config":dir_settings['config'],
|
||||
"state":dir_settings['state'],
|
||||
"logs":dir_settings['logs'],
|
||||
"cache":dir_settings['cache'],
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from ..globalconf import data_dir, malojaconfig
|
||||
from .. import thirdparty
|
||||
from .. import database
|
||||
from .globalconf import data_dir, malojaconfig
|
||||
from . import thirdparty
|
||||
from . import database
|
||||
|
||||
from doreah import caching
|
||||
from doreah.logging import log
|
@ -1,7 +1,7 @@
|
||||
from . import filters
|
||||
from ..globalconf import malojaconfig
|
||||
|
||||
from .. import database, malojatime, utilities, malojauri, thirdparty, __pkginfo__
|
||||
from .. import database, malojatime, images, malojauri, thirdparty, __pkginfo__
|
||||
from ..database import jinjaview
|
||||
from doreah.regular import repeatdaily
|
||||
|
||||
@ -28,7 +28,7 @@ def update_jinja_environment():
|
||||
"db": database, #TODO: move these to connection manager as well
|
||||
#"dbp":dbp,
|
||||
"malojatime": malojatime,
|
||||
"utilities": utilities,
|
||||
"images": images,
|
||||
"mlj_uri": malojauri,
|
||||
"settings": malojaconfig,
|
||||
"thirdparty": thirdparty,
|
||||
|
@ -7,7 +7,7 @@ from doreah.io import col, ask
|
||||
from ...globalconf import data_dir
|
||||
|
||||
from ...database.sqldb import add_scrobbles
|
||||
#from ...utilities import *
|
||||
#from ...images import *
|
||||
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ from doreah import auth
|
||||
# rest of the project
|
||||
from . import database
|
||||
from .database.jinjaview import JinjaDBConnection
|
||||
from .utilities import resolve_track_image, resolve_artist_image
|
||||
from .images import resolve_track_image, resolve_artist_image
|
||||
from .malojauri import uri_to_internal, remove_identical
|
||||
from .globalconf import malojaconfig, data_dir
|
||||
from .jinjaenv.context import jinja_environment
|
||||
|
@ -1 +0,0 @@
|
||||
from .images import *
|
@ -39,10 +39,10 @@
|
||||
{% if adminmode %}
|
||||
<div
|
||||
class="changeable-image" data-uploader="b64=>upload('{{ encodedartist }}',b64)"
|
||||
style="background-image:url('{{ utilities.get_artist_image(artist) }}');"
|
||||
style="background-image:url('{{ images.get_artist_image(artist) }}');"
|
||||
></div>
|
||||
{% else %}
|
||||
<div style="background-image:url('{{ utilities.get_artist_image(artist) }}');">
|
||||
<div style="background-image:url('{{ images.get_artist_image(artist) }}');">
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
@ -9,7 +9,7 @@
|
||||
{% set pages = math.ceil(charts.__len__() / amountkeys.perpage) %}
|
||||
{% if charts[0] is defined %}
|
||||
{% set topartist = charts[0].artist %}
|
||||
{% set img = utilities.get_artist_image(topartist) %}
|
||||
{% set img = images.get_artist_image(topartist) %}
|
||||
{% else %}
|
||||
{% set img = "/favicon.png" %}
|
||||
{% endif %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
{% set pages = math.ceil(charts.__len__() / amountkeys.perpage) %}
|
||||
{% if charts[0] is defined %}
|
||||
{% set toptrack = charts[0].track %}
|
||||
{% set img = utilities.get_track_image(toptrack) %}
|
||||
{% set img = images.get_track_image(toptrack) %}
|
||||
{% else %}
|
||||
{% set img = "/favicon.png" %}
|
||||
{% endif %}
|
||||
|
@ -23,7 +23,7 @@
|
||||
{% set rank = entry.rank %}
|
||||
<td>
|
||||
<a href="{{ links.url(artist) }}">
|
||||
<div style='background-image:url("{{ utilities.get_artist_image(artist) }}")'>
|
||||
<div style='background-image:url("{{ images.get_artist_image(artist) }}")'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ artist }}</span>
|
||||
</div>
|
||||
</a>
|
||||
|
@ -23,7 +23,7 @@
|
||||
{% set rank = entry.rank %}
|
||||
<td>
|
||||
<a href="{{ links.url(track) }}">
|
||||
<div style='background-image:url("{{ utilities.get_track_image(track) }}")'>
|
||||
<div style='background-image:url("{{ images.get_track_image(track) }}")'>
|
||||
<span class='stats'>#{{ rank }}</span> <span>{{ track.title }}</span>
|
||||
</div>
|
||||
</a>
|
||||
|
@ -4,9 +4,9 @@
|
||||
{% import 'snippets/filterdescription.jinja' as filterdesc %}
|
||||
|
||||
{% if filterkeys.get('track') is not none %}
|
||||
{% set img = utilities.get_track_image(filterkeys.track) %}
|
||||
{% set img = images.get_track_image(filterkeys.track) %}
|
||||
{% elif filterkeys.get('artist') is not none %}
|
||||
{% set img = utilities.get_artist_image(filterkeys.artist) %}
|
||||
{% set img = images.get_artist_image(filterkeys.artist) %}
|
||||
{% else %}
|
||||
{% set img = "/favicon.png" %}
|
||||
{% endif %}
|
||||
|
@ -4,9 +4,9 @@
|
||||
{% import 'snippets/filterdescription.jinja' as filterdesc %}
|
||||
|
||||
{% if filterkeys.get('track') is not none %}
|
||||
{% set img = utilities.get_track_image(filterkeys.track) %}
|
||||
{% set img = images.get_track_image(filterkeys.track) %}
|
||||
{% elif filterkeys.get('artist') is not none %}
|
||||
{% set img = utilities.get_artist_image(filterkeys.artist) %}
|
||||
{% set img = images.get_artist_image(filterkeys.artist) %}
|
||||
{% else %}
|
||||
{% set img = "/favicon.png" %}
|
||||
{% endif %}
|
||||
|
@ -8,11 +8,11 @@
|
||||
{% set pages = math.ceil(scrobbles.__len__() / amountkeys.perpage) %}
|
||||
|
||||
{% if filterkeys.get('track') is not none %}
|
||||
{% set img = utilities.get_track_image(filterkeys.track) %}
|
||||
{% set img = images.get_track_image(filterkeys.track) %}
|
||||
{% elif filterkeys.get('artist') is not none %}
|
||||
{% set img = utilities.get_artist_image(filterkeys.artist) %}
|
||||
{% set img = images.get_artist_image(filterkeys.artist) %}
|
||||
{% elif scrobbles.__len__() > 0 %}
|
||||
{% set img = utilities.get_track_image(scrobbles[0].track) %}
|
||||
{% set img = images.get_track_image(scrobbles[0].track) %}
|
||||
{% else %}
|
||||
{% set img = "/favicon.png" %}
|
||||
{% endif %}
|
||||
|
@ -3,9 +3,9 @@
|
||||
{% import 'snippets/links.jinja' as links %}
|
||||
|
||||
{% if 'artists' in entity %}
|
||||
{% set img = utilities.get_track_image(entity) %}
|
||||
{% set img = images.get_track_image(entity) %}
|
||||
{% else %}
|
||||
{% set img = utilities.get_artist_image(entity) %}
|
||||
{% set img = images.get_artist_image(entity) %}
|
||||
{% endif %}
|
||||
|
||||
<td class='icon'><div style="background-image:url('{{ img }}')"></div></td>
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% set entries = dbc.get_top_artists(limitkeys,delimitkeys) %}
|
||||
{% set repr = entries | find_representative('artist','scrobbles') %}
|
||||
{% set img = "/favicon.png" if repr is none else utilities.get_artist_image(repr.artist) %}
|
||||
{% set img = "/favicon.png" if repr is none else images.get_artist_image(repr.artist) %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{% set entries = dbc.get_top_tracks(filterkeys,limitkeys,delimitkeys) %}
|
||||
{% set repr = entries | find_representative('track','scrobbles') %}
|
||||
{% set img = "/favicon.png" if repr is none else utilities.get_track_image(repr.track) %}
|
||||
{% set img = "/favicon.png" if repr is none else images.get_track_image(repr.track) %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
@ -33,10 +33,10 @@
|
||||
{% if adminmode %}
|
||||
<div
|
||||
class="changeable-image" data-uploader="b64=>upload('{{ encodedtrack }}',b64)"
|
||||
style="background-image:url('{{ utilities.get_track_image(track) }}');"
|
||||
style="background-image:url('{{ images.get_track_image(track) }}');"
|
||||
></div>
|
||||
{% else %}
|
||||
<div style="background-image:url('{{ utilities.get_track_image(track) }}');">
|
||||
<div style="background-image:url('{{ images.get_track_image(track) }}');">
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user