Compare commits

...

4 Commits

Author SHA1 Message Date
krateng b8944b4954 Reorganized containerfile to allow caching 2023-03-31 15:47:00 +02:00
krateng 9d9f3b500e More convenient album saving for 3.2 upgrade 2023-03-30 16:27:40 +02:00
krateng 72c58509a1 Added cool tag list script 2023-03-28 22:47:46 +02:00
krateng 11a5cb7401 Fixed scrobbler 2023-03-28 00:06:59 +02:00
6 changed files with 76 additions and 48 deletions

View File

@ -2,58 +2,73 @@ FROM lsiobase/alpine:3.17 as base
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY --chown=abc:abc . .
COPY --chown=abc:abc ./requirements.txt ./requirements.txt
# based on https://github.com/linuxserver/docker-pyload-ng/blob/main/Dockerfile # based on https://github.com/linuxserver/docker-pyload-ng/blob/main/Dockerfile
# Everything is run in one command so we can purge all build dependencies and cache in the same layer after maloja is installed # everything but the app installation is run in one command so we can purge
# # all build dependencies and cache in the same layer
# -- it may be possible to decrease image size slightly by using build stage and copying all site-packages to runtime stage # it may be possible to decrease image size slightly by using build stage and
# but the image is already pretty small (117mb uncompressed, ~40mb compressed) # copying all site-packages to runtime stage but the image is already pretty small
RUN \ RUN \
echo "**** install build packages ****" && \ echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-deps \ apk add --no-cache --virtual=build-deps \
gcc \ gcc \
g++ \ g++ \
python3-dev \ python3-dev \
libxml2-dev \ libxml2-dev \
libxslt-dev \ libxslt-dev \
libffi-dev \ libffi-dev \
libc-dev \ libc-dev \
py3-pip \ py3-pip \
linux-headers && \ linux-headers && \
echo "**** install runtime packages ****" && \ echo "**** install runtime packages ****" && \
apk add --no-cache \ apk add --no-cache \
python3 \ python3 \
py3-lxml \ py3-lxml \
tzdata && \ tzdata && \
echo "**** install pip dependencies ****" && \ echo "**** install pip dependencies ****" && \
python3 -m ensurepip && \ python3 -m ensurepip && \
pip3 install -U --no-cache-dir \ pip3 install -U --no-cache-dir \
pip \ pip \
wheel && \ wheel && \
echo "**** install maloja requirements ****" && \ echo "**** install maloja requirements ****" && \
pip3 install --no-cache-dir -r requirements.txt && \ pip3 install --no-cache-dir -r requirements.txt && \
echo "**** install maloja ****" && \ echo "**** cleanup ****" && \
pip3 install /usr/src/app && \ apk del --purge \
echo "**** cleanup ****" && \ build-deps && \
apk del --purge \ rm -rf \
build-deps && \ /tmp/* \
rm -rf \ ${HOME}/.cache
/tmp/* \
${HOME}/.cache # actual installation in extra layer so we can cache the stuff above
COPY --chown=abc:abc . .
RUN \
echo "**** install maloja ****" && \
apk add --no-cache --virtual=install-deps \
py3-pip && \
pip3 install /usr/src/app && \
apk del --purge \
install-deps && \
rm -rf \
/tmp/* \
${HOME}/.cache
COPY container/root/ / COPY container/root/ /
# Docker-specific configuration ENV \
# defaulting to IPv4 is no longer necessary (default host is dual stack) # Docker-specific configuration
ENV MALOJA_SKIP_SETUP=yes MALOJA_SKIP_SETUP=yes \
ENV PYTHONUNBUFFERED=1 PYTHONUNBUFFERED=1 \
# Prevents breaking change for previous container that ran maloja as root
# Prevents breaking change for previous container that ran maloja as root # On linux hosts (non-podman rootless) these variables should be set to the
# which meant MALOJA_DATA_DIRECTORY was created by and owned by root (UID 0) # host user that should own the host folder bound to MALOJA_DATA_DIRECTORY
# PUID=0 \
# On linux hosts (non-podman rootless) these variables should be set to the host user that should own the host folder bound to MALOJA_DATA_DIRECTORY PGID=0
ENV PUID=0
ENV PGID=0
EXPOSE 42010 EXPOSE 42010

View File

@ -83,6 +83,13 @@ function onTabUpdated(tabId, changeInfo, tab) {
//console.log("Still on same page!") //console.log("Still on same page!")
tabManagers[tabId].update(); tabManagers[tabId].update();
// check if the setting for this page is still active
chrome.storage.local.get(["service_active_" + page],function(result){
if (!result["service_active_" + page]) {
delete tabManagers[tabId];
}
});
return return
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "Maloja Scrobbler", "name": "Maloja Scrobbler",
"version": "1.12", "version": "1.13",
"description": "Scrobbles tracks from various sites to your Maloja server", "description": "Scrobbles tracks from various sites to your Maloja server",
"manifest_version": 2, "manifest_version": 2,
"permissions": [ "permissions": [

View File

@ -46,17 +46,22 @@ document.addEventListener("DOMContentLoaded",function() {
document.getElementById("serverurl").addEventListener("focusout",checkServer); document.getElementById("serverurl").addEventListener("focusout",checkServer);
document.getElementById("apikey").addEventListener("focusout",checkServer); document.getElementById("apikey").addEventListener("focusout",checkServer);
document.getElementById("serverurl").addEventListener("input",saveConfig); document.getElementById("serverurl").addEventListener("input",saveServer);
document.getElementById("apikey").addEventListener("input",saveConfig); document.getElementById("apikey").addEventListener("input",saveServer);
chrome.runtime.onMessage.addListener(onInternalMessage); chrome.runtime.onMessage.addListener(onInternalMessage);
chrome.storage.local.get(config_defaults,function(result){ chrome.storage.local.get(config_defaults,function(result){
console.log(result);
for (var key in result) { for (var key in result) {
// booleans
if (result[key] == true || result[key] == false) { if (result[key] == true || result[key] == false) {
document.getElementById(key).checked = result[key]; document.getElementById(key).checked = result[key];
} }
// text
else{ else{
document.getElementById(key).value = result[key]; document.getElementById(key).value = result[key];
} }
@ -95,8 +100,8 @@ function onInternalMessage(request,sender) {
function saveConfig() { function saveServer() {
for (var key in config_defaults) { for (var key of ["serverurl","apikey"]) {
var value = document.getElementById(key).value; var value = document.getElementById(key).value;
chrome.storage.local.set({ [key]: value }); chrome.storage.local.set({ [key]: value });
} }

1
dev/list_tags.sh Normal file
View File

@ -0,0 +1 @@
git tag -l '*.0' -n1 --sort=v:refname

View File

@ -148,7 +148,7 @@ def rawscrobble_to_scrobbledict(rawscrobble, fix=True, client=None):
"origin":f"client:{client}" if client else "generic", "origin":f"client:{client}" if client else "generic",
"extra":{ "extra":{
k:scrobbleinfo[k] for k in scrobbleinfo if k not in k:scrobbleinfo[k] for k in scrobbleinfo if k not in
['scrobble_time','track_artists','track_title','track_length','scrobble_duration','album_name','album_artists'] ['scrobble_time','track_artists','track_title','track_length','scrobble_duration']#,'album_name','album_artists']
}, },
"rawscrobble":rawscrobble "rawscrobble":rawscrobble
} }