sy6sy2 / xbmc

Kodi is an award-winning free and open source home theater/media center software and entertainment hub for digital media. With its beautiful interface and powerful skinning engine, it's available for Android, BSD, Linux, macOS, iOS and Windows.
https://kodi.tv/
Other
6 stars 1 forks source link

Howto: load sources.xml and mediasources.xml at build time #59

Open phunkyfish opened 5 years ago

phunkyfish commented 5 years ago

If you want to preload a sources.xml and mediasources.xml this works:

  1. Create a tvOS folder: xbmc-src/userdata/tvOS
  2. Copy sources.xml and mediasources.xml here
  3. Generate the xcode project and build after applying this patch:
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index a46f06d377..4644e6537b 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -420,10 +420,15 @@ bool CApplication::Create(const CAppParamParser &params)
   CopyUserDataIfNeeded("special://masterprofile/", "Lircmap.xml");

   //! @todo - move to CPlatformXXX
-  #ifdef TARGET_DARWIN_EMBEDDED
+  #ifdef TARGET_DARWIN_IOS
     CopyUserDataIfNeeded("special://masterprofile/", "iOS/sources.xml", "sources.xml");
   #endif

+  #ifdef TARGET_DARWIN_TVOS
+    CopyUserDataIfNeeded("special://masterprofile/", "tvOS/mediasources.xml", "mediasources.xml");
+    CopyUserDataIfNeeded("special://masterprofile/", "tvOS/sources.xml", "sources.xml");
+  #endif
+
   if (!CLog::Init(CSpecialProtocol::TranslatePath("special://logpath").c_str()))
   {
     fprintf(stderr,"Could not init logging classes. Log folder error (%s)\n", CSpecialProtocol::TranslatePath("special://logpath").c_str());
fuzzard commented 5 years ago

Seems odd that this is how ios does it. Shouldnt this be done at build time, rather than in code?

phunkyfish commented 5 years ago

iOS is using a default sources.xml if there is not one. This is a common way to provide default files in kodi.

As userdata is only created on startup I’m not sure how else this would be done.

fuzzard commented 5 years ago

fair enough

phunkyfish commented 5 years ago

But a clean way to do this without needing a patch would be great.

fuzzard commented 5 years ago

May be worthwhile starting up an Apple TV wiki page on the kodi wiki for information that isnt easily put into the single github dev instructions.

https://kodi.wiki/view/Devices

May want to wait until we get ATV in master first before we start slapping bits and pieces into kodi wiki though.

phunkyfish commented 5 years ago

Ya, there lots of info like that. Such as versions pass through works on etc. But as you said after tvOS is merged.