Better aspect ratio of the blocks for the archos bitmap LCD (1.06:1 instead of 1...
[kugel-rb.git] / songdbj / SongDB.java
blob4b7f2aae03f71e8c6da28e10f12b78751a1b9169
1 import java.io.*;
2 import java.lang.reflect.Array;
4 public class SongDB {
6 public static final void main(String[] args) {
7 TagDatabase td = TagDatabase.getInstance();
8 File tdfile = new File("rockbox.tagdb");
9 // RuntimeDatabase rd = RuntimeDatabase.getInstance();
10 int i = 0, j;
11 String arg,path = null;
13 while (i < args.length) {
14 arg = args[i++];
15 if (arg.equals("--dirisnotalbumname")) {
16 td.dirisalbumname=false;
18 else if(arg.equals("--dirisalbum")) {
19 td.dirisalbum=true;
21 else if(arg.equals("--dontshowduplicates")) {
22 td.showduplicates=false;
24 else if(arg.equals("--strip")) {
25 if (i < args.length)
26 td.strip = args[i++];
27 else {
28 System.err.println("--strip requires a path");
29 System.exit(0);
32 else if(arg.equals("--add")) {
33 if (i < args.length)
34 td.add = args[i++];
35 else {
36 System.err.println("--add requires a path");
37 System.exit(0);
40 else {
41 if(path!=null) {
42 System.err.println("you can't specify more than one path!");
43 System.exit(0);
45 path = arg;
48 if (i != args.length||path==null) {
49 System.out.println("Usage: SongDB [--showduplicates] [--strip <directory>] [--add <directory>] [--dirisnotalbumname] [--dirisalbum] <directory>");
50 return;
52 if(tdfile.exists()&&!tdfile.canWrite()) {
53 System.out.println("rockbox.tagdb is not writable.");
54 return;
56 try {
57 tdfile.createNewFile();
59 catch(Exception e) {
60 System.out.println("Error while trying to create rockbox.tagdb: "+e.getMessage());
61 return;
63 td.add(new File(path));
64 try {
65 td.prepareWrite();
66 // rd.prepareWrite();
67 td.writeDatabase(new File("rockbox.tagdb"));
68 // rd.writeDatabase(new File("rockbox.rundb"));
70 catch(IOException e) {
71 System.out.println(e);