Wrote a small utility for parsing KShoot player score data into a song favourites list.

This commit is contained in:
neviyn 2016-09-06 21:11:17 +01:00
commit f1986f54d5
3 changed files with 56 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
nimcache

36
README.md Normal file
View File

@ -0,0 +1,36 @@
# KSM Songs Played
## Synopsis
A simple utility that looks at the player's score folder and generates a K-Shoot
favourites folder containing all songs the player has ever played.
## Building
nim c ksmplayedsongs.nim
## Download
[Windows x64](https://neviyn.co.uk/release/ksmplayedsongs.exe)
## License
The MIT License (MIT)
Copyright (c) 2016 Nathan Cannon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

19
ksmplayedsongs.nim Normal file
View File

@ -0,0 +1,19 @@
import os
echo("Input KSM directory")
let mainDir: string = readLine(stdin)
let userDir: string = mainDir & DirSep & "score" & DirSep & "PLAYER"
let outFileName: string = mainDir & DirSep & "songs" & DirSep & "Played.fav"
var f: File
if open(f, outFileName, fmWrite):
try:
for kind, path in walkDir(userDir, true):
if kind == pcDir:
let fullPath = userDir & DirSep & path
for k2, p2 in walkDir(fullPath, true):
if k2 == pcDir:
f.writeLine(path & DirSep & p2)
finally:
close(f)
else:
quit("Error writing to file: " & outFileName)