mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Moved to new default data folder
This commit is contained in:
parent
8250c7b467
commit
98830b0803
@ -195,9 +195,21 @@ def compare_external(**keys):
|
|||||||
|
|
||||||
|
|
||||||
@api.get("newscrobble")
|
@api.get("newscrobble")
|
||||||
|
def get_post_scrobble(*args,**kwargs):
|
||||||
|
"""DEPRECATED. Use the equivalent POST method instead."""
|
||||||
|
return post_scrobble(*args,**kwargs)
|
||||||
|
|
||||||
@api.post("newscrobble")
|
@api.post("newscrobble")
|
||||||
@authenticated_api_with_alternate(api_key_correct)
|
@authenticated_api_with_alternate(api_key_correct)
|
||||||
def post_scrobble(artist:Multi,**keys):
|
def post_scrobble(artist:Multi,**keys):
|
||||||
|
"""Submit a new scrobble.
|
||||||
|
|
||||||
|
:param string artist: Artists. Can be multiple.
|
||||||
|
:param string title: Title of the track.
|
||||||
|
:param string album: Name of the album.
|
||||||
|
:param int duration: Actual listened duration of the scrobble in seconds. Optional.
|
||||||
|
:param int time: UNIX timestamp of the scrobble. Optional, not needed if scrobble is at time of request.
|
||||||
|
"""
|
||||||
#artists = "/".join(artist)
|
#artists = "/".join(artist)
|
||||||
artists = artist
|
artists = artist
|
||||||
title = keys.get("title")
|
title = keys.get("title")
|
||||||
|
@ -16,7 +16,20 @@ else:
|
|||||||
except:
|
except:
|
||||||
HOME_DIR = os.path.join(os.environ["HOME"],".local/share/")
|
HOME_DIR = os.path.join(os.environ["HOME"],".local/share/")
|
||||||
|
|
||||||
DATA_DIR = os.path.join(HOME_DIR,"maloja")
|
OLD_DATA_DIR = os.path.join(HOME_DIR,"maloja")
|
||||||
|
NEW_DATA_DIR = "/etc/maloja"
|
||||||
|
|
||||||
|
if os.path.exists(OLD_DATA_DIR):
|
||||||
|
DATA_DIR = OLD_DATA_DIR
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
#check if we have permissions
|
||||||
|
os.makedirs(NEW_DATA_DIR,exist_ok=True)
|
||||||
|
os.mknod(os.path.join(NEW_DATA_DIR,".test"))
|
||||||
|
os.remove(os.path.join(NEW_DATA_DIR,".test"))
|
||||||
|
DATA_DIR = NEW_DATA_DIR
|
||||||
|
except:
|
||||||
|
DATA_DIR = OLD_DATA_DIR
|
||||||
|
|
||||||
os.makedirs(DATA_DIR,exist_ok=True)
|
os.makedirs(DATA_DIR,exist_ok=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user