Last active 1625670476

plays the acnh soundtrack synced to real time kinda

Alyssa Smith revised this gist 1625706476. Go to revision

1 file changed, 25 insertions

acnhmusic.py(file created)

@@ -0,0 +1,25 @@
1 + #!/usr/bin/env python3
2 + # videos from https://tane.us/ac/nhIds.js, rename to hh00.m4a
3 + # python3 acnhmusic.py | mpv - --loop-playlist=inf
4 + from glob import glob
5 + from datetime import datetime
6 + from sys import stderr
7 +
8 + print("#EXTM3U")
9 +
10 + files = sorted(glob("*.m4a"))
11 + n = datetime.now()
12 + hour = n.hour
13 + files = files[hour:] + files[:hour]
14 +
15 + def hms(inp):
16 + s,ms = divmod(inp,1)
17 + m,s = divmod(s,60)
18 + h,m = divmod(m,60)
19 + return f"{h:02.0f}:{m:02.0f}:{s:02.0f}"
20 +
21 + earlier = datetime(n.year, n.month, n.day, n.hour, 0, 0)
22 + print(f"skip ahead {hms((n-earlier).seconds)}", file=stderr)
23 +
24 + l = "#EXTINF:1800.0,ACNH - {0}:00\n{1}\n"
25 + print("".join(l.format(f[:2], f) for f in files))
Newer Older