aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Radtke <daniel.radtke@gmail.com>2016-05-08 15:20:28 -0500
committerDaniel <DanTheMan827>2016-07-25 10:34:55 -0500
commit3e2d04ffb4e52118825a1d774e9a03b4d3d8f237 (patch)
treeb6cf355e96acec934f402f0a1afe57a0232995d9
parent527a25154938ee0f430ed60755c1623c00b8904d (diff)
[iOS] Add "Copy to Kodi" functionality
-rw-r--r--userdata/iOS/sources.xml32
-rw-r--r--xbmc/Application.cpp20
-rw-r--r--xbmc/filesystem/SpecialProtocol.cpp7
-rw-r--r--xbmc/filesystem/SpecialProtocol.h2
-rw-r--r--xbmc/platform/darwin/ios/Info.plist.in310
-rw-r--r--xbmc/storage/osx/DarwinStorageProvider.cpp14
-rw-r--r--xbmc/windows/GUIWindowFileManager.cpp8
7 files changed, 389 insertions, 4 deletions
diff --git a/userdata/iOS/sources.xml b/userdata/iOS/sources.xml
new file mode 100644
index 0000000000..db2ff315cb
--- /dev/null
+++ b/userdata/iOS/sources.xml
@@ -0,0 +1,32 @@
+<sources>
+ <programs>
+ <default pathversion="1"></default>
+ </programs>
+ <video>
+ <default pathversion="1"></default>
+ <source>
+ <name>Inbox</name>
+ <path pathversion="1">special://envhome/Documents/Inbox/</path>
+ <allowsharing>true</allowsharing>
+ </source>
+ </video>
+ <music>
+ <default pathversion="1"></default>
+ <source>
+ <name>Inbox</name>
+ <path pathversion="1">special://envhome/Documents/Inbox/</path>
+ <allowsharing>true</allowsharing>
+ </source>
+ </music>
+ <pictures>
+ <default pathversion="1"></default>
+ <source>
+ <name>Inbox</name>
+ <path pathversion="1">special://envhome/Documents/Inbox/</path>
+ <allowsharing>true</allowsharing>
+ </source>
+ </pictures>
+ <files>
+ <default pathversion="1"></default>
+ </files>
+</sources>
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 620f82eb64..0ee6ca27a8 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -387,9 +387,14 @@ extern "C" void __stdcall cleanup_emu_environ();
// Utility function used to copy files from the application bundle
// over to the user data directory in Application Support/Kodi.
//
-static void CopyUserDataIfNeeded(const std::string &strPath, const std::string &file)
+static void CopyUserDataIfNeeded(const std::string &strPath, const std::string &file, const std::string &destname = "")
{
- std::string destPath = URIUtils::AddFileToFolder(strPath, file);
+ std::string destPath;
+ if (destname == "")
+ destPath = URIUtils::AddFileToFolder(strPath, file);
+ else
+ destPath = URIUtils::AddFileToFolder(strPath, destname);
+
if (!CFile::Exists(destPath))
{
// need to copy it across
@@ -469,7 +474,12 @@ bool CApplication::Create()
win32_exception::install_handler();
#endif
-
+
+ #if defined(TARGET_POSIX)
+ // set special://envhome
+ CSpecialProtocol::SetEnvHomePath(getenv("HOME"));
+ #endif
+
// only the InitDirectories* for the current platform should return true
bool inited = InitDirectoriesLinux();
if (!inited)
@@ -481,6 +491,10 @@ bool CApplication::Create()
CopyUserDataIfNeeded("special://masterprofile/", "RssFeeds.xml");
CopyUserDataIfNeeded("special://masterprofile/", "favourites.xml");
CopyUserDataIfNeeded("special://masterprofile/", "Lircmap.xml");
+
+ #ifdef TARGET_DARWIN_IOS
+ CopyUserDataIfNeeded("special://masterprofile/", "iOS/sources.xml", "sources.xml");
+ #endif
if (!CLog::Init(CSpecialProtocol::TranslatePath("special://logpath").c_str()))
{
diff --git a/xbmc/filesystem/SpecialProtocol.cpp b/xbmc/filesystem/SpecialProtocol.cpp
index 80b2581b87..2f7be55381 100644
--- a/xbmc/filesystem/SpecialProtocol.cpp
+++ b/xbmc/filesystem/SpecialProtocol.cpp
@@ -65,6 +65,11 @@ void CSpecialProtocol::SetUserHomePath(const std::string &dir)
SetPath("userhome", dir);
}
+void CSpecialProtocol::SetEnvHomePath(const std::string &dir)
+{
+ SetPath("envhome", dir);
+}
+
void CSpecialProtocol::SetMasterProfilePath(const std::string &dir)
{
SetPath("masterprofile", dir);
@@ -154,6 +159,7 @@ std::string CSpecialProtocol::TranslatePath(const CURL &url)
else if (RootDir == "xbmc" ||
RootDir == "xbmcbin" ||
RootDir == "home" ||
+ RootDir == "envhome" ||
RootDir == "userhome" ||
RootDir == "temp" ||
RootDir == "profile" ||
@@ -247,6 +253,7 @@ void CSpecialProtocol::LogPaths()
CLog::Log(LOGNOTICE, "special://xbmc/ is mapped to: %s", GetPath("xbmc").c_str());
CLog::Log(LOGNOTICE, "special://xbmcbin/ is mapped to: %s", GetPath("xbmcbin").c_str());
CLog::Log(LOGNOTICE, "special://masterprofile/ is mapped to: %s", GetPath("masterprofile").c_str());
+ CLog::Log(LOGNOTICE, "special://envhome/ is mapped to: %s", GetPath("envhome").c_str());
CLog::Log(LOGNOTICE, "special://home/ is mapped to: %s", GetPath("home").c_str());
CLog::Log(LOGNOTICE, "special://temp/ is mapped to: %s", GetPath("temp").c_str());
CLog::Log(LOGNOTICE, "special://logpath/ is mapped to: %s", GetPath("logpath").c_str());
diff --git a/xbmc/filesystem/SpecialProtocol.h b/xbmc/filesystem/SpecialProtocol.h
index 6ba7864938..52b2120c18 100644
--- a/xbmc/filesystem/SpecialProtocol.h
+++ b/xbmc/filesystem/SpecialProtocol.h
@@ -31,6 +31,7 @@
Linux: ~/.kodi/
OS X: ~/Library/Application Support/Kodi/
Win32: ~/Application Data/XBMC/
+ special://envhome/ - on posix systems this will be equal to the $HOME
special://userhome/ - a writable version of the user home directory
Linux, OS X: ~/.kodi
Win32: home directory of user
@@ -58,6 +59,7 @@ public:
static void SetXBMCFrameworksPath(const std::string &path);
static void SetHomePath(const std::string &path);
static void SetUserHomePath(const std::string &path);
+ static void SetEnvHomePath(const std::string &path);
static void SetMasterProfilePath(const std::string &path);
static void SetTempPath(const std::string &path);
static void SetLogPath(const std::string &dir);
diff --git a/xbmc/platform/darwin/ios/Info.plist.in b/xbmc/platform/darwin/ios/Info.plist.in
index 6c4443cf53..557d11285d 100644
--- a/xbmc/platform/darwin/ios/Info.plist.in
+++ b/xbmc/platform/darwin/ios/Info.plist.in
@@ -165,5 +165,315 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>kodi</string>
+ </array>
+ </dict>
+ </array>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeIconFiles</key>
+ <array/>
+ <key>CFBundleTypeName</key>
+ <string>Picture</string>
+ <key>LSItemContentTypes</key>
+ <array>
+ <string>org.xbmc.kodi-ios.picture</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeIconFiles</key>
+ <array/>
+ <key>CFBundleTypeName</key>
+ <string>Music</string>
+ <key>LSItemContentTypes</key>
+ <array>
+ <string>org.xbmc.kodi-ios.music</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeIconFiles</key>
+ <array/>
+ <key>CFBundleTypeName</key>
+ <string>Video</string>
+ <key>LSItemContentTypes</key>
+ <array>
+ <string>org.xbmc.kodi-ios.video</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeIconFiles</key>
+ <array/>
+ <key>CFBundleTypeName</key>
+ <string>Subtitle</string>
+ <key>LSItemContentTypes</key>
+ <array>
+ <string>org.xbmc.kodi-ios.subtitle</string>
+ </array>
+ </dict>
+ </array>
+ <key>UTExportedTypeDeclarations</key>
+ <array>
+ <dict>
+ <key>UTTypeSize320IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeIdentifier</key>
+ <string>org.xbmc.kodi-ios.picture</string>
+ <key>UTTypeSize64IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeConformsTo</key>
+ <array>
+ <string>public.data</string>
+ </array>
+ <key>UTTypeDescription</key>
+ <string>Picture</string>
+ <key>UTTypeTagSpecification</key>
+ <dict>
+ <key>public.filename-extension</key>
+ <array>
+ <string>png</string>
+ <string>jpg</string>
+ <string>jpeg</string>
+ <string>bmp</string>
+ <string>gif</string>
+ <string>ico</string>
+ <string>tif</string>
+ <string>tiff</string>
+ <string>tga</string>
+ <string>pcx</string>
+ <string>cbz</string>
+ <string>zip</string>
+ <string>cbr</string>
+ <string>rar</string>
+ <string>rss</string>
+ <string>webp</string>
+ <string>jp2</string>
+ <string>apng</string>
+ </array>
+ </dict>
+ </dict>
+ <dict>
+ <key>UTTypeSize320IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeIdentifier</key>
+ <string>org.xbmc.kodi-ios.music</string>
+ <key>UTTypeSize64IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeConformsTo</key>
+ <array>
+ <string>public.data</string>
+ </array>
+ <key>UTTypeDescription</key>
+ <string>Music</string>
+ <key>UTTypeTagSpecification</key>
+ <dict>
+ <key>public.filename-extension</key>
+ <array>
+ <string>nsv</string>
+ <string>m4a</string>
+ <string>flac</string>
+ <string>aac</string>
+ <string>strm</string>
+ <string>pls</string>
+ <string>rm</string>
+ <string>rma</string>
+ <string>mpa</string>
+ <string>wav</string>
+ <string>wma</string>
+ <string>ogg</string>
+ <string>mp3</string>
+ <string>mp2</string>
+ <string>m3u</string>
+ <string>gdm</string>
+ <string>imf</string>
+ <string>m15</string>
+ <string>sfx</string>
+ <string>uni</string>
+ <string>ac3</string>
+ <string>dts</string>
+ <string>cue</string>
+ <string>aif</string>
+ <string>aiff</string>
+ <string>wpl</string>
+ <string>ape</string>
+ <string>mac</string>
+ <string>mpc</string>
+ <string>mp+</string>
+ <string>mpp</string>
+ <string>shn</string>
+ <string>zip</string>
+ <string>rar</string>
+ <string>wv</string>
+ <string>dsp</string>
+ <string>xsp</string>
+ <string>xwav</string>
+ <string>waa</string>
+ <string>wvs</string>
+ <string>wam</string>
+ <string>gcm</string>
+ <string>idsp</string>
+ <string>mpdsp</string>
+ <string>mss</string>
+ <string>spt</string>
+ <string>rsd</string>
+ <string>sap</string>
+ <string>cmc</string>
+ <string>cmr</string>
+ <string>dmc</string>
+ <string>mpt</string>
+ <string>mpd</string>
+ <string>rmt</string>
+ <string>tmc</string>
+ <string>tm8</string>
+ <string>tm2</string>
+ <string>oga</string>
+ <string>url</string>
+ <string>pxml</string>
+ <string>tta</string>
+ <string>rss</string>
+ <string>wtv</string>
+ <string>mka</string>
+ <string>tak</string>
+ <string>opus</string>
+ <string>dff</string>
+ <string>dsf</string>
+ </array>
+ </dict>
+ </dict>
+ <dict>
+ <key>UTTypeSize320IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeIdentifier</key>
+ <string>org.xbmc.kodi-ios.video</string>
+ <key>UTTypeSize64IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeConformsTo</key>
+ <array>
+ <string>public.data</string>
+ </array>
+ <key>UTTypeDescription</key>
+ <string>Video</string>
+ <key>UTTypeTagSpecification</key>
+ <dict>
+ <key>public.filename-extension</key>
+ <array>
+ <string>m4v</string>
+ <string>3g2</string>
+ <string>3gp</string>
+ <string>nsv</string>
+ <string>tp</string>
+ <string>ts</string>
+ <string>ty</string>
+ <string>strm</string>
+ <string>pls</string>
+ <string>rm</string>
+ <string>rmvb</string>
+ <string>mpd</string>
+ <string>m3u</string>
+ <string>m3u8</string>
+ <string>ifo</string>
+ <string>mov</string>
+ <string>qt</string>
+ <string>divx</string>
+ <string>xvid</string>
+ <string>bivx</string>
+ <string>vob</string>
+ <string>nrg</string>
+ <string>img</string>
+ <string>iso</string>
+ <string>pva</string>
+ <string>wmv</string>
+ <string>asf</string>
+ <string>asx</string>
+ <string>ogm</string>
+ <string>m2v</string>
+ <string>avi</string>
+ <string>bin</string>
+ <string>dat</string>
+ <string>mpg</string>
+ <string>mpeg</string>
+ <string>mp4</string>
+ <string>mkv</string>
+ <string>mk3d</string>
+ <string>avc</string>
+ <string>vp3</string>
+ <string>svq3</string>
+ <string>nuv</string>
+ <string>viv</string>
+ <string>dv</string>
+ <string>fli</string>
+ <string>flv</string>
+ <string>rar</string>
+ <string>001</string>
+ <string>wpl</string>
+ <string>zip</string>
+ <string>vdr</string>
+ <string>dvr-ms</string>
+ <string>xsp</string>
+ <string>mts</string>
+ <string>m2t</string>
+ <string>m2ts</string>
+ <string>evo</string>
+ <string>ogv</string>
+ <string>sdp</string>
+ <string>avs</string>
+ <string>rec</string>
+ <string>url</string>
+ <string>pxml</string>
+ <string>vc1</string>
+ <string>h264</string>
+ <string>rcv</string>
+ <string>rss</string>
+ <string>mpls</string>
+ <string>webm</string>
+ <string>bdmv</string>
+ <string>wtv</string>
+ </array>
+ </dict>
+ </dict>
+ <dict>
+ <key>UTTypeSize320IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeIdentifier</key>
+ <string>org.xbmc.kodi-ios.subtitle</string>
+ <key>UTTypeSize64IconFile</key>
+ <string>AppIcon60x60</string>
+ <key>UTTypeConformsTo</key>
+ <array>
+ <string>public.data</string>
+ </array>
+ <key>UTTypeDescription</key>
+ <string>Subtitle</string>
+ <key>UTTypeTagSpecification</key>
+ <dict>
+ <key>public.filename-extension</key>
+ <array>
+ <string>utf</string>
+ <string>utf8</string>
+ <string>utf-8</string>
+ <string>sub</string>
+ <string>srt</string>
+ <string>smi</string>
+ <string>rt</string>
+ <string>txt</string>
+ <string>ssa</string>
+ <string>text</string>
+ <string>ssa</string>
+ <string>aqt</string>
+ <string>jss</string>
+ <string>ass</string>
+ <string>idx</string>
+ <string>ifo</string>
+ <string>rar</string>
+ <string>zip</string>
+ </array>
+ </dict>
+ </dict>
+ </array>
</dict>
</plist>
diff --git a/xbmc/storage/osx/DarwinStorageProvider.cpp b/xbmc/storage/osx/DarwinStorageProvider.cpp
index b505f30bca..6d3020f75c 100644
--- a/xbmc/storage/osx/DarwinStorageProvider.cpp
+++ b/xbmc/storage/osx/DarwinStorageProvider.cpp
@@ -45,10 +45,22 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives)
CMediaSource share;
// User home folder
- share.strPath = getenv("HOME");
+ #ifdef TARGET_DARWIN_IOS
+ share.strPath = "special://envhome/";
+ #else
+ share.strPath = getenv("HOME");
+ #endif
share.strName = g_localizeStrings.Get(21440);
share.m_ignore = true;
localDrives.push_back(share);
+
+#if defined(TARGET_DARWIN_IOS)
+ // iOS Inbox folder
+ share.strPath = "special://envhome/Documents/Inbox";
+ share.strName = "Inbox";
+ share.m_ignore = true;
+ localDrives.push_back(share);
+#endif
#if defined(TARGET_DARWIN_OSX)
// User desktop folder
diff --git a/xbmc/windows/GUIWindowFileManager.cpp b/xbmc/windows/GUIWindowFileManager.cpp
index 57a73b7c6e..547507fbfb 100644
--- a/xbmc/windows/GUIWindowFileManager.cpp
+++ b/xbmc/windows/GUIWindowFileManager.cpp
@@ -489,6 +489,14 @@ bool CGUIWindowFileManager::Update(int iList, const std::string &strDirectory)
pItem->SetArt("thumb", "DefaultFolder.png");
pItem->SetLabelPreformated(true);
m_vecItems[iList]->Add(pItem);
+
+ #ifdef TARGET_DARWIN_IOS
+ CFileItemPtr iItem(new CFileItem("special://envhome/Documents/Inbox", true));
+ iItem->SetLabel("Inbox");
+ iItem->SetArt("thumb", "DefaultFolder.png");
+ iItem->SetLabelPreformated(true);
+ m_vecItems[iList]->Add(iItem);
+ #endif
}
// if we have a .tbn file, use itself as the thumb