MIL << "Trying scheme '" << scheme << "'" << endl;
+ /*
+ ** WARNING: Don't forget to update MediaAccess::downloads(url)
+ ** if you are adding a new url scheme / handler!
+ */
if (scheme == "cd" || scheme == "dvd")
_handler = new MediaCD (url,preferred_attach_point);
else if (scheme == "nfs")
MIL << "Opened: " << *this << endl;
}
+// STATIC
+bool
+MediaAccess::downloads(const Url &url)
+{
+ std::string scheme( url.getScheme());
+ return (scheme == "ftp" || scheme == "http" || scheme == "https");
+}
+
// Type of media if open, otherwise NONE.
std::string
MediaAccess::protocol() const
/**
* Hint if files are downloaded or not.
+ * @return True, if the files are downloaded.
*/
bool downloads() const;
/**
+ * Hint if files will be downloaded when using the
+ * specified media \p url.
+ *
+ * @note This hint is based on the \p url scheme
+ * only and does not imply, that the URL is valid.
+ *
+ * @param url The media URL to check.
+ * @return True, if the files are downloaded.
+ */
+ static
+ bool downloads(const Url &url);
+
+ /**
* Used Protocol if media is opened, otherwise 'unknown'.
**/
std::string protocol() const;
}
// ---------------------------------------------------------------
+ // STATIC
+ bool
+ MediaManager::downloads(const Url &url)
+ {
+ return MediaAccess::downloads( url);
+ }
+
+ // ---------------------------------------------------------------
Url
MediaManager::url(MediaAccessId accessId) const
{
protocol(MediaAccessId accessId) const;
/**
- * Hint if files are downloaded or not.
+ * Hint if files are downloaded or not.
* \param accessId The media access id to query.
* \return True, if provideFile downloads files.
- */
- bool
+ */
+ bool
downloads(MediaAccessId accessId) const;
/**
+ * Hint if files will be downloaded when using the
+ * specified media \p url.
+ *
+ * @note This hint is based on the \p url scheme
+ * only and does not imply, that the URL is valid.
+ *
+ * @param url The media URL to check.
+ * @return True, if the files are downloaded.
+ */
+ static bool
+ downloads(const Url &url);
+
+ /**
* Returns the \ref MediaAccessUrl of the media access id.
*
* \param accessId The media access id to query.