-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.example.es6
executable file
·60 lines (50 loc) · 1.45 KB
/
config.example.es6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
export default {
"port": 1200,
"timeout": 560000,
"console": "default",
"extensions": [
],
"autoresponder": [
{
"match": /http:\/\/dl.oneplay.tv\/WTS_MEDIA:\S*\.ts/g,
"code": `
import Path from 'path'
import fs from 'fs'
var exec= async function(ev){
var e= ev.request
var Proxy= ev.proxy
var responder= Proxy.autoResponders.getById("org.voxsoftware.proxy.oneplaygrabber")
var file, path, saveDir= responder.env("savedir")
var request= Proxy.getChannelRequest(e)
var url= e.request.url
var parts= url.split("/")
for(var i=0;i<parts.length;i++){
if(parts[i] && parts[i].toUpperCase().startsWith("PROFILE")){
path= parts[i]
break
}
}
if(!fs.existsSync(saveDir))
fs.mkdirSync(saveDir)
if(path)
path= Path.join(saveDir, path)
else
path= saveDir
if(!fs.existsSync(path))
fs.mkdirSync(path)
// Ahora se guarda en un archivo y también se devuelve al response ...
path= Path.join(path, parts[parts.length-1])
file=fs.createWriteStream(path)
request.beginGetResponse()
e.request.pipe(request.innerRequest)
request.innerRequest.pipe(e.response)
request.innerRequest.pipe(file)
await request.endGetResponse()
}
export default exec
`,
"id": "org.voxsoftware.proxy.oneplaygrabber",
"savedir": "/Users/james/grabaciones" // Aquí debería ir la carpeta donde se debe grabar
}
]
}