Last active 1625670476

plays the acnh soundtrack synced to real time kinda

acnhmusic.py Raw
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
4from glob import glob
5from datetime import datetime
6from sys import stderr
7
8print("#EXTM3U")
9
10files = sorted(glob("*.m4a"))
11n = datetime.now()
12hour = n.hour
13files = files[hour:] + files[:hour]
14
15def 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
21earlier = datetime(n.year, n.month, n.day, n.hour, 0, 0)
22print(f"skip ahead {hms((n-earlier).seconds)}", file=stderr)
23
24l = "#EXTINF:1800.0,ACNH - {0}:00\n{1}\n"
25print("".join(l.format(f[:2], f) for f in files))