Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[droid] implement basic CAndroidStorageProvider

  • Loading branch information...
commit c5ed57a898fb4a9a493031034d4c0022932e627f 1 parent a8a9bdb
@Montellese Montellese authored Cory Fields committed
View
10 Makefile.in
@@ -108,18 +108,20 @@ DIRECTORY_ARCHIVES += xbmc/powermanagement/osx/powermanagement.a
DIRECTORY_ARCHIVES += xbmc/storage/osx/storage.a
DIRECTORY_ARCHIVES += xbmc/windowing/osx/windowing_osx.a
else
+ifeq (@USE_ANDROID@,1)
DIRECTORY_ARCHIVES += xbmc/input/linux/input_linux.a
DIRECTORY_ARCHIVES += xbmc/network/linux/network_linux.a
-
-ifeq (@USE_ANDROID@,1)
DIRECTORY_ARCHIVES += xbmc/powermanagement/android/powermanagement_android.a
+DIRECTORY_ARCHIVES += xbmc/storage/android/storage_android.a
+DIRECTORY_ARCHIVES += xbmc/windowing/X11/windowing_X11.a
else
+DIRECTORY_ARCHIVES += xbmc/input/linux/input_linux.a
+DIRECTORY_ARCHIVES += xbmc/network/linux/network_linux.a
DIRECTORY_ARCHIVES += xbmc/powermanagement/linux/powermanagement_linux.a
-endif
-
DIRECTORY_ARCHIVES += xbmc/storage/linux/storage_linux.a
DIRECTORY_ARCHIVES += xbmc/windowing/X11/windowing_X11.a
endif
+endif
ifeq ($(findstring freebsd,@ARCH@),freebsd)
DIRECTORY_ARCHIVES += xbmc/freebsd/freebsd.a
View
26 language/English/strings.po
@@ -6793,7 +6793,25 @@ msgid "Downloading artist info failed"
msgstr ""
#string id's 20200 thru 20211 are reserved for speedstrings (LocalizeStrings.cpp)
-#empty strings from id 20200 to 20249
+#empty strings from id 20200 to 20239
+
+msgctxt "#20240"
+msgid "Android music"
+msgstr ""
+
+msgctxt "#20241"
+msgid "Android videos"
+msgstr ""
+
+msgctxt "#20242"
+msgid "Android pictures"
+msgstr ""
+
+msgctxt "#20243"
+msgid "Android photos"
+msgstr ""
+
+#empty strings from id 20244 to 20249
msgctxt "#20250"
msgid "Party on! (videos)"
@@ -7879,7 +7897,11 @@ msgctxt "#21455"
msgid "Cache filled before reaching required amount for continous playback"
msgstr ""
-#empty strings from id 21456 to 21459
+msgctxt "#21456"
+msgid "External storage"
+msgstr ""
+
+#empty strings from id 21457 to 21459
msgctxt "#21460"
msgid "Subtitle location"
View
56 xbmc/dialogs/GUIDialogMediaSource.cpp
@@ -36,6 +36,11 @@
#include "PasswordManager.h"
#include "URL.h"
+#if defined(TARGET_ANDROID)
+#include "android/activity/XBMCApp.h"
+#include "filesystem/File.h"
+#endif
+
using namespace std;
using namespace XFILE;
@@ -221,8 +226,21 @@ void CGUIDialogMediaSource::OnPathBrowse(int item)
m_bNameChanged=true;
if (m_type == "music")
- { // add the music playlist location
+ {
CMediaSource share1;
+#if defined(TARGET_ANDROID)
+ // add the default android music directory
+ std::string path;
+ if (CXBMCApp::GetExternalStorage(path, "music") && !path.empty() && CFile::Exists(path))
+ {
+ share1.strPath = path;
+ share1.strName = g_localizeStrings.Get(20240);
+ share1.m_ignore = true;
+ extraShares.push_back(share1);
+ }
+#endif
+
+ // add the music playlist location
share1.strPath = "special://musicplaylists/";
share1.strName = g_localizeStrings.Get(20011);
share1.m_ignore = true;
@@ -247,8 +265,21 @@ void CGUIDialogMediaSource::OnPathBrowse(int item)
}
}
else if (m_type == "video")
- { // add the music playlist location
+ {
CMediaSource share1;
+#if defined(TARGET_ANDROID)
+ // add the default android video directory
+ std::string path;
+ if (CXBMCApp::GetExternalStorage(path, "videos") && !path.empty() && CFile::Exists(path))
+ {
+ share1.strPath = path;
+ share1.strName = g_localizeStrings.Get(20241);
+ share1.m_ignore = true;
+ extraShares.push_back(share1);
+ }
+#endif
+
+ // add the video playlist location
share1.m_ignore = true;
share1.strPath = "special://videoplaylists/";
share1.strName = g_localizeStrings.Get(20012);
@@ -269,6 +300,27 @@ void CGUIDialogMediaSource::OnPathBrowse(int item)
else if (m_type == "pictures")
{
CMediaSource share1;
+#if defined(TARGET_ANDROID)
+ // add the default android music directory
+ std::string path;
+ if (CXBMCApp::GetExternalStorage(path, "pictures") && !path.empty() && CFile::Exists(path))
+ {
+ share1.strPath = path;
+ share1.strName = g_localizeStrings.Get(20242);
+ share1.m_ignore = true;
+ extraShares.push_back(share1);
+ }
+
+ path.clear();
+ if (CXBMCApp::GetExternalStorage(path, "photos") && !path.empty() && CFile::Exists(path))
+ {
+ share1.strPath = path;
+ share1.strName = g_localizeStrings.Get(20243);
+ share1.m_ignore = true;
+ extraShares.push_back(share1);
+ }
+#endif
+
share1.m_ignore = true;
if (g_guiSettings.GetString("debug.screenshotpath",false)!= "")
{
View
4 xbmc/storage/MediaManager.cpp
@@ -55,6 +55,8 @@
#if defined(TARGET_DARWIN)
#include "osx/DarwinStorageProvider.h"
+#elif defined(TARGET_ANDROID)
+#include "android/AndroidStorageProvider.h"
#elif defined(_LINUX)
#include "linux/LinuxStorageProvider.h"
#elif _WIN32
@@ -88,6 +90,8 @@ void CMediaManager::Initialize()
{
#if defined(TARGET_DARWIN)
m_platformStorage = new CDarwinStorageProvider();
+ #elif defined(TARGET_ANDROID)
+ m_platformStorage = new CAndroidStorageProvider();
#elif defined(_LINUX)
m_platformStorage = new CLinuxStorageProvider();
#elif _WIN32
View
87 xbmc/storage/android/AndroidStorageProvider.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program 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 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "AndroidStorageProvider.h"
+#include "android/activity/XBMCApp.h"
+#include "guilib/LocalizeStrings.h"
+#include "filesystem/File.h"
+
+//#include "utils/RegExp.h"
+//#include "utils/StdString.h"
+//#include "Util.h"
+
+void CAndroidStorageProvider::GetLocalDrives(VECSOURCES &localDrives)
+{
+ CMediaSource share;
+
+ // external directory
+ std::string path;
+ if (CXBMCApp::GetExternalStorage(path) && !path.empty() && XFILE::CFile::Exists(path))
+ {
+ share.strPath = path;
+ share.strName = g_localizeStrings.Get(21456);
+ share.m_ignore = true;
+ localDrives.push_back(share);
+ }
+
+ // root directory
+ share.strPath = "/";
+ share.strName = g_localizeStrings.Get(21453);
+ localDrives.push_back(share);
+}
+
+void CAndroidStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives)
+{
+ // TODO
+}
+
+std::vector<CStdString> CAndroidStorageProvider::GetDiskUsage()
+{
+ std::vector<CStdString> result;
+
+ std::string usage;
+ // add header
+ CXBMCApp::GetStorageUsage("", usage);
+ result.push_back(usage);
+
+ usage.clear();
+ // add rootfs
+ if (CXBMCApp::GetStorageUsage("/", usage) && !usage.empty())
+ result.push_back(usage);
+
+ usage.clear();
+ // add external storage if available
+ std::string path;
+ if (CXBMCApp::GetExternalStorage(path) && !path.empty() &&
+ CXBMCApp::GetStorageUsage(path, usage) && !usage.empty())
+ result.push_back(usage);
+
+ return result;
+}
+
+bool CAndroidStorageProvider::Eject(CStdString mountpath)
+{
+ return false;
+}
+
+bool CAndroidStorageProvider::PumpDriveChangeEvents(IStorageEventsCallback *callback)
+{
+ return false;
+}
View
41 xbmc/storage/android/AndroidStorageProvider.h
@@ -0,0 +1,41 @@
+#pragma once
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program 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 2, or (at your option)
+ * any later version.
+ *
+ * This Program 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 XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "storage/IStorageProvider.h"
+
+class CAndroidStorageProvider : public IStorageProvider
+{
+public:
+ CAndroidStorageProvider() { }
+ virtual ~CAndroidStorageProvider() { }
+
+ virtual void Initialize() { }
+ virtual void Stop() { }
+
+ virtual void GetLocalDrives(VECSOURCES &localDrives);
+ virtual void GetRemovableDrives(VECSOURCES &removableDrives);
+
+ virtual bool Eject(CStdString mountpath);
+
+ virtual std::vector<CStdString> GetDiskUsage();
+
+ virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback);
+};
View
6 xbmc/storage/android/Makefile
@@ -0,0 +1,6 @@
+SRCS=AndroidStorageProvider.cpp
+
+LIB=storage_android.a
+
+include ../../../Makefile.include
+-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
Please sign in to comment.
Something went wrong with that request. Please try again.