diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 0af6647..c84677f 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -195,9 +195,21 @@ def compare_external(**keys): @api.get("newscrobble") +def get_post_scrobble(*args,**kwargs): + """DEPRECATED. Use the equivalent POST method instead.""" + return post_scrobble(*args,**kwargs) + @api.post("newscrobble") @authenticated_api_with_alternate(api_key_correct) 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 = artist title = keys.get("title") diff --git a/maloja/globalconf.py b/maloja/globalconf.py index 91b917e..4404677 100644 --- a/maloja/globalconf.py +++ b/maloja/globalconf.py @@ -16,7 +16,20 @@ else: except: 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)