Some fixes

This commit is contained in:
krateng 2023-10-20 00:11:06 +02:00
parent c9668c04d2
commit 9bc7d881d8
5 changed files with 18 additions and 10 deletions

@ -130,7 +130,7 @@ def run_supervisor():
def debug():
os.environ["MALOJA_DEV_MODE"] = 'true'
conf.malojaconfig.load_environment()
direct()
run_server()
def print_info():
print_header_info()
@ -172,7 +172,7 @@ def main(*args,**kwargs):
}
if "version" in kwargs:
print(info.VERSION)
print(pkginfo.VERSION)
return True
else:
try:

@ -2,10 +2,10 @@ import os
import math
import traceback
from bottle import response, static_file, request, FormsDict
from bottle import response, static_file, FormsDict
from doreah.logging import log
from doreah.auth import authenticated_api, authenticated_api_with_alternate, authenticated_function
from doreah.auth import authenticated_function
# nimrodel API
from nimrodel import EAPI as API

@ -399,7 +399,7 @@ def add_tracks_to_albums(track_to_album_id_dict,replace=False,dbconn=None):
@connection_provider
def remove_album(*track_ids,dbconn=None):
DB['tracks'].update().where(
DB['tracks'].c.track_id.in_(track_ids)
).values(
@ -439,10 +439,11 @@ def get_track_id(trackdict,create_new=True,update_album=False,dbconn=None):
if trackdict.get('album') and create_new:
# if we don't supply create_new, it means we just want to get info about a track
# which means no need to write album info, even if it was new
# if we havent set update_album, we only want to assign the album in case the track
# has no album yet. this means we also only want to create a potentially new album in that case
album_id = get_album_id(trackdict['album'],create_new=(update_album or not row.album_id),dbconn=dbconn)
add_track_to_album(row.id,album_id,replace=(update_album or not row.album_id),dbconn=dbconn)
add_track_to_album(row.id,album_id,replace=update_album,dbconn=dbconn)
return row.id

@ -1,7 +1,7 @@
from datetime import timezone, timedelta, date, time, datetime
from calendar import monthrange
from os.path import commonprefix
import math
from abc import ABC, abstractmethod
from .pkg_global.conf import malojaconfig
@ -28,7 +28,7 @@ def register_scrobbletime(timestamp):
# Generic Time Range
class MTRangeGeneric:
class MTRangeGeneric(ABC):
# despite the above, ranges that refer to the exact same real time range should evaluate as equal
def __eq__(self,other):
@ -68,6 +68,15 @@ class MTRangeGeneric:
def __contains__(self,timestamp):
return timestamp >= self.first_stamp() and timestamp <= self.last_stamp()
@abstractmethod
def first_stamp(self):
pass
@abstractmethod
def last_stamp(self):
pass
# Any range that has one defining base unit, whether week, year, etc.
class MTRangeSingular(MTRangeGeneric):
def fromstr(self):

@ -1,9 +1,7 @@
# technical
import sys
import os
from threading import Thread
from importlib import resources
import datauri
import time