Skip to content

Instantly share code, notes, and snippets.

@rz7d
Last active April 23, 2022 04:59
Show Gist options
  • Save rz7d/1ce68a8467e2874f3324766f857270da to your computer and use it in GitHub Desktop.
Save rz7d/1ce68a8467e2874f3324766f857270da to your computer and use it in GitHub Desktop.
TVTest の .ch2 ファイルから Mirakurun の channels.yml を作る (地上波決め打ち, quick & dirty)
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
public class Convert {
public static void main(String[] args) throws Exception {
var csv = new String(System.in.readAllBytes(), Charset.forName("MS932"));
var lines = csv.split("\r?\n");
for (int i = 3; i < lines.length; ++i) {
String[] record = lines[i].split(",");
System.out.println("- name: " + record[0]);
System.out.println(" type: GR");
System.out.println(" channel: '" + (Integer.parseInt(record[2]) + 13) + "'");
System.out.println(" serviceId: " + record[5]);
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment