/*
 * @(#)Stat.java
 *
 * This file is part of webCDwriter - Network CD Writing.
 *
 * Copyright (C) 2003 Jörg P. M. Haeger
 *
 * webCDwriter is free software. See CDcreator.java for details.
 *
 * Author: Jörg Haeger, 17.10.2003
 */

import java.util.StringTokenizer;

/**
 * Stat
 *
 * @version 20031017
 * @author Jörg P. M. Haeger
 */
class Stat extends Command {
	private static String mutex = "Stat";
	public int type;
	public long len;
	public long seconds;

	void processHint(String str) {
		StringTokenizer t = new StringTokenizer(str, " \t");
		try {
			String str2 = t.nextToken();
			type = ServerFile.DATA;
			if (str2.equals("d"))
				type = ServerFile.DIR;

			str2 = t.nextToken();
			len = Long.parseLong(str2);

			str2 = t.nextToken();
			if (str2.equals("MP3"))
				type = ServerFile.MP3;
			else
			if (str2.equals("OGG"))
				type = ServerFile.MP3;
			else
			if (str2.equals("WAV"))
				type = ServerFile.MP3;

			str2 = t.nextToken();
			seconds = Long.parseLong(str2);
		}
		catch (Exception e) {
		}
	}

	public void run(String path) {
		synchronized(mutex) {
			execCommand("stat " + spaceToEsc(path));
		}
		super.run();
	}
}
