Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .classpath

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bin/
**.orig
/.classpath
44 changes: 20 additions & 24 deletions src/com/sharkhunter/channel/CH_plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import javax.swing.JComponent;

import org.apache.commons.configuration.ConfigurationException;

import org.slf4j.LoggerFactory;
import com.sun.jna.Platform;

import net.pms.PMS;
import net.pms.configuration.PmsConfiguration;
import net.pms.dlna.DLNAMediaInfo;
import net.pms.dlna.DLNAResource;
import net.pms.dlna.WebStream;
import net.pms.dlna.virtual.VirtualFolder;
import net.pms.encoders.Player;
import net.pms.external.AdditionalFolderAtRoot;
Expand All @@ -29,9 +24,10 @@
import net.pms.external.StartStopListener;
import net.pms.io.OutputParams;

public class CH_plugin implements AdditionalFolderAtRoot, StartStopListener,
public class CH_plugin implements AdditionalFolderAtRoot, StartStopListener,
FinalizeTranscoderArgsListener, URLResolver {

private static org.slf4j.Logger LOGGER = LoggerFactory.getLogger(CH_plugin.class);
private static final long DEFAULT_POLL_INTERVAL=20000;
private static boolean initFetchPending=false;
private Channels chRoot;
Expand All @@ -53,7 +49,7 @@ public CH_plugin() {
chFolder.mkdir();
path=chFolder.toString();
}
else
else
path=confPath;
String save=(String)PMS.getConfiguration().getCustomProperty("channels.save");
chRoot=new Channels(path,pluginName,img);
Expand Down Expand Up @@ -83,7 +79,7 @@ public CH_plugin() {
}
catch (Exception e) {
chRoot.debug("init exp "+e);
PMS.debug("exp "+e) ;
LOGGER.debug("{Channel} Exception: {}", e);
}
}

Expand All @@ -95,7 +91,7 @@ private long getInterval() {
return l.longValue();
}
catch (Exception e) {
PMS.minimal("Illegal interval value "+e.toString());
LOGGER.warn("{Channel} Illegal interval value \"{}\": {}", interval, e);
}
}
return CH_plugin.DEFAULT_POLL_INTERVAL;
Expand Down Expand Up @@ -129,12 +125,12 @@ public void nowPlaying(DLNAMediaInfo arg0, DLNAResource arg1) {
if(arg1 instanceof ChannelMediaStream)
((ChannelMediaStream)arg1).nowPlaying();
}

private static String linuxPath(String program) {
ProcessBuilder pb=new ProcessBuilder("which",program);
return ChannelUtil.execute(pb);
}

public static void unzip(String path,File f) {
try {
ZipInputStream zis = new ZipInputStream(new FileInputStream(f));
Expand All @@ -157,10 +153,10 @@ public static void unzip(String path,File f) {
}
zis.close();
} catch (Exception e) {
PMS.info("unzip error "+e);
LOGGER.info("{Channel} Unzip error: {}", e);
}
}

public static void postInstall() {
initFetchPending=true;
PMS.getConfiguration().setCustomProperty("channels.path", "extras\\channels");
Expand Down Expand Up @@ -200,11 +196,11 @@ else if(Platform.isLinux()) {
} catch (ConfigurationException e) {
}
}

private void removeArg(List<String> list,String arg) {
removeArg(list,arg,false);
}

private void removeArg(List<String> list,String arg,boolean boolOp) {
int pos;
if((pos=list.indexOf(arg))!=-1) {
Expand All @@ -216,7 +212,7 @@ private void removeArg(List<String> list,String arg,boolean boolOp) {
list.set(pos+1,"copy");
}
}

private void dbgArg(List<String> cmdList) {
for(int i=0;i<cmdList.size();i++)
Channels.debug("arg "+i+":"+cmdList.get(i));
Expand All @@ -234,7 +230,7 @@ public List<String> finalizeTranscoderArgs(Player player, String name,
ChannelMediaStream cms=(ChannelMediaStream)res;
return cms.addStreamvars(cmdList,params);
}

/*public DLNAResource fromPlaylist(String name,String uri,String thumb,
String extra,String className) {
Channels.debug("call from pl "+name+" "+uri+" "+extra);
Expand All @@ -253,9 +249,9 @@ public List<String> finalizeTranscoderArgs(Player player, String name,
type=ChannelUtil.getFormat(es[1]);
if(ChannelUtil.empty(name))
name="Unknown";
return (new ChannelMediaStream(ch,name,uri,thumb,proc,type,asx,(ChannelScraper)null));
return (new ChannelMediaStream(ch,name,uri,thumb,proc,type,asx,(ChannelScraper)null));
}*/

public static void main(String[] args) {
try {
PMS.setConfiguration(new PmsConfiguration());
Expand Down Expand Up @@ -311,7 +307,7 @@ public static void main(String[] args) {
if(ChannelUtil.empty(ChannelUtil.extension(outFile)))
outFile=outFile+Channels.cfg().getCrawlFormat();
}

Thread t=ChannelUtil.newBackgroundDownload(outFile,url);
t.start();
threads.add(t);
Expand All @@ -325,7 +321,7 @@ public static void main(String[] args) {
System.out.println("Done");
System.exit(0);
}

private static final String DUMMY_URL = "http://dummy_url.dummy.dummy/";

public DLNAResource create(String arg0) {
Expand All @@ -351,7 +347,7 @@ public DLNAResource create(String arg0) {
return new ChannelMediaStream(tmp[2],tmp[0],ch,format,thumb);
}


public URLResult urlResolve(String url) {
URLResult res = new URLResult();
boolean dummyOnly=url.contains(DUMMY_URL);
Expand All @@ -373,5 +369,5 @@ public URLResult urlResolve(String url) {
}
return res;
}

}
Loading