/usr/lib/python3/dist-packages/raphodo/offload.py is in rapid-photo-downloader 0.9.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | #!/usr/bin/env python3
# Copyright (C) 2015-2016 Damon Lynch <damonlynch@gmail.com>
# This file is part of Rapid Photo Downloader.
#
# Rapid Photo Downloader is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Rapid Photo Downloader is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rapid Photo Downloader. If not,
# see <http://www.gnu.org/licenses/>.
__author__ = 'Damon Lynch'
__copyright__ = "Copyright 2015-2016, Damon Lynch"
import pickle
import sys
import logging
import locale
# Use the default locale as defined by the LANG variable
locale.setlocale(locale.LC_ALL, '')
from PyQt5.QtGui import QGuiApplication
from raphodo.interprocess import (DaemonProcess, OffloadData, OffloadResults, DownloadDestination)
from raphodo.proximity import TemporalProximityGroups
from raphodo.viewutils import ThumbnailDataForProximity
from raphodo.folderspreview import FoldersPreview
class OffloadWorker(DaemonProcess):
def __init__(self) -> None:
super().__init__('Offload')
def run(self) -> None:
try:
while True:
directive, content = self.receiver.recv_multipart()
self.check_for_command(directive, content)
data = pickle.loads(content) # type: OffloadData
if data.thumbnail_rows:
groups = TemporalProximityGroups(
thumbnail_rows=data.thumbnail_rows, temporal_span=data.proximity_seconds
)
self.content = pickle.dumps(
OffloadResults(proximity_groups=groups),
pickle.HIGHEST_PROTOCOL
)
self.send_message_to_sink()
else:
assert data.folders_preview
assert data.rpd_files
data.folders_preview.generate_subfolders(
rpd_files=data.rpd_files, strip_characters=data.strip_characters
)
self.content = pickle.dumps(
OffloadResults(folders_preview=data.folders_preview),
pickle.HIGHEST_PROTOCOL
)
self.send_message_to_sink()
except Exception:
logging.error("An unhandled exception occurred while processing offloaded tasks")
logging.exception("Traceback:")
except SystemExit as e:
sys.exit(e)
if __name__ == '__main__':
# Must initialize QGuiApplication to use QFont() and QFontMetrics
app = QGuiApplication(sys.argv)
offload = OffloadWorker()
offload.run()
|