@@ -97,37 +97,9 @@ def worker(self):
97
97
job .status = Job .FAILED
98
98
job .log = "Error during download task:\n {}:\n \t {}" .format (type (e ).__name__ , str (e ))
99
99
print ("Error during download task:\n {}:\n \t {}" .format (type (e ).__name__ , str (e )))
100
- elif job .type == JobType .YDL_UPDATE :
101
- rc , log = self .update ()
102
- job .log = Job .clean_logs (log )
103
- job .status = Job .COMPLETED if rc == 0 else Job .FAILED
104
100
self .jobshandler .put ((Actions .UPDATE , job ))
105
101
self .queue .task_done ()
106
102
107
- def update (self ):
108
- if self .app_config ["ydl_server" ].get ("no_updates" , False ):
109
- return 0 , ""
110
- print (f"Updating: Current { self .ydl_module_name } version: { self .ydl_version } " )
111
- if os .environ .get ("YDL_PYTHONPATH" ):
112
- command = [
113
- "pip" ,
114
- "install" ,
115
- "--no-cache-dir" ,
116
- "-t" ,
117
- os .environ .get ("YDL_PYTHONPATH" ),
118
- "--upgrade" ,
119
- self .ydl_module_name ,
120
- ]
121
- else :
122
- command = ["pip" , "install" , "--no-cache-dir" , "--upgrade" , self .ydl_module_name ]
123
- proc = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
124
- out , err = proc .communicate ()
125
- if proc .wait () == 0 :
126
- self .app_config ["ydl_last_update" ] = datetime .now ()
127
- self .import_ydl_module ()
128
- print (f"Updating: New { self .ydl_module_name } version: { self .ydl_version } " )
129
- return proc .returncode , str (out .decode ("utf-8" ))
130
-
131
103
def get_ydl_options (self , ydl_config , request_options ):
132
104
ydl_config = ydl_config .copy ()
133
105
req_format = request_options .get ("format" )
@@ -212,19 +184,16 @@ def resume_pending(self):
212
184
jobs = db .get_all (self .app_config ["ydl_server" ].get ("max_log_entries" , 100 ))
213
185
not_endeds = [job for job in jobs if job ["status" ] == "Pending" or job ["status" ] == "Running" ]
214
186
for pending in not_endeds :
215
- if int (pending ["type" ]) == JobType .YDL_UPDATE :
216
- self .jobshandler .put ((Actions .SET_STATUS , (pending ["id" ], Job .FAILED )))
217
- else :
218
- job = Job (
219
- pending ["name" ],
220
- Job .PENDING ,
221
- "Queue stopped" ,
222
- int (pending ["type" ]),
223
- pending ["format" ],
224
- pending ["url" ],
225
- )
226
- job .id = pending ["id" ]
227
- self .jobshandler .put ((Actions .RESUME , job ))
187
+ job = Job (
188
+ pending ["name" ],
189
+ Job .PENDING ,
190
+ "Queue stopped" ,
191
+ int (pending ["type" ]),
192
+ pending ["format" ],
193
+ pending ["url" ],
194
+ )
195
+ job .id = pending ["id" ]
196
+ self .jobshandler .put ((Actions .RESUME , job ))
228
197
229
198
def join (self ):
230
199
if self .thread is not None :
0 commit comments