@@ -71,7 +71,7 @@ static function SaveDownloader()
71
71
$ jobs =[];
72
72
foreach (self ::$ DOWNLOADER as $ jobinfo )
73
73
{
74
- setcookie ( " job_ " .$ jobinfo ['jobid ' ],json_encode ($ jobinfo ), time ()+ 60 * 60 * 24 * 30 );
74
+ file_put_contents ( self :: $ jobpath . " / " .$ jobinfo ['jobid ' ]. " .job " ,json_encode ($ jobinfo ));
75
75
$ jobs []=$ jobinfo ['jobid ' ];
76
76
}
77
77
setcookie ("jobs " ,json_encode ($ jobs ),time ()+60 *60 *24 *30 );
@@ -82,18 +82,56 @@ static function LoadDownloader()
82
82
if (!isset ($ _COOKIE ['jobs ' ]))
83
83
{
84
84
self ::$ DOWNLOADER =[];
85
- setcookie ("jobs " ,json_encode (self :: $ DOWNLOADER ),time ()+60 *60 *24 *30 );
85
+ setcookie ("jobs " ,json_encode ([] ),time ()+60 *60 *24 *30 );
86
86
}
87
87
$ joblist =json_decode (stripslashes ($ _COOKIE ['jobs ' ]),true );
88
88
foreach ($ joblist as $ job )
89
89
{
90
- if (isset ( $ _COOKIE [ ' job_ ' . $ job] ))
90
+ if (file_exists ( self :: $ jobpath . " / " . $ job. " .job " ))
91
91
{
92
- self ::$ DOWNLOADER []=json_decode (stripslashes ( $ _COOKIE [ ' job_ ' . $ job] ),true );
92
+ self ::$ DOWNLOADER []=json_decode (file_get_contents ( self :: $ jobpath . " / " . $ job. " .job " ),true );
93
93
}
94
94
}
95
95
}
96
96
97
+ static function FetchStaleJobs ()
98
+ {
99
+ $ worker =new FilesystemIterator (self ::$ jobpath );
100
+ $ cutoff =time ()-(self ::$ job_ttl *60 );
101
+ foreach ($ worker as $ job )
102
+ {
103
+ $ fn =$ job ->getFilename ();
104
+ if (subst ($ fn ,-4 )!==".job " )
105
+ {
106
+ if ($ job ->getCTime ()<$ cutoff )
107
+ {
108
+ self ::NukeJob ($ fn );
109
+ }
110
+
111
+ }
112
+ }
113
+ }
114
+
115
+ static function NukeJob ($ jobid )
116
+ {
117
+ unlink (self ::$ jobpath . "/ " . $ jobid );
118
+ unlink (self ::$ jobpath . "/ " . $ jobid .".job " );
119
+
120
+ $ remover =new FilesystemIterator (self ::$ dl_dir_common ."/ " .$ jobid );
121
+ foreach ($ remover as $ item )
122
+ {
123
+ unlink (self ::$ dl_dir_common ."/ " .$ jobid ."/ " .$ item ->getFilename ());
124
+ }
125
+ unlink (self ::$ dl_dir_common ."/ " .$ jobid );
126
+
127
+ $ remover =new FilesystemIterator (self ::$ dl_dir_mp3 ."/ " .$ jobid );
128
+ foreach ($ remover as $ item )
129
+ {
130
+ unlink (self ::$ dl_dir_mp3 ."/ " .$ jobid ."/ " .$ item ->getFilename ());
131
+ }
132
+ unlink (self ::$ dl_dir_mp3 ."/ " .$ jobid );
133
+ }
134
+
97
135
static function SetupDir ($ dirname )
98
136
{
99
137
clearstatcache ();
@@ -342,6 +380,7 @@ static function handleTag($tag, $rest)
342
380
case "sponsorblock " :
343
381
case "fixupm3u8 " :
344
382
case "metadata " :
383
+ case "metadataparser " :
345
384
case "embedsubtitle " :
346
385
case "hlsnative " :
347
386
{
@@ -1138,12 +1177,20 @@ function showInfo(info)
1138
1177
font-weight:bold;
1139
1178
content: attr(data-progress);
1140
1179
}
1180
+ [data-provider]::before
1181
+ {
1182
+ content:"?";
1183
+ }
1141
1184
[data-provider=youtube]::before
1142
1185
{
1143
1186
border-radius:3px;
1144
1187
content:'▶';
1145
1188
color:white;
1146
1189
background-color:red;
1190
+ padding:3px;
1191
+ padding-left:10px;
1192
+ padding-right:10px;
1193
+
1147
1194
}
1148
1195
[data-provider=xhamster]::before
1149
1196
{
@@ -1195,6 +1242,27 @@ function showInfo(info)
1195
1242
position:relative;
1196
1243
height:3em;
1197
1244
}
1245
+ #infoheader
1246
+ {
1247
+ font-size:2em;
1248
+ }
1249
+ #vicount::before
1250
+ {
1251
+ content:"Videos: ";
1252
+ }
1253
+ #jobid::before
1254
+ {
1255
+ content:"Job ID: ";
1256
+ }
1257
+ #mode
1258
+ {
1259
+ font-variant: small-caps;
1260
+ font-family: monospace;
1261
+ }
1262
+ #mode::before
1263
+ {
1264
+ content:"Mode: ";
1265
+ }
1198
1266
</style>
1199
1267
</head>
1200
1268
<body><form id="controls">
0 commit comments