Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crosspoint_reader/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
PREFS.defaults['chunk_size'] = 2048
PREFS.defaults['debug'] = False
PREFS.defaults['fetch_metadata'] = False
PREFS.defaults['send_to_root'] = False


class CrossPointConfigWidget(QWidget):
Expand All @@ -37,20 +38,23 @@ def __init__(self):
self.chunk_size.setRange(512, 65536)
self.debug = QCheckBox('Enable debug logging', self)
self.fetch_metadata = QCheckBox('Fetch metadata (slower device list)', self)
self.send_to_root = QCheckBox('Send to root (ignore folder template)', self)

self.host.setText(PREFS['host'])
self.port.setValue(PREFS['port'])
self.path.setText(PREFS['path'])
self.chunk_size.setValue(PREFS['chunk_size'])
self.debug.setChecked(PREFS['debug'])
self.fetch_metadata.setChecked(PREFS['fetch_metadata'])
self.send_to_root.setChecked(PREFS['send_to_root'])

layout.addRow('Host', self.host)
layout.addRow('Port', self.port)
layout.addRow('Upload path', self.path)
layout.addRow('Chunk size', self.chunk_size)
layout.addRow('', self.debug)
layout.addRow('', self.fetch_metadata)
layout.addRow('', self.send_to_root)

self.log_view = QPlainTextEdit(self)
self.log_view.setReadOnly(True)
Expand All @@ -72,6 +76,7 @@ def save(self):
PREFS['chunk_size'] = int(self.chunk_size.value())
PREFS['debug'] = bool(self.debug.isChecked())
PREFS['fetch_metadata'] = bool(self.fetch_metadata.isChecked())
PREFS['send_to_root'] = bool(self.send_to_root.isChecked())

def _refresh_logs(self):
self.log_view.setPlainText(get_log_text())
Expand Down
4 changes: 2 additions & 2 deletions crosspoint_reader/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CrossPointDevice(DeviceConfig, DevicePlugin):
description = 'CrossPoint Reader wireless device'
supported_platforms = ['windows', 'osx', 'linux']
author = 'CrossPoint Reader'
version = (0, 1, 1)
version = (0, 2, 0)

# Invalid USB vendor info to avoid USB scans matching.
VENDOR_ID = [0xFFFF]
Expand Down Expand Up @@ -302,7 +302,7 @@ def upload_books(self, files, names, on_card=None, end_session=True, metadata=No
filepath = infile
filename = os.path.basename(name)
subdirs = []
if metadata and i < len(metadata):
if metadata and i < len(metadata) and not PREFS['send_to_root']:
subdirs, filename = self._format_upload_path(metadata[i], filename)

if subdirs:
Expand Down