summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2025-05-09 08:56:05 +0200
committerArno <arno@disconnect.de>2025-05-09 08:56:05 +0200
commit9276db1f7d466668b5e5a0dd13a05eb3cf328c70 (patch)
tree972e4d816c9fdec99633f95d66d0aed60dac34cf /helper.cpp
parentf18b4201d891aea10a4b38bd923f4c8fc4ee7209 (diff)
downloadSheMov-9276db1f7d466668b5e5a0dd13a05eb3cf328c70.tar.gz
SheMov-9276db1f7d466668b5e5a0dd13a05eb3cf328c70.tar.bz2
SheMov-9276db1f7d466668b5e5a0dd13a05eb3cf328c70.zip
Enhance usb-storage
Make it possible to define more than just one usb storage and store them to the new QSettings item "paths/usball", a QStringList while repurposing the old setting "paths/usb" for writing. When reading, iterate over all entries in usball until the file is found. For writing, or moving files to archive, use paths/usb as target.
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/helper.cpp b/helper.cpp
index a32d137..2f8e3b2 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -142,7 +142,7 @@ namespace Helper {
const QString createUSBPath(const QString &filename, const QString &seriesName, const QString &subtitle, int dvdNo, int seriesNo){
QSettings s;
- QString usbPath = s.value("paths/usb").toString();
+ QStringList allUsbPaths = s.value("paths/usball").toStringList();
QString seriesDir = seriesName;
if(seriesNo > 0){
@@ -151,7 +151,15 @@ namespace Helper {
seriesDir.append(QString(" - %1").arg(subtitle));
}
seriesDir.replace(' ', '.');
- QString retval = QString("%1/DVD_%2/%3/%4").arg(usbPath, QString::number(dvdNo), seriesDir, filename);
+ QString templ = QString("%1/DVD_%2/%3/%4");
+ QString retval;
+ for( const QString &up : std::as_const(allUsbPaths)){
+ retval = templ.arg(up, QString::number(dvdNo), seriesDir, filename);
+ QFileInfo retInfo(retval);
+ if(retInfo.exists()){
+ return retval;
+ }
+ }
return retval;
}