home *** CD-ROM | disk | FTP | other *** search
- package netscape.netcast;
-
- import marimba.castanet.client.CastanetChannel;
- import marimba.castanet.client.CastanetTransmitter;
- import marimba.castanet.client.CastanetWorkspace;
-
- class TunerCommand implements Runnable {
- static final int START = 0;
- static final int RESTART = 1;
- static final int STOP = 2;
- static final int SUBSCRIBE = 3;
- static final int UNSUBSCRIBE = 4;
- static final int UPDATE = 5;
- static final int REMOVE = 6;
- static final int CONFIRM_START = 7;
- // $FF: renamed from: nc netscape.netcast.NSNetcast
- NSNetcast field_0;
- // $FF: renamed from: ws marimba.castanet.client.CastanetWorkspace
- CastanetWorkspace field_1;
- int cmd;
- String transmitterName;
- String channelName;
- TunerCommand next;
- String[] argv;
-
- TunerCommand(int cmd, String transmitterName, String channelName, String[] argv) {
- this(NSCastanetWorkspace.getCastanetWorkspace(), cmd, transmitterName, channelName, argv);
- }
-
- TunerCommand(int cmd, String transmitterName, String channelName) {
- this(NSCastanetWorkspace.getCastanetWorkspace(), cmd, transmitterName, channelName, new String[0]);
- }
-
- TunerCommand(CastanetWorkspace ws, int cmd, String transmitterName, String channelName, String[] argv) {
- this.field_1 = ws;
- this.cmd = cmd;
- this.transmitterName = transmitterName;
- this.channelName = channelName;
- this.argv = argv;
- NSCastanetWorkspace.add(this);
- }
-
- CastanetChannel getChannel(boolean create) {
- if (create && this.field_1.getEnvironment().networkEnabled()) {
- CastanetTransmitter transmitter = this.field_1.getTransmitterCreate(this.transmitterName);
- return transmitter != null ? transmitter.getChannelCreate(this.channelName) : null;
- } else {
- CastanetTransmitter transmitter = this.field_1.getTransmitter(this.transmitterName);
- return transmitter != null ? transmitter.getChannel(this.channelName) : null;
- }
- }
-
- TunerCommand(CastanetWorkspace ws, int cmd, String transmitterName, String channelName) {
- this(ws, cmd, transmitterName, channelName, new String[0]);
- }
-
- public void run() {
- switch (this.cmd) {
- case 0:
- StringBuffer buf = new StringBuffer();
-
- for(int i = 0; i < this.argv.length; ++i) {
- buf.append(',');
- buf.append(this.argv[i]);
- }
-
- Channel.add("castanet://" + this.transmitterName + "/" + this.channelName + "?start" + buf, this.argv);
- return;
- case 1:
- CastanetChannel channel = this.getChannel(true);
- if (channel != null) {
- channel.restart();
- return;
- }
- break;
- case 2:
- CastanetChannel channel = this.getChannel(false);
- if (channel != null) {
- channel.stop();
- return;
- }
- break;
- case 3:
- CastanetChannel channel = this.getChannel(true);
- if (channel != null) {
- channel.subscribe();
- return;
- }
- break;
- case 4:
- CastanetChannel channel = this.getChannel(false);
- if (channel != null) {
- channel.unsubscribe();
- return;
- }
- break;
- case 5:
- CastanetChannel channel = this.getChannel(false);
- if (channel != null) {
- channel.update();
- return;
- }
- break;
- case 6:
- CastanetChannel channel = this.getChannel(false);
- if (channel != null) {
- channel.remove();
- return;
- }
- break;
- case 7:
- StringBuffer buf = new StringBuffer();
-
- for(int i = 0; i < this.argv.length; ++i) {
- buf.append(',');
- buf.append(this.argv[i]);
- }
-
- Channel.add("castanet://" + this.transmitterName + "/" + this.channelName + "?start" + buf, this.argv);
- return;
- }
-
- }
- }
-