Skip to content

Commit 69b340d

Browse files
committed
Remove auto update
1 parent dc316a8 commit 69b340d

File tree

7 files changed

+17
-69
lines changed

7 files changed

+17
-69
lines changed

config.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ ydl_server: # youtube-dl-server specific settings
44
debug: False # Enable/Disable debug mode
55
metadata_db_path: '/youtube-dl/.ydl-metadata.db' # Path to metadata DB
66
output_playlist: '/youtube-dl/%(title)s [%(id)s].%(ext)s' # Playlist output directory template
7-
update_poll_delay_min: 1440 # Automatically check for updates every 24h
87
max_log_entries: 100 # Maximum number of job log history to keep
98
forwarded_allow_ips: None # uvicorn Comma seperated list of IPs to trust with proxy headers.
109
proxy_headers: True # uvicorn flag Enable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to populate remote address info.

ydl_server/routes.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
Route("/logs", views.front_logs, name="logs"),
1717
Route("/finished", views.front_finished, name="finished"),
1818
Route("/api/extractors", views.api_list_extractors, name="api_list_extractors"),
19-
Route("/api/youtube-dl/update", views.ydl_update, name="api_update"),
2019
Route("/api/downloads/stats", views.api_queue_size, name="api_queue_size"),
2120
Route("/api/downloads", views.api_logs, name="api_logs"),
2221
Route("/api/downloads/clean", views.api_logs_clean, name="api_logs_clean"),

ydl_server/static/js/youtubedl.js

-4
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,6 @@ function get_download_logs(){
170170
});
171171
}
172172

173-
function ydl_update(){
174-
$.get("api/youtube-dl/update");
175-
}
176-
177173
function hide_logs_detail(){
178174
$('td:nth-child(5),th:nth-child(5)').hide();
179175
}

ydl_server/templates/footer.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<p class="text-muted">
33
Drag and Drop the Bookmarklet to your bookmark bar for easy access: <a id="bookmarklet" class="btn-sm btn-dark" href="">Youtube-DL</a>
44
<br/>
5-
Powered by <a target="_blank" rel="noopener noreferrer" class="text-light" href="{{ ydl_website }}">{{ ydl_name }}</a> version <a href="#" onclick="ydl_update()" data-toggle="tooltip" data-placement="top" title="Update {{ ydl_name }}" class="text-light">{{ ydl_version }}</a>.
5+
Powered by <a target="_blank" rel="noopener noreferrer" class="text-light" href="{{ ydl_website }}">{{ ydl_name }}</a> version {{ ydl_version }}.
66
Code &amp; issues on <a target="_blank" rel="noopener noreferrer" class="text-light" href="https://github.com/nbr23/youtube-dl-server">GitHub</a>.
77
</p>
88
</footer>

ydl_server/views.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ async def api_logs_clean(request):
126126
return JSONResponse({"success": True})
127127

128128

129+
# TODO
130+
async def api_jobs_stop(request):
131+
request.app.state.jobshandler.put((Actions.CLEAN_LOGS, None))
132+
return JSONResponse({"success": True})
133+
134+
129135
async def api_queue_download(request):
130136
data = await request.form()
131-
if (app_config['ydl_server'].get('update_poll_delay_min') and
132-
(datetime.now() - app_config['ydl_last_update']).total_seconds() >
133-
app_config['ydl_server'].get('update_poll_delay_min') * 60):
134-
job = Job("Youtube-dl Auto-Update", Job.PENDING, "", JobType.YDL_UPDATE, None, None)
135-
request.app.state.jobshandler.put((Actions.INSERT, job))
136-
137137
url = data.get("url")
138138
options = {"format": data.get("format")}
139139

@@ -153,13 +153,3 @@ async def api_metadata_fetch(request):
153153
if rc == 0:
154154
return JSONResponse(stdout)
155155
return JSONResponse({}, status_code=404)
156-
157-
158-
async def ydl_update(request):
159-
job = Job("Youtube-dl Manual Update", Job.PENDING, "", JobType.YDL_UPDATE, None, None)
160-
request.app.state.jobshandler.put((Actions.INSERT, job))
161-
return JSONResponse(
162-
{
163-
"success": True,
164-
}
165-
)

ydl_server/ydlhandler.py

+10-41
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,9 @@ def worker(self):
9797
job.status = Job.FAILED
9898
job.log = "Error during download task:\n{}:\n\t{}".format(type(e).__name__, str(e))
9999
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
104100
self.jobshandler.put((Actions.UPDATE, job))
105101
self.queue.task_done()
106102

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-
131103
def get_ydl_options(self, ydl_config, request_options):
132104
ydl_config = ydl_config.copy()
133105
req_format = request_options.get("format")
@@ -212,19 +184,16 @@ def resume_pending(self):
212184
jobs = db.get_all(self.app_config["ydl_server"].get("max_log_entries", 100))
213185
not_endeds = [job for job in jobs if job["status"] == "Pending" or job["status"] == "Running"]
214186
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))
228197

229198
def join(self):
230199
if self.thread is not None:

youtube-dl-server.py

-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from ydl_server.routes import routes
1717

18-
1918
if __name__ == "__main__":
2019

2120
JobsDB.check_db_latest()
@@ -33,10 +32,6 @@
3332
app.state.jobshandler.start(app.state.ydlhandler.queue)
3433
print("Started jobs manager thread")
3534

36-
print("Updating %s to the newest version" % app.state.ydlhandler.ydl_module_name)
37-
job = Job("Youtube-dl at Boot Update", Job.PENDING, "", JobType.YDL_UPDATE, None, None)
38-
app.state.jobshandler.put((Actions.INSERT, job))
39-
4035
app.state.ydlhandler.resume_pending()
4136

4237
uvicorn.run(

0 commit comments

Comments
 (0)