Skip to content

Commit 78bb8b3

Browse files
committed
Added mangle props
1 parent 35ef412 commit 78bb8b3

11 files changed

+59
-20
lines changed

channels/1channel.ch

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=0.12
1+
version=0.14
22

33
scriptdef ch1Subs {
44
url=s_url
@@ -19,6 +19,17 @@ scriptdef ch1Subs {
1919
play
2020
}
2121
22+
scriptdef ch1Name {
23+
url=s_url
24+
regex='host_48
25+
replace url 'putlocker
26+
regex='host_45
27+
replace url 'sockshare
28+
regex='td>\s*(<.*>\s*)*.*
29+
replace url '
30+
play
31+
}
32+
2233
macrodef tvMacro {
2334
folder {
2435
matcher=div class=\"index_item index_item_ie\"><a href=\"([^\"]+)\" title=\"Watch ([^\"]+)\"><img .*?\s*src=\"([^\"]+)\"
@@ -38,7 +49,7 @@ macrodef tvMacro {
3849
#<a href="/external.php?title=The+Walking+Dead&url=aHR0cDovL3d3dy5wdXRsb2NrZXIuY29tL2ZpbGUvMEY2RUY0NUIyRkE2MjI2MQ==&domain=cHV0bG9ja2VyLmNvbQ==&loggedin=0" onClick="return addHit('1889616332', '1')" rel="nofollow" title="Watch Version 1 of The Walking Dead" target="_blank">Version 1</a>
3950
matcher=href=\"([^\"]+)\"[^>]+>(Version[^<]+)</a>[\s]+.*[\s]+.*"><.*=[^/]+/[^/|']+[/|']([^.]+)
4051
order=url,name,name
41-
prop = name_separator= - ,
52+
prop = name_separator= - ,name_mangle=ch1Name
4253
url=http://www.1channel.ch
4354
#type=empty
4455
media {
@@ -69,7 +80,7 @@ macrodef movieMacro {
6980
#<a href="/external.php?title=The+Walking+Dead&url=aHR0cDovL3d3dy5wdXRsb2NrZXIuY29tL2ZpbGUvMEY2RUY0NUIyRkE2MjI2MQ==&domain=cHV0bG9ja2VyLmNvbQ==&loggedin=0" onClick="return addHit('1889616332', '1')" rel="nofollow" title="Watch Version 1 of The Walking Dead" target="_blank">Version 1</a>
7081
matcher=href=\"([^\"]+)\"[^>]+>(Version[^<]+)</a>[\s]+.*[\s]+.*"><.*=[^/]+/[^/|']+[/|']([^.]+)
7182
order=url,name,name
72-
prop = name_separator= - ,
83+
prop = name_separator= - ,name_mangle=ch1Name
7384
url=http://www.1channel.ch
7485
type=empty
7586
media {

src/com/sharkhunter/channel/CH_plugin.java

+4-10
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ private void dbgArg(List<String> cmdList) {
138138
public List<String> finalizeTranscoderArgs(Player player, String name,
139139
DLNAResource res, DLNAMediaInfo media, OutputParams params,
140140
List<String> cmdList) {
141-
Channels.debug("finalize args:");
141+
/* Channels.debug("finalize args:");
142142
Channels.debug("name "+name+" params "+params.toString());
143143
Channels.debug("player "+player.name());
144-
dbgArg(cmdList);
144+
dbgArg(cmdList);*/
145145
//if((!(res instanceof ChannelMediaStream)))
146146
if(true)
147147
return cmdList;
@@ -173,17 +173,11 @@ public List<String> finalizeTranscoderArgs(Player player, String name,
173173
}
174174
// now add the special args
175175
out.add("-vcodec");
176-
out.add("mpeg2video");
176+
out.add("copy");
177177
out.add("-acodec");
178-
out.add("ac3");
178+
out.add("copy");
179179
out.add("-f");
180180
out.add("dvd");
181-
out.add("-maxrate");
182-
out.add("2000k");
183-
out.add("-minrate");
184-
out.add("1000k");
185-
out.add("-bufsize");
186-
out.add("4000k");
187181
// finally add the pipe
188182
out.add(pipeName);
189183
return out;

src/com/sharkhunter/channel/ChannelFolder.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,9 @@ public boolean escape(String base) {
10471047
@Override
10481048
public boolean unescape(String base) {
10491049
return ChannelUtil.getProperty(prop, base+"_unescape");
1050-
1050+
}
1051+
1052+
public String mangle(String base) {
1053+
return ChannelUtil.getPropertyValue(prop, base+"_mangle");
10511054
}
10521055
}

src/com/sharkhunter/channel/ChannelItem.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ public boolean escape(String base) {
204204
@Override
205205
public boolean unescape(String base) {
206206
return ChannelUtil.getProperty(prop, base+"_unescape");
207-
207+
}
208+
209+
public String mangle(String base) {
210+
return ChannelUtil.getPropertyValue(prop, base+"_mangle");
208211
}
209212
}

src/com/sharkhunter/channel/ChannelMatcher.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,17 @@ private String getMatch_i(String field,boolean fallbackFirst,String def) {
121121
private String pend(String str,String field) {
122122
str=esc(unesc(str,field),field);
123123
String r1=ChannelUtil.append(str, null, properties.append(field));
124-
return ChannelUtil.append(properties.prepend(field), null, r1);
124+
return doMangle(ChannelUtil.append(properties.prepend(field), null, r1),field);
125+
}
126+
127+
private String doMangle(String str,String field) {
128+
String script=properties.mangle(field);
129+
if(ChannelUtil.empty(script)) // no script return what we got
130+
return str;
131+
String res=ChannelScriptMgr.runScript(script, str, parent);
132+
if(ChannelUtil.empty(res)) // no funny result from mangle script, leave it
133+
return str;
134+
return res;
125135
}
126136

127137
private String esc(String str,String field) {
@@ -197,4 +207,7 @@ public boolean unescape(String base) {
197207
return false;
198208
}
199209

210+
public String mangle(String base) {
211+
return null;
212+
}
200213
}

src/com/sharkhunter/channel/ChannelMedia.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,10 @@ public boolean escape(String base) {
433433
@Override
434434
public boolean unescape(String base) {
435435
return ChannelUtil.getProperty(prop, base+"_unescape");
436-
436+
}
437+
438+
public String mangle(String base) {
439+
return ChannelUtil.getPropertyValue(prop, base+"_mangle");
437440
}
438441

439442
}

src/com/sharkhunter/channel/ChannelProps.java

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ public interface ChannelProps {
77
public String prepend(String base);
88
public boolean unescape(String base);
99
public boolean escape(String base);
10+
public String mangle(String base);
1011
}

src/com/sharkhunter/channel/ChannelSimple.java

+5
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,9 @@ public boolean unescape(String base) {
102102
return ChannelUtil.getProperty(prop, base+"_unescape");
103103

104104
}
105+
106+
@Override
107+
public String mangle(String base) {
108+
return ChannelUtil.getPropertyValue(prop, base+"_mangle");
109+
}
105110
}

src/com/sharkhunter/channel/ChannelSubs.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ public boolean escape(String base) {
392392
@Override
393393
public boolean unescape(String base) {
394394
return false;
395-
395+
}
396+
397+
public String mangle(String base) {
398+
return ChannelUtil.getPropertyValue(prop, base+"_mangle");
396399
}
397400
}

src/com/sharkhunter/channel/ChannelSwitch.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public boolean escape(String base) {
106106
@Override
107107
public boolean unescape(String base) {
108108
return ChannelUtil.getProperty(prop, base+"_unescape");
109-
109+
}
110+
111+
public String mangle(String base) {
112+
return ChannelUtil.getPropertyValue(prop, base+"_mangle");
110113
}
111114
}

src/com/sharkhunter/channel/Channels.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
public class Channels extends VirtualFolder implements FileListener {
2929

3030
// Version string
31-
public static final String VERSION="1.61";
31+
public static final String VERSION="1.63";
3232

3333
// Constants for RTMP string constructions
3434
public static final int RTMP_MAGIC_TOKEN=1;

0 commit comments

Comments
 (0)