From e6043132f8939db5c8fc0bc388fbf84ff6e6e9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Sun, 25 Aug 2024 16:34:59 +0100 Subject: [PATCH] =?UTF-8?q?Add=20script=20for=20reviewing=20previous=20yea?= =?UTF-8?q?rs=E2=80=99=20activities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otd.py | 19 +++++++++++++++++++ scrobble.py | 14 +++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 otd.py diff --git a/otd.py b/otd.py new file mode 100644 index 0000000..713d2d2 --- /dev/null +++ b/otd.py @@ -0,0 +1,19 @@ +import datetime,os + +year = int(datetime.datetime.strftime(datetime.datetime.today(),"%Y")) +monthstring = datetime.datetime.strftime(datetime.datetime.today(),"%m") +datestring = datetime.datetime.strftime(datetime.datetime.today(),"%d") + +fileplace = "/home/mdd/Documents/drive/org/journal/" + +thisyear = year + +while year > 1993: + year -= 1 + target = fileplace + str(year) + "/" + monthstring + "/" + str(year) + "-" + monthstring + "-" + datestring + ".org" + if os.path.exists(target): + if year < thisyear -1: + print("Press enter to continue") + input() + print(open(target,"r").read()) + diff --git a/scrobble.py b/scrobble.py index 40aa179..32db791 100644 --- a/scrobble.py +++ b/scrobble.py @@ -8,9 +8,9 @@ thealbums = sorted(albums.albums,key=lambda d: d["name"]) def countdown(t): # https://stackoverflow.com/a/25189629 while t: - mins, secs = divmod(t, 60) - timeformat = '{:02d}:{:02d}'.format(mins, secs) - print(timeformat, end='\r') + mins, secs = divmod(t,60) + timeformat = '{:02d}:{:02d}'.format(mins,secs) + print("> " + timeformat,end='\r') time.sleep(1) t -= 1 @@ -30,8 +30,12 @@ def scrobble(thealbum): if theartist == "noscrob": print("Skipped " + thetrack) else: - last_api_call = network.scrobble(theartist,thetrack,int(time.time())) - print("Scrobbled " + item) + if tracklist[item] > 29: + last_api_call = network.scrobble(theartist,thetrack,int(time.time())) + print("Scrobbled " + thetrack) + else: + print("Skipped " + thetrack) + last_api_call = network.update_now_playing(theartist,thetrack,duration=tracklist[item]) countdown(tracklist[item]) if i < len(album["tracks"]): input("Press enter after changing side")