You've already forked photo-importer
mirror of
https://github.com/sashacmc/photo-importer.git
synced 2025-10-06 21:57:04 +02:00
Add Clear button for server import
This commit is contained in:
7
debian/changelog
vendored
7
debian/changelog
vendored
@@ -1,3 +1,10 @@
|
|||||||
|
photo-importer (1.2.6) stable; urgency=medium
|
||||||
|
|
||||||
|
* Add Clear button for server import
|
||||||
|
* Disable log for unmounted devices
|
||||||
|
|
||||||
|
-- Alexander Bushnev <Alexander@Bushnev.pro> Thu, 31 Oct 2024 00:37:55 +0100
|
||||||
|
|
||||||
photo-importer (1.2.5) stable; urgency=medium
|
photo-importer (1.2.5) stable; urgency=medium
|
||||||
|
|
||||||
* Package refactoring
|
* Package refactoring
|
||||||
|
@@ -257,6 +257,9 @@ class PhotoImporterHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
def __import_get_log(self, in_path):
|
def __import_get_log(self, in_path):
|
||||||
return self.server.get_log(in_path)
|
return self.server.get_log(in_path)
|
||||||
|
|
||||||
|
def __import_done(self, in_path):
|
||||||
|
return self.server.import_done(in_path)
|
||||||
|
|
||||||
def __import_request(self, params):
|
def __import_request(self, params):
|
||||||
try:
|
try:
|
||||||
action = params['a'][0]
|
action = params['a'][0]
|
||||||
@@ -281,6 +284,9 @@ class PhotoImporterHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
elif action == 'getlog':
|
elif action == 'getlog':
|
||||||
result = self.__import_get_log(in_path)
|
result = self.__import_get_log(in_path)
|
||||||
self.__text_response(result)
|
self.__text_response(result)
|
||||||
|
elif action == 'done':
|
||||||
|
result = self.__import_done(in_path)
|
||||||
|
self.__ok_response(result)
|
||||||
else:
|
else:
|
||||||
raise HTTPError(HTTPStatus.BAD_REQUEST, f'unknown action {action}')
|
raise HTTPError(HTTPStatus.BAD_REQUEST, f'unknown action {action}')
|
||||||
|
|
||||||
@@ -422,6 +428,7 @@ class PhotoImporterServer(http.server.HTTPServer):
|
|||||||
logging.info('import_done: %s', in_path)
|
logging.info('import_done: %s', in_path)
|
||||||
if in_path in self.__importers:
|
if in_path in self.__importers:
|
||||||
del self.__importers[in_path]
|
del self.__importers[in_path]
|
||||||
|
return ''
|
||||||
|
|
||||||
def get_log(self, in_path):
|
def get_log(self, in_path):
|
||||||
if in_path in self.__importers:
|
if in_path in self.__importers:
|
||||||
|
@@ -54,6 +54,8 @@
|
|||||||
name = ""
|
name = ""
|
||||||
if (state == "mounted" || state == "done") {
|
if (state == "mounted" || state == "done") {
|
||||||
action += "<input onclick=\"sendCommand('start', '" + path + "');\" type=button class=\"btn btn-success btn-sm\" value=\"Import\"/> ";
|
action += "<input onclick=\"sendCommand('start', '" + path + "');\" type=button class=\"btn btn-success btn-sm\" value=\"Import\"/> ";
|
||||||
|
} else if (state == "done" || state == "error") {
|
||||||
|
action = "<input onclick=\"sendCommand('done', '" + path + "');\" type=button class=\"btn btn-primary btn-sm\" value=\"Clear\"/> ";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (state == "mounted") {
|
if (state == "mounted") {
|
||||||
@@ -80,6 +82,10 @@
|
|||||||
if (data[dev].read_only) {
|
if (data[dev].read_only) {
|
||||||
name += "<br/><font size=\"-2\">(read only)<font>"
|
name += "<br/><font size=\"-2\">(read only)<font>"
|
||||||
}
|
}
|
||||||
|
var log = ""
|
||||||
|
if (path != "") {
|
||||||
|
log = "<a href=\"import?a=getlog&p=" + path + "\"><img src=\"log.png\"/></a>"
|
||||||
|
}
|
||||||
html += "<tr>"
|
html += "<tr>"
|
||||||
+ "<td>" + name + "</td>"
|
+ "<td>" + name + "</td>"
|
||||||
+ "<td>" + data[dev].path + "</td>"
|
+ "<td>" + data[dev].path + "</td>"
|
||||||
@@ -87,7 +93,7 @@
|
|||||||
+ "<td>" + action + "</td>"
|
+ "<td>" + action + "</td>"
|
||||||
+ "<td>" + data[dev].size + " GB</td>"
|
+ "<td>" + data[dev].size + " GB</td>"
|
||||||
+ "<td>" + progress(data[dev].usage, "", "bg-info") + "</td>"
|
+ "<td>" + progress(data[dev].usage, "", "bg-info") + "</td>"
|
||||||
+ "<td><a href=\"import?a=getlog&p=" + path + "\"><img src=\"log.png\"/></a></td>"
|
+ "<td>" + log + "</td>"
|
||||||
+ "</tr>"
|
+ "</tr>"
|
||||||
}
|
}
|
||||||
html += "</table>"
|
html += "</table>"
|
||||||
@@ -147,7 +153,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
if (cmd == "start") {
|
if (cmd == "start" || cmd == "done") {
|
||||||
var argpath = "";
|
var argpath = "";
|
||||||
if (g_outpath) {
|
if (g_outpath) {
|
||||||
argpath = "&o=" + g_outpath;
|
argpath = "&o=" + g_outpath;
|
||||||
|
Reference in New Issue
Block a user