<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Library cleared when external drive not connected]]></title><description><![CDATA[<p dir="auto">I have my library on an external SSD.<br />
If I forget to connect it before starting Strawberry, my library is cleared (I have update library at start).<br />
I have to do full a full rescan.<br />
An error message should warn that the specified location is not found and either exit or retry.<br />
Thanks</p>
<p dir="auto">PS: I already posted this elsewhere but got no useful reply</p>
]]></description><link>https://forum.strawberrymusicplayer.org/topic/1767/library-cleared-when-external-drive-not-connected</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 06:01:53 GMT</lastBuildDate><atom:link href="https://forum.strawberrymusicplayer.org/topic/1767.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Jul 2024 10:07:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Library cleared when external drive not connected on Fri, 12 Jul 2024 09:45:01 GMT]]></title><description><![CDATA[<p dir="auto">Hello Gustavo &amp; Jonas,</p>
<p dir="auto">Thank you for looking at this problem.<br />
This is not a major bug preventing me from using Strawberry, but just annoying.<br />
I know how to get round the problem but I am not sure my sister or some of my friends would.<br />
This could deter them from using it.</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/4113</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/4113</guid><dc:creator><![CDATA[bebelalu55]]></dc:creator><pubDate>Fri, 12 Jul 2024 09:45:01 GMT</pubDate></item><item><title><![CDATA[Reply to Library cleared when external drive not connected on Mon, 08 Jul 2024 21:42:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://forum.strawberrymusicplayer.org/uid/2454">@Gustavo-L-Conte</a><br />
I think it would be better to check dirs, not subdirs, I think it should be possible with <code>QStorageInfo</code> to check if it's mounted.<br />
And GUI stuff should never be in CollectionWatcher.<br />
But I'm not a fan of this solution, a popup message seems unnecessary. If you have 2 collection directories, songs for the one missing shouldn't be shown so marking song unavailable like it's already done seem like the best solution, but checking ctime when the songs are found again to avoid any rescan, and perhaps use GIO to detect when the drive is mounted again.</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/4035</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/4035</guid><dc:creator><![CDATA[jonas]]></dc:creator><pubDate>Mon, 08 Jul 2024 21:42:58 GMT</pubDate></item><item><title><![CDATA[Reply to Library cleared when external drive not connected on Mon, 08 Jul 2024 16:03:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://forum.strawberrymusicplayer.org/uid/1">@jonas</a> can you help me finish this? I belive i'm not Exit() properly as we should in the application, i'm doing a pretty forced exit. I''m having problems with the threaded situation also had errors with the painter so I tried to move the message box to the main thread, dunno if this is correct.</p>
<pre><code>void CollectionWatcher::PerformScan(const bool incremental, const bool ignore_mtimes) {

  stop_requested_ = false;

  for (const CollectionDirectory &amp;dir : std::as_const(watched_dirs_)) {

    if (stop_requested_ || abort_requested_) break;

    ScanTransaction transaction(this, dir.id, incremental, ignore_mtimes, mark_songs_unavailable_);
    CollectionSubdirectoryList subdirs(transaction.GetAllSubdirs());

    if (subdirs.isEmpty()) {
      qLog(Debug) &lt;&lt; "Collection directory wasn't in subdir list.";
      CollectionSubdirectory subdir;
      subdir.path = dir.path;
      subdir.directory_id = dir.id;
      subdirs &lt;&lt; subdir;
    }

    QMap&lt;QString, quint64&gt; subdir_files_count;
    quint64 files_count = FilesCountForSubdirs(&amp;transaction, subdirs, subdir_files_count);

    if (!files_count) {
      qLog(Debug) &lt;&lt; "Directory" &lt;&lt; dir.path &lt;&lt; " is empty. Prompting user before continuing.";
      emit CollectionDirectoryIsEmpty(dir.path);
    }

    transaction.AddToProgressMax(files_count);

    for (const CollectionSubdirectory &amp;subdir : std::as_const(subdirs)) {
      if (stop_requested_ || abort_requested_) break;
      ScanSubdirectory(subdir.path, subdir, subdir_files_count[subdir.path], &amp;transaction);
    }

  }

  last_scan_time_ = QDateTime::currentSecsSinceEpoch();

  emit CompilationsNeedUpdating();

}

void CollectionWatcher::CollectionDirectoryIsEmpty(QString directory) {
  // Moved to main thread using QMetaObject
  QMetaObject::invokeMethod(qApp, [directory, this] {
    QMessageBox::StandardButton reply;
    reply = QMessageBox::question(nullptr,
                                     tr("Collection directory is empty!"),
                                     tr("Strawberry could not find any files in directory '%1' of your collection. Check that you have plugged any device properly or connected any remote storage. Continue anyway?")
                                         .arg(directory),
                                     QMessageBox::Abort | QMessageBox::Ok);
    if (reply == QMessageBox::Abort) {
      exit(1);
    }
  });
}
</code></pre>
<p dir="auto">Also the way I did maybe its not even blocking the scan after the "emit"  <img src="https://forum.strawberrymusicplayer.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=faqqna7874c" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title=":(" alt="😞" /></p>
<p dir="auto">edit: Yep, now I can see that I did figured out all wrong where to implement this....</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/4033</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/4033</guid><dc:creator><![CDATA[Gustavo L Conte]]></dc:creator><pubDate>Mon, 08 Jul 2024 16:03:02 GMT</pubDate></item><item><title><![CDATA[Reply to Library cleared when external drive not connected on Mon, 08 Jul 2024 13:36:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://forum.strawberrymusicplayer.org/uid/2454">@Gustavo-L-Conte</a></p>
<p dir="auto">Thanks Gustavo for replying, but I am surprised it looks so complicated to see if a folder is available.<br />
The source folder must be stored somewhere as it can be scanned for changes at start.</p>
<p dir="auto">This my Library backup script in Unix:</p>
<p dir="auto">source="/media/Jean-Luc/JukeBox Master"<br />
test -d "$source"<br />
retval="$?"<br />
if [ "$retval" -ne 0 ]; then<br />
echo "Dossier '$source' non trouvé" (not found)<br />
exit 1<br />
fi</p>
<p dir="auto">I check that it is connected before doing anything.<br />
Surely the same logic can be applied to Strawberry, even in Windows.</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/4032</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/4032</guid><dc:creator><![CDATA[bebelalu55]]></dc:creator><pubDate>Mon, 08 Jul 2024 13:36:44 GMT</pubDate></item><item><title><![CDATA[Reply to Library cleared when external drive not connected on Mon, 08 Jul 2024 12:20:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://forum.strawberrymusicplayer.org/uid/1848">@bebelalu55</a></p>
<p dir="auto">The thing is, we would need "a library of libraries"</p>
<p dir="auto">The way POSIX filesystem's work are different than LABEL names like</p>
<pre><code>C: D: E:
</code></pre>
<p dir="auto">in windows environments. Everything in POSIX is like a File, and a directory can be 1) a directory in the filesystem 2) a mount point, that points to a device or another bind, another filesystem or even a remote storage.<br />
The way Strawberry works is by searching the paths for the files, the Library is a set of paths, not a set of DEVICES;</p>
<p dir="auto">we would need to make a library of DEVICES, so that Strawberry detects this device is not mounted, for what you are asking to work.</p>
<p dir="auto">Another possibility would be to create a "smart test" that if it had several files in the DB but now finds nothing, then prompt the user for plugging something or perphaps make the user choose to abort. Kinda something like that, before rescanning: "Your library seems wiped out, do you want to proceed or abort? Make sure you have plugged any external storage or mounted any remote storage before proceeding."</p>
<p dir="auto">I'm sorry if you tought my message for you was useless, but actually that was a solution for your rescanning problem, anyway.</p>
]]></description><link>https://forum.strawberrymusicplayer.org/post/4031</link><guid isPermaLink="true">https://forum.strawberrymusicplayer.org/post/4031</guid><dc:creator><![CDATA[Gustavo L Conte]]></dc:creator><pubDate>Mon, 08 Jul 2024 12:20:10 GMT</pubDate></item></channel></rss>