def setUpClass(cls): cls.tests = [] cls.update = False cls.saveimages = False cls.tests.append(Osr2mp4(*getrightconfigs("10"))) cls.tests[-1].startall() cls.tests[-1].joinall() cls.tests.append(Osr2mp4(*getrightconfigs("11"))) cls.tests[-1].startall() cls.tests[-1].joinall() if True: # to be able to disable sometimes for testing atexit.register(cleanup, cls.tests)
def run(): from osr2mp4.osr2mp4 import Osr2mp4 abspath = os.path.dirname(os.path.abspath(inspect.getsourcefile(Dummy))) execpath = sys.argv[1] logpath = os.path.join(execpath, "Logs/") fprogress = open(os.path.join(abspath, "progress.txt"), "w") fprogress.write("0") fprogress.close() logpath = os.path.join(logpath, "core.log") config = os.path.join(abspath, "config.json") settings = os.path.join(abspath, "settings.json") ppsettings = os.path.join(abspath, "ppsettings.json") if not os.path.isfile(ppsettings): ppsettings = None converter = Osr2mp4(filedata=config, filesettings=settings, filepp=ppsettings, logtofile=True, logpath=logpath) converter.startall() curprogress = 0 while curprogress < 99: curprogress = converter.getprogress() a = False if converter.writers is None: break for i in range(len(converter.writers)): if converter.writers[i].is_alive(): a = True if converter.writers[i].exitcode is not None and converter.writers[ i].exitcode != 0: return if converter.drawers[i].exitcode is not None and converter.drawers[ i].exitcode != 0: return if converter.audio is not None: if converter.audio.exitcode is not None and converter.audio.exitcode != 0: return if not a: curprogress = 99 fprogress = open(os.path.join(abspath, "progress.txt"), "w") fprogress.write(str(curprogress)) fprogress.close() print(curprogress) time.sleep(1) converter.joinall() fprogress = open(os.path.join(abspath, "progress.txt"), "w") fprogress.write("100") fprogress.close() time.sleep(0.5)
def main(): #for x in range(10): x = "" osr2mp4 = Osr2mp4(filedata=f"osr2mp4/config{x}.json", filesettings="osr2mp4/settings.json", filepp="osr2mp4/ppsettings.json", logtofile=True) osr2mp4.analyse_replay() # components = DummyFrameObjects() # drawacc(components, osr2mp4, osr2mp4.settings.skin_ini, x) print(osr2mp4.resultinfo[-1].accuracy, osr2mp4.resultinfo[-1].maxcombo) print(osr2mp4.replay_info.number_300s, osr2mp4.replay_info.number_100s, osr2mp4.replay_info.number_50s, osr2mp4.replay_info.misses, osr2mp4.replay_info.player_name, osr2mp4.replay_info.max_combo)
def main(): # data = read("osr2mp4/config.json") # gameplaydata = read("osr2mp4/settings.json") osr2mp4 = Osr2mp4( filedata= "/Users/yuitora./PycharmProjects/osr2mp4-core/osr2mp4/config.json", filesettings= "/Users/yuitora./PycharmProjects/osr2mp4-core/osr2mp4/settings.json", logtofile=True) osr2mp4.startall() osr2mp4.joinall() if os.name != 'nt': convert_tomp4(osr2mp4.settings)
def record(mapset: Path, replay: Path) -> Path: """Record `replay` on `mapset`, returning the path to the video file.""" # $VIDEO_DIR must be served at $SERVER_ADDR, so that Streamable can read the file. # It's taken care of in Docker Compose. _, output = mkstemp(dir=os.environ["VIDEO_DIR"], suffix=".mp4") data = { "osu! path": "/", "Skin path": os.environ["OSU_SKIN_PATH"], "Beatmap path": mapset.as_posix(), ".osr path": replay.as_posix(), "Default skin path": os.environ["OSU_SKIN_PATH"], "Output path": output, "Width": 1920, "Height": 1080, "FPS": 60, "Start time": 0, "End time": -1, "Video codec": "XVID", "Process": 2, "ffmpeg path": "ffmpeg", } settings = { "Global leaderboard": True, "Song volume": 100, "Effect volume": 100, "Enable PP counter": True, "Use FFmpeg video writer": True, "api key": os.environ["OSU_API_KEY"], } # This variable will generally only be set in Docker. hostname = os.getenv("HOSTNAME", "unknown") logs = os.path.join(os.environ["LOG_DIR"], f"osr2mp4-{hostname}.log") # Stop the `Osr2mp4` constructor from replacing `sys.excepthook`. hook = sys.excepthook osr = Osr2mp4(data, settings, logtofile=True, logpath=logs) sys.excepthook = hook osr.startall() osr.joinall() osr.cleanup() rmtree(mapset) replay.unlink() return Path(output)
def run_osu_(): converter = Osr2mp4(filedata="config.json", filesettings="settings.json") converter.startall() converter.joinall()