summaryrefslogtreecommitdiff
path: root/raphodo/interprocess.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-02 06:52:34 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-02 06:52:34 +0200
commit513be823a8729f783995bea495273a19cd0d2bbf (patch)
treee0d7e1ffdb1ea25163e84f45108591497d480bee /raphodo/interprocess.py
parentb0583b33e83be9cca6369d980eb82dee3a907c28 (diff)
parentc5fc6c6030d7d9d1b2af3d5165bebed3decd741b (diff)
Updated version 0.9.4 from 'upstream/0.9.4'
with Debian dir 31043f20abb0a924130b658a2ff3b5cbcbf689d9
Diffstat (limited to 'raphodo/interprocess.py')
-rw-r--r--raphodo/interprocess.py42
1 files changed, 29 insertions, 13 deletions
diff --git a/raphodo/interprocess.py b/raphodo/interprocess.py
index 577438d..2b877ef 100644
--- a/raphodo/interprocess.py
+++ b/raphodo/interprocess.py
@@ -28,8 +28,7 @@ import shlex
import time
from collections import deque, namedtuple
from typing import Optional, Set, List, Dict, Sequence, Any, Tuple
-import signal
-import ctypes
+
import psutil
@@ -552,12 +551,15 @@ class LoadBalancer:
sink_port = args.send
logging_port = args.logging
- self.logger_publisher = ProcessLoggerPublisher(context=context,
- name=worker_type,
- notification_port=args.logging)
+ self.logger_publisher = ProcessLoggerPublisher(
+ context=context, name=worker_type, notification_port=args.logging
+ )
- logging.debug("{} load balancer waiting to be notified how many workers to "
- "initialize...".format(worker_type))
+ logging.debug(
+ "{} load balancer waiting to be notified how many workers to initialize...".format(
+ worker_type
+ )
+ )
no_workers = int(reply.recv())
logging.debug("...{} load balancer will use {} workers".format(worker_type, no_workers))
reply.send(str(frontend_port).encode())
@@ -1229,7 +1231,8 @@ class ScanResults:
sample_photo: Optional[Photo]=None,
sample_video: Optional[Video]=None,
problems: Optional[ScanProblems]=None,
- fatal_error: Optional[bool]=None) -> None:
+ fatal_error: Optional[bool]=None,
+ entire_video_required: Optional[bool]=None) -> None:
self.rpd_files = rpd_files
self.file_type_counter = file_type_counter
self.file_size_sum = file_size_sum
@@ -1242,6 +1245,7 @@ class ScanResults:
self.sample_video = sample_video
self.problems = problems
self.fatal_error = fatal_error
+ self.entire_video_required = entire_video_required
class CopyFilesArguments:
@@ -1457,7 +1461,8 @@ class GenerateThumbnailsArguments:
frontend_port: int,
log_gphoto2: bool,
camera: Optional[str]=None,
- port: Optional[str]=None) -> None:
+ port: Optional[str]=None,
+ entire_video_required: Optional[bool]=None) -> None:
"""
List of files for which thumbnails are to be generated.
All files are assumed to have the same scan id.
@@ -1478,6 +1483,8 @@ class GenerateThumbnailsArguments:
camera, this is the name of the camera, else None
:param port: If the thumbnails are being downloaded from a
camera, this is the port of the camera, else None
+ :param entire_video_required: if the entire video is
+ required to extract the thumbnail
"""
self.rpd_files = rpd_files
@@ -1489,9 +1496,11 @@ class GenerateThumbnailsArguments:
self.frontend_port = frontend_port
if camera is not None:
assert port is not None
+ assert entire_video_required is not None
self.camera = camera
self.port = port
self.log_gphoto2 = log_gphoto2
+ self.entire_video_required = entire_video_required
class GenerateThumbnailsResults:
@@ -1617,7 +1626,9 @@ class ScanManager(PublishPullPipelineManager):
Handles the processes that scan devices (cameras, external devices,
this computer path)
"""
- scannedFiles = pyqtSignal('PyQt_PyObject', 'PyQt_PyObject', FileTypeCounter, 'PyQt_PyObject')
+ scannedFiles = pyqtSignal(
+ 'PyQt_PyObject', 'PyQt_PyObject', FileTypeCounter, 'PyQt_PyObject', bool
+ )
deviceError = pyqtSignal(int, CameraErrorCode)
deviceDetails = pyqtSignal(int, 'PyQt_PyObject', 'PyQt_PyObject', str)
scanProblems = pyqtSignal(int, 'PyQt_PyObject')
@@ -1633,8 +1644,14 @@ class ScanManager(PublishPullPipelineManager):
if data.rpd_files is not None:
assert data.file_type_counter
assert data.file_size_sum
- self.scannedFiles.emit(data.rpd_files, (data.sample_photo, data.sample_video),
- data.file_type_counter, data.file_size_sum)
+ assert data.entire_video_required is not None
+ self.scannedFiles.emit(
+ data.rpd_files,
+ (data.sample_photo, data.sample_video),
+ data.file_type_counter,
+ data.file_size_sum,
+ data.entire_video_required
+ )
else:
assert data.scan_id is not None
if data.error_code is not None:
@@ -1651,7 +1668,6 @@ class ScanManager(PublishPullPipelineManager):
self.fatalError.emit(data.scan_id)
-
class BackupManager(PublishPullPipelineManager):
"""
Each backup "device" (it could be an external drive, or a user-