diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | XBMC.xcodeproj/project.pbxproj | 20 | ||||
-rw-r--r-- | configure.in | 6 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/libxml2_d.bat | 15 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/libxml2_d.txt | 2 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/libxslt_d.bat | 15 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/libxslt_d.txt | 2 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj | 8 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj.filters | 6 | ||||
-rw-r--r-- | project/Win32BuildSetup/XBMC for Windows.nsi | 2 | ||||
-rw-r--r-- | tools/darwin/Configurations/App.xcconfig | 2 | ||||
-rw-r--r-- | tools/depends/target/Makefile | 3 | ||||
-rw-r--r-- | tools/depends/target/libxslt/Makefile | 43 | ||||
-rw-r--r-- | xbmc/utils/Makefile.in | 1 | ||||
-rw-r--r-- | xbmc/utils/ScraperParser.cpp | 57 | ||||
-rw-r--r-- | xbmc/utils/ScraperParser.h | 13 | ||||
-rw-r--r-- | xbmc/utils/XSLTUtils.cpp | 120 | ||||
-rw-r--r-- | xbmc/utils/XSLTUtils.h | 62 | ||||
-rw-r--r-- | xbmc/win32/Win32DelayedDllLoad.cpp | 6 |
19 files changed, 372 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore index eceeef5550..de09c1fd53 100644 --- a/.gitignore +++ b/.gitignore @@ -393,6 +393,8 @@ lib/cmyth/Makefile /system/libnfs.dll /system/dnssd.dll /system/libcec.dll +/system/pthreadVC2.dll +/system/libxslt.dll # /system/cdrip /system/cdrip/lame_enc.dll diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index 1c56587002..a0362d2457 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -371,6 +371,9 @@ 889B4D8E0E0EF86C00FAD25E /* RSSDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 889B4D8C0E0EF86C00FAD25E /* RSSDirectory.cpp */; }; 88ACB01B0DCF40800083CFDF /* ASAPFileDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 88ACB0190DCF40800083CFDF /* ASAPFileDirectory.cpp */; }; 88ACB01F0DCF409E0083CFDF /* ASAPCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 88ACB01C0DCF409E0083CFDF /* ASAPCodec.cpp */; }; + AE32174218313ADF0003FAFC /* XSLTUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE4E87A517354C4A00D15206 /* XSLTUtils.cpp */; }; + AE32174318313AE10003FAFC /* XSLTUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE4E87A517354C4A00D15206 /* XSLTUtils.cpp */; }; + AE4E87A717354C4A00D15206 /* XSLTUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE4E87A517354C4A00D15206 /* XSLTUtils.cpp */; }; AE84CB5A15A5B8A600A3810E /* TagLibVFSStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE84CB5915A5B8A600A3810E /* TagLibVFSStream.cpp */; }; AE89ACA61621DAB800E17DBC /* DVDDemuxBXA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE89ACA41621DAB800E17DBC /* DVDDemuxBXA.cpp */; }; AEC0083115ACAC6E0099888C /* TagLoaderTagLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AEC0083015ACAC6E0099888C /* TagLoaderTagLib.cpp */; }; @@ -3899,6 +3902,8 @@ 88ACB01E0DCF409E0083CFDF /* DllASAP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DllASAP.h; sourceTree = "<group>"; }; 88ECB6580DE013C4003396A7 /* DiskArbitration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiskArbitration.framework; path = /System/Library/Frameworks/DiskArbitration.framework; sourceTree = "<absolute>"; }; 8DD76F7E0486A8DE00D96B5E /* XBMC */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = XBMC; sourceTree = BUILT_PRODUCTS_DIR; }; + AE4E87A517354C4A00D15206 /* XSLTUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTUtils.cpp; sourceTree = "<group>"; }; + AE4E87A617354C4A00D15206 /* XSLTUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSLTUtils.h; sourceTree = "<group>"; }; AE84CB5915A5B8A600A3810E /* TagLibVFSStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagLibVFSStream.cpp; sourceTree = "<group>"; }; AE84CB5C15A5B8BA00A3810E /* TagLibVFSStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagLibVFSStream.h; sourceTree = "<group>"; }; AE89ACA41621DAB800E17DBC /* DVDDemuxBXA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDDemuxBXA.cpp; sourceTree = "<group>"; }; @@ -8813,6 +8818,8 @@ E38E1E920D25F9FD00618676 /* WindowsShortcut.h */, F5ED908615538DCE00842059 /* XBMCTinyXML.cpp */, F5ED908715538DCE00842059 /* XBMCTinyXML.h */, + AE4E87A517354C4A00D15206 /* XSLTUtils.cpp */, + AE4E87A617354C4A00D15206 /* XSLTUtils.h */, 18B7C9811294385F009E7A26 /* XMLUtils.cpp */, 18B7C9821294385F009E7A26 /* XMLUtils.h */, ); @@ -10743,6 +10750,7 @@ 7C1409A4183224B8009F9411 /* SettingUpdate.cpp in Sources */, DF0ABB73183A94A30018445D /* Utf8Utils.cpp in Sources */, 7C1409A9184015C9009F9411 /* InfoExpression.cpp in Sources */, + AE32174218313ADF0003FAFC /* XSLTUtils.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11785,6 +11793,7 @@ 7C1409A6183224B8009F9411 /* SettingUpdate.cpp in Sources */, DF0ABB75183A94A30018445D /* Utf8Utils.cpp in Sources */, 7C1409AB184015C9009F9411 /* InfoExpression.cpp in Sources */, + AE32174318313AE10003FAFC /* XSLTUtils.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -12829,6 +12838,7 @@ 7C1409A5183224B8009F9411 /* SettingUpdate.cpp in Sources */, DF0ABB74183A94A30018445D /* Utf8Utils.cpp in Sources */, 7C1409AA184015C9009F9411 /* InfoExpression.cpp in Sources */, + AE4E87A717354C4A00D15206 /* XSLTUtils.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -12911,6 +12921,7 @@ $XBMC_DEPENDS/include/mysql, $XBMC_DEPENDS/include/freetype2, $XBMC_DEPENDS/include/python2.6, + $XBMC_DEPENDS/include/libxml2, ); INFOPLIST_FILE = $SRCROOT/xbmc/osx/Info.plist; INSTALL_PATH = /usr/local/bin; @@ -12983,6 +12994,8 @@ "-ltag", "-L$XBMC_DEPENDS/lib/mysql", "-lmysqlclient", + "-lxml2", + "-lxslt", ); PRODUCT_NAME = XBMC; USE_HEADERMAP = NO; @@ -13043,6 +13056,7 @@ $XBMC_DEPENDS/include/mysql, $XBMC_DEPENDS/include/freetype2, $XBMC_DEPENDS/include/python2.6, + $XBMC_DEPENDS/include/libxml2, ); INFOPLIST_FILE = $SRCROOT/xbmc/osx/Info.plist; INSTALL_PATH = /usr/local/bin; @@ -13115,6 +13129,8 @@ "-ltag", "-L$XBMC_DEPENDS/lib/mysql", "-lmysqlclient", + "-lxml2", + "-lxslt", ); PRODUCT_NAME = XBMC; USE_HEADERMAP = NO; @@ -13210,6 +13226,7 @@ $XBMC_DEPENDS/include/mysql, $XBMC_DEPENDS/include/freetype2, $XBMC_DEPENDS/include/python2.6, + $XBMC_DEPENDS/include/libxml2, ); INFOPLIST_FILE = "$SRCROOT/xbmc/osx/atv2/XBMCATV2-Info.plist"; INSTALL_PATH = "$(HOME)/Library/Bundles"; @@ -13323,6 +13340,7 @@ $XBMC_DEPENDS/include/mysql, $XBMC_DEPENDS/include/freetype2, $XBMC_DEPENDS/include/python2.6, + $XBMC_DEPENDS/include/libxml2, ); INFOPLIST_FILE = "$SRCROOT/xbmc/osx/atv2/XBMCATV2-Info.plist"; INSTALL_PATH = "$(HOME)/Library/Bundles"; @@ -13436,6 +13454,7 @@ $XBMC_DEPENDS/include/mysql, $XBMC_DEPENDS/include/freetype2, $XBMC_DEPENDS/include/python2.6, + $XBMC_DEPENDS/include/libxml2, ); INFOPLIST_FILE = "$SRCROOT/xbmc/osx/ios/XBMCIOS-Info.plist"; INSTALL_PATH = "$(HOME)/Library/Bundles"; @@ -13476,6 +13495,7 @@ $XBMC_DEPENDS/include/mysql, $XBMC_DEPENDS/include/freetype2, $XBMC_DEPENDS/include/python2.6, + $XBMC_DEPENDS/include/libxml2, ); INFOPLIST_FILE = "xbmc/osx/ios/XBMCIOS-Info.plist"; SDKROOT = iphoneos; diff --git a/configure.in b/configure.in index f602df5fa7..f277cacf9d 100644 --- a/configure.in +++ b/configure.in @@ -1137,6 +1137,12 @@ if test "$target_platform" = "target_android" ; then AC_CHECK_LIB([log], [__android_log_vprint],, AC_MSG_ERROR($missing_library)) AC_CHECK_LIB([jnigraphics], [main],, AC_MSG_ERROR($missing_library)) fi +PKG_CHECK_MODULES([LIBXML], [libxml-2.0], + [INCLUDES="$INCLUDES $LIBXML_CFLAGS"; LIBS="$LIBS $LIBXML_LIBS"], + AC_MSG_ERROR($missing_library)) +PKG_CHECK_MODULES([LIBXSLT], [libxslt], + [INCLUDES="$INCLUDES $LIBXSLT_CFLAGS"; LIBS="$LIBS $LIBXSLT_LIBS"], + AC_MSG_ERROR($missing_library)) PKG_CHECK_MODULES([FRIBIDI], [fribidi], [INCLUDES="$INCLUDES $FRIBIDI_CFLAGS"; LIBS="$LIBS $FRIBIDI_LIBS"], AC_MSG_ERROR($missing_library)) diff --git a/project/BuildDependencies/scripts/libxml2_d.bat b/project/BuildDependencies/scripts/libxml2_d.bat new file mode 100644 index 0000000000..54605254ff --- /dev/null +++ b/project/BuildDependencies/scripts/libxml2_d.bat @@ -0,0 +1,15 @@ +@ECHO ON +rem libxml2 is needed by libxslt + +SET LOC_PATH=%CD% +SET FILES=%LOC_PATH%\libxml2_d.txt + +CALL dlextract.bat libxml2 %FILES% + +cd %TMP_PATH% + +echo readme.txt > libxml2_exclude.txt + +xcopy libxml2-2.7.8-win32\* "%XBMC_PATH%\" /E /Q /I /Y /EXCLUDE:libxml2_exclude.txt + +cd %LOC_PATH% diff --git a/project/BuildDependencies/scripts/libxml2_d.txt b/project/BuildDependencies/scripts/libxml2_d.txt new file mode 100644 index 0000000000..ab83b9d1ae --- /dev/null +++ b/project/BuildDependencies/scripts/libxml2_d.txt @@ -0,0 +1,2 @@ +; filename source of the file +libxml2-2.7.8-win32.7z http://mirrors.xbmc.org/build-deps/win32/ diff --git a/project/BuildDependencies/scripts/libxslt_d.bat b/project/BuildDependencies/scripts/libxslt_d.bat new file mode 100644 index 0000000000..f61128b61a --- /dev/null +++ b/project/BuildDependencies/scripts/libxslt_d.bat @@ -0,0 +1,15 @@ +@ECHO OFF +rem libxslt depends on libxml2 + +SET LOC_PATH=%CD% +SET FILES=%LOC_PATH%\libxslt_d.txt + +CALL dlextract.bat libxslt %FILES% + +cd %TMP_PATH% + +echo readme.txt > libxslt_exclude.txt + +xcopy libxslt-1.1.26-win32\* "%XBMC_PATH%\" /E /Q /I /Y /EXCLUDE:libxslt_exclude.txt + +cd %LOC_PATH% diff --git a/project/BuildDependencies/scripts/libxslt_d.txt b/project/BuildDependencies/scripts/libxslt_d.txt new file mode 100644 index 0000000000..df6eb163da --- /dev/null +++ b/project/BuildDependencies/scripts/libxslt_d.txt @@ -0,0 +1,2 @@ +; filename mirror of the file +libxslt-1.1.26-win32.7z http://mirrors.xbmc.org/build-deps/win32/
\ No newline at end of file diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 3d3b73fae5..e655f7bb44 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -158,7 +158,7 @@ <IgnoreSpecificDefaultLibraries>libc;msvcrt;libcmt;msvcrtd;msvcprtd;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <ModuleDefinitionFile> </ModuleDefinitionFile> - <DelayLoadDLLs>dnssd.dll;dwmapi.dll;libmicrohttpd-5.dll;ssh.dll;sqlite3.dll;libsamplerate-0.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>libxslt.dll;dnssd.dll;dwmapi.dll;libmicrohttpd-5.dll;ssh.dll;sqlite3.dll;libsamplerate-0.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <ProgramDatabaseFile>$(OutDir)XBMC.pdb</ProgramDatabaseFile> <EntryPointSymbol> </EntryPointSymbol> @@ -190,7 +190,7 @@ <IgnoreSpecificDefaultLibraries>libc;msvcrt;libcmt;msvcrtd;msvcprtd;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <ModuleDefinitionFile> </ModuleDefinitionFile> - <DelayLoadDLLs>dnssd.dll;dwmapi.dll;libmicrohttpd-5.dll;ssh.dll;sqlite3.dll;libsamplerate-0.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>libxslt.dll;dnssd.dll;dwmapi.dll;libmicrohttpd-5.dll;ssh.dll;sqlite3.dll;libsamplerate-0.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <ProgramDatabaseFile>$(OutDir)XBMC.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> <EntryPointSymbol> @@ -220,7 +220,7 @@ <AdditionalDependencies>D3dx9.lib;DInput8.lib;DSound.lib;winmm.lib;Mpr.lib;Iphlpapi.lib;PowrProf.lib;setupapi.lib;dwmapi.lib;yajl.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies> <OutputFile>$(OutDir)XBMC.exe</OutputFile> <IgnoreSpecificDefaultLibraries>libc;msvcrt;libci;msvcprt;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> - <DelayLoadDLLs>dnssd.dll;dwmapi.dll;libmicrohttpd-5.dll;ssh.dll;sqlite3.dll;libsamplerate-0.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <DelayLoadDLLs>libxslt.dll;dnssd.dll;dwmapi.dll;libmicrohttpd-5.dll;ssh.dll;sqlite3.dll;libsamplerate-0.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)XBMC.pdb</ProgramDatabaseFile> <RandomizedBaseAddress>true</RandomizedBaseAddress> @@ -1133,6 +1133,7 @@ <ClInclude Include="..\..\xbmc\utils\Utf8Utils.h" /> <ClInclude Include="..\..\xbmc\utils\uXstrings.h" /> <ClInclude Include="..\..\xbmc\utils\Vector.h" /> + <ClInclude Include="..\..\xbmc\utils\XSLTUtils.h" /> <ClInclude Include="..\..\xbmc\video\FFmpegVideoDecoder.h" /> <ClInclude Include="..\..\xbmc\interfaces\python\swig.h" /> <ClInclude Include="..\..\xbmc\interfaces\python\XBPython.h" /> @@ -1284,6 +1285,7 @@ </ClCompile> <ClCompile Include="..\..\xbmc\utils\Utf8Utils.cpp" /> <ClCompile Include="..\..\xbmc\utils\Vector.cpp" /> + <ClCompile Include="..\..\xbmc\utils\XSLTUtils.cpp" /> <ClCompile Include="..\..\xbmc\video\PlayerController.cpp" /> <ClCompile Include="..\..\xbmc\video\VideoThumbLoader.cpp" /> <ClCompile Include="..\..\xbmc\music\MusicThumbLoader.cpp" /> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index 007ffb99f5..c4d6cfcfbb 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -3110,6 +3110,9 @@ <ClCompile Include="..\..\xbmc\utils\Utf8Utils.cpp"> <Filter>utils</Filter> </ClCompile> + <ClCompile Include="..\..\xbmc\utils\XSLTUtils.cpp"> + <Filter>utils</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\xbmc\win32\pch.h"> @@ -6112,6 +6115,9 @@ <ClInclude Include="..\..\xbmc\utils\Utf8Utils.h"> <Filter>utils</Filter> </ClInclude> + <ClInclude Include="..\..\xbmc\utils\XSLTUtils.h"> + <Filter>utils</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc"> diff --git a/project/Win32BuildSetup/XBMC for Windows.nsi b/project/Win32BuildSetup/XBMC for Windows.nsi index d20c206e55..94358ecb43 100644 --- a/project/Win32BuildSetup/XBMC for Windows.nsi +++ b/project/Win32BuildSetup/XBMC for Windows.nsi @@ -259,6 +259,8 @@ Section "Uninstall" Delete "$INSTDIR\python27.dll" Delete "$INSTDIR\libcdio-*.dll" Delete "$INSTDIR\libiconv-2.dll" + Delete "$INSTDIR\libxml2.dll" + Delete "$INSTDIR\iconv.dll" RMDir /r "$INSTDIR\language" RMDir /r "$INSTDIR\media" RMDir /r "$INSTDIR\plugins" diff --git a/tools/darwin/Configurations/App.xcconfig b/tools/darwin/Configurations/App.xcconfig index e721298c5a..dc4735e31c 100644 --- a/tools/darwin/Configurations/App.xcconfig +++ b/tools/darwin/Configurations/App.xcconfig @@ -25,6 +25,6 @@ HEADER_SEARCH_PATHS = $(inherited) $SRCROOT xbmc xbmc/linux xbmc/osx xbmc/cores/ LIBRARY_SEARCH_PATHS = $(inherited) $(SRCROOT) $(SRCROOT)/lib/libRTV $(SRCROOT)/lib/libXDAAP $(SRCROOT)/lib/cmyth/libcmyth $(SRCROOT)/lib/cmyth/librefmem $(SRCROOT)/lib/libsquish $(SRCROOT)/lib/SlingboxLib $(SRCROOT)/xbmc/interfaces/json-rpc "$(SRCROOT)/lib/ffmpeg/libavcodec" "$(SRCROOT)/lib/ffmpeg/libavutil" "$(SRCROOT)/lib/ffmpeg/libavformat" "$(SRCROOT)/lib/ffmpeg/libavfilter" "$(SRCROOT)/lib/ffmpeg/libavdevice" "$(SRCROOT)/lib/ffmpeg/libswresample" "$(SRCROOT)/lib/ffmpeg/libpostproc" "$(SRCROOT)/lib/ffmpeg/libswscale" "$(SRCROOT)/xbmc/interfaces/python" "$(SRCROOT)/xbmc/interfaces/legacy" FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SDKROOT)/System/Library/PrivateFrameworks/" "$(SDKROOT)/System/Library/Frameworks/" -XBMC_OTHER_LDFLAGS_COMMON = $(inherited) -Wl,-headerpad_max_install_names -Wl,-all_load -L$XBMC_DEPENDS/lib -lbz2 -lintl -lexpat -lssl -lgpg-error -lresolv -lffi -lssh -llzo2 -lpcre -lpcrecpp -lfribidi -lfreetype -lfontconfig -lsqlite3 -lsamplerate -ltinyxml -lmicrohttpd -lsmbclient -lpython2.6 -lyajl -ljpeg -lcrypto -lgcrypt -lavdevice -lavfilter -lavcodec -lavformat -lpostproc -lavutil -lswresample -lswscale -ltag -L$XBMC_DEPENDS/lib/mysql -lmysqlclient +XBMC_OTHER_LDFLAGS_COMMON = $(inherited) -Wl,-headerpad_max_install_names -Wl,-all_load -L$XBMC_DEPENDS/lib -lbz2 -lintl -lexpat -lssl -lgpg-error -lresolv -lffi -lssh -llzo2 -lpcre -lpcrecpp -lfribidi -lfreetype -lfontconfig -lsqlite3 -lsamplerate -ltinyxml -lmicrohttpd -lsmbclient -lpython2.6 -lyajl -ljpeg -lcrypto -lgcrypt -lavdevice -lavfilter -lavcodec -lavformat -lpostproc -lavutil -lswresample -lswscale -ltag -L$XBMC_DEPENDS/lib/mysql -lmysqlclient -lxml2 -lxslt diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile index 330434da24..725de9fb06 100644 --- a/tools/depends/target/Makefile +++ b/tools/depends/target/Makefile @@ -15,7 +15,7 @@ DEPENDS = \ python26 afpfs-ng libshairplay \ libplist libcec libbluray boost tinyxml dummy-libxbmc \ libamplayer libssh taglib xbmc-pvr-addons libusb libnfs libmp3lame \ - pythonmodule-pil + pythonmodule-pil libxslt ifeq ($(ENABLE_GPLV3),1) DEPENDS+=samba-gplv3 libcdio-gplv3 @@ -95,6 +95,7 @@ gnutls: nettle $(ZLIB) nettle: gmp pythonmodule-pil: $(ZLIB) libjpeg-turbo libpng freetype2 python26 libsdl: $(LINUX_SYSTEM_LIBS) +libxslt: libgcrypt .installed-$(PLATFORM): $(DEPENDS) touch $@ diff --git a/tools/depends/target/libxslt/Makefile b/tools/depends/target/libxslt/Makefile new file mode 100644 index 0000000000..ad2882d136 --- /dev/null +++ b/tools/depends/target/libxslt/Makefile @@ -0,0 +1,43 @@ +include ../../Makefile.include +DEPS= ../../Makefile.include Makefile + +# lib name, version +LIBNAME=libxslt +VERSION=1.1.28 +SOURCE=$(LIBNAME)-$(VERSION) +ARCHIVE=$(SOURCE).tar.gz + +# configuration settings +CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \ + ./configure --prefix=$(PREFIX) --without-python --disable-shared --with-debug --with-debugger --with-mem-debug + +LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a + +CLEAN_FILES=$(ARCHIVE) $(PLATFORM) + +all: .installed-$(PLATFORM) + +$(TARBALLS_LOCATION)/$(ARCHIVE): + cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE) + +$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM) + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + sed -ie "s|runtest$$(EXEEXT)||" "$(PLATFORM)/Makefile.in" + sed -ie "s|testrecurse$$(EXEEXT)||" "$(PLATFORM)/Makefile.in" + cd $(PLATFORM); $(CONFIGURE) + +$(LIBDYLIB): $(PLATFORM) + $(MAKE) -C $(PLATFORM) + +.installed-$(PLATFORM): $(LIBDYLIB) + $(MAKE) -C $(PLATFORM) install + touch $@ + +clean: + $(MAKE) -C $(PLATFORM) clean + rm -f .installed-$(PLATFORM) + +distclean:: + rm -rf $(PLATFORM) .installed-$(PLATFORM) + diff --git a/xbmc/utils/Makefile.in b/xbmc/utils/Makefile.in index 851358ef20..cd308195f1 100644 --- a/xbmc/utils/Makefile.in +++ b/xbmc/utils/Makefile.in @@ -73,6 +73,7 @@ SRCS += Weather.cpp SRCS += XBMCTinyXML.cpp SRCS += XMLUtils.cpp SRCS += Utf8Utils.cpp +SRCS += XSLTUtils.cpp SRCS += ActorProtocol.cpp ifeq (@USE_OPENGLES@,1) diff --git a/xbmc/utils/ScraperParser.cpp b/xbmc/utils/ScraperParser.cpp index 941e9ed69e..79a7acb52d 100644 --- a/xbmc/utils/ScraperParser.cpp +++ b/xbmc/utils/ScraperParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2013 Team XBMC + * Copyright (C) 2012-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify @@ -30,7 +30,7 @@ #include "log.h" #include "CharsetConverter.h" #include "utils/StringUtils.h" - +#include "utils/XSLTUtils.h" #include <sstream> #include <cstring> @@ -338,12 +338,51 @@ void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, } } +void CScraperParser::ParseXSLT(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend) +{ + TiXmlElement* pSheet = element->FirstChildElement(); + if (pSheet) + { + XSLTUtils xsltUtils; + CStdString strXslt; + strXslt << *pSheet; + + if (!xsltUtils.SetInput(input)) + CLog::Log(LOGDEBUG, "could not parse input XML"); + + if (!xsltUtils.SetStylesheet(strXslt)) + CLog::Log(LOGDEBUG, "could not parse stylesheet XML"); + + xsltUtils.XSLTTransform(dest); + } +} + +TiXmlElement *FirstChildScraperElement(TiXmlElement *element) +{ + for (TiXmlElement *child = element->FirstChildElement(); child; child = child->NextSiblingElement()) + { + if (child->ValueStr() == "RegExp" || child->ValueStr() == "XSLT") + return child; + } + return NULL; +} + +TiXmlElement *NextSiblingScraperElement(TiXmlElement *element) +{ + for (TiXmlElement *next = element->NextSiblingElement(); next; next = next->NextSiblingElement()) + { + if (next->ValueStr() == "RegExp" || next->ValueStr() == "XSLT") + return next; + } + return NULL; +} + void CScraperParser::ParseNext(TiXmlElement* element) { TiXmlElement* pReg = element; while (pReg) { - TiXmlElement* pChildReg = pReg->FirstChildElement("RegExp"); + TiXmlElement* pChildReg = FirstChildScraperElement(pReg); if (pChildReg) ParseNext(pChildReg); else @@ -394,13 +433,17 @@ void CScraperParser::ParseNext(TiXmlElement* element) if (bExecute) { if (iDest-1 < MAX_SCRAPER_BUFFERS && iDest-1 > -1) - ParseExpression(strInput, m_param[iDest-1],pReg,bAppend); + { + if (pReg->ValueStr() == "XSLT") + ParseXSLT(strInput, m_param[iDest - 1], pReg, bAppend); + else + ParseExpression(strInput, m_param[iDest - 1],pReg,bAppend); + } else CLog::Log(LOGERROR,"CScraperParser::ParseNext: destination buffer " "out of bounds, skipping expression"); } - - pReg = pReg->NextSiblingElement("RegExp"); + pReg = NextSiblingScraperElement(pReg); } } @@ -415,7 +458,7 @@ const CStdString CScraperParser::Parse(const CStdString& strTag, } int iResult = 1; // default to param 1 pChildElement->QueryIntAttribute("dest",&iResult); - TiXmlElement* pChildStart = pChildElement->FirstChildElement("RegExp"); + TiXmlElement* pChildStart = FirstChildScraperElement(pChildElement); m_scraper = scraper; ParseNext(pChildStart); CStdString tmp = m_param[iResult-1]; diff --git a/xbmc/utils/ScraperParser.h b/xbmc/utils/ScraperParser.h index 9e224e14a9..5cf534e93d 100644 --- a/xbmc/utils/ScraperParser.h +++ b/xbmc/utils/ScraperParser.h @@ -2,7 +2,7 @@ #define SCRAPER_PARSER_H /* - * Copyright (C) 2005-2013 Team XBMC + * Copyright (C) 2012-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify @@ -62,6 +62,17 @@ private: bool LoadFromXML(); void ReplaceBuffers(CStdString& strDest); void ParseExpression(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend); + + /*! \brief Parse an 'XSLT' declaration from the scraper + This allow us to transform an inbound XML document using XSLT + to a different type of XML document, ready to be output direct + to the album loaders or similar + \param input the input document + \param dest the output destation for the conversion + \param element the current XML element + \param bAppend append or clear the buffer + */ + void ParseXSLT(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend); void ParseNext(TiXmlElement* element); void Clean(CStdString& strDirty); void ConvertJSON(CStdString &string); diff --git a/xbmc/utils/XSLTUtils.cpp b/xbmc/utils/XSLTUtils.cpp new file mode 100644 index 0000000000..61b0e9d3dd --- /dev/null +++ b/xbmc/utils/XSLTUtils.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2005-2013 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 "XSLTUtils.h" +#include "log.h" +#include <libxslt/xslt.h> +#include <libxslt/transform.h> + +#ifdef TARGET_WINDOWS +#pragma comment(lib, "libxslt.lib") +#pragma comment(lib, "libxml2.lib") +#else +#include <iostream> +#endif + +#define TMP_BUF_SIZE 512 +void err(void *ctx, const char *msg, ...) { + char string[TMP_BUF_SIZE]; + va_list arg_ptr; + va_start(arg_ptr, msg); + vsnprintf(string, TMP_BUF_SIZE, msg, arg_ptr); + va_end(arg_ptr); + CLog::Log(LOGDEBUG, "XSLT: %s", string); + return; +} + +XSLTUtils::XSLTUtils() : +m_xmlInput(NULL), m_xmlStylesheet(NULL), m_xsltStylesheet(NULL) +{ + // initialize libxslt + xmlSubstituteEntitiesDefault(1); + xmlLoadExtDtdDefaultValue = 0; + xsltSetGenericErrorFunc(NULL, err); +} + +XSLTUtils::~XSLTUtils() +{ + if (m_xmlInput) + xmlFreeDoc(m_xmlInput); + if (m_xmlOutput) + xmlFreeDoc(m_xmlOutput); + if (m_xsltStylesheet) + xsltFreeStylesheet(m_xsltStylesheet); +} + +bool XSLTUtils::XSLTTransform(std::string& output) +{ + const char *params[16+1]; + params[0] = NULL; + m_xmlOutput = xsltApplyStylesheet(m_xsltStylesheet, m_xmlInput, params); + if (!m_xmlOutput) + { + CLog::Log(LOGDEBUG, "XSLT: xslt transformation failed"); + return false; + } + + xmlChar *xmlResultBuffer = NULL; + int xmlResultLength = 0; + int res = xsltSaveResultToString(&xmlResultBuffer, &xmlResultLength, m_xmlOutput, m_xsltStylesheet); + if (res == -1) + { + xmlFree(xmlResultBuffer); + return false; + } + + output.append((const char *)xmlResultBuffer, xmlResultLength); + xmlFree(xmlResultBuffer); + + return true; +} + +bool XSLTUtils::SetInput(const std::string& input) +{ + m_xmlInput = xmlParseMemory(input.c_str(), input.size()); + if (!m_xmlInput) + return false; + return true; +} + +bool XSLTUtils::SetStylesheet(const std::string& stylesheet) +{ + if (m_xsltStylesheet) { + xsltFreeStylesheet(m_xsltStylesheet); + m_xsltStylesheet = NULL; + } + + m_xmlStylesheet = xmlParseMemory(stylesheet.c_str(), stylesheet.size()); + if (!m_xmlStylesheet) + { + CLog::Log(LOGDEBUG, "could not xmlParseMemory stylesheetdoc"); + return false; + } + + m_xsltStylesheet = xsltParseStylesheetDoc(m_xmlStylesheet); + if (!m_xsltStylesheet) { + CLog::Log(LOGDEBUG, "could not parse stylesheetdoc"); + xmlFree(m_xmlStylesheet); + m_xmlStylesheet = NULL; + return false; + } + + return true; +} diff --git a/xbmc/utils/XSLTUtils.h b/xbmc/utils/XSLTUtils.h new file mode 100644 index 0000000000..18269fb953 --- /dev/null +++ b/xbmc/utils/XSLTUtils.h @@ -0,0 +1,62 @@ +#pragma once + +/* + * Copyright (C) 2005-2013 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 <string> +#include <libxslt/xslt.h> +#include <libxslt/xsltutils.h> + +class XSLTUtils +{ +public: + XSLTUtils(); + ~XSLTUtils(); + + /*! \brief Set the input XML for an XSLT transform from a string. + This sets up the XSLT transformer with some input XML from a string in memory. + The input XML should be well formed. + \param input the XML document to be transformed. + */ + bool SetInput(const std::string& input); + + /*! \brief Set the stylesheet (XSL) for an XSLT transform from a string. + This sets up the XSLT transformer with some stylesheet XML from a string in memory. + The input XSL should be well formed. + \param input the XSL document to be transformed. + */ + bool SetStylesheet(const std::string& stylesheet); + + /*! \brief Perform an XSLT transform on an inbound XML document. + This will apply an XSLT transformation on an input XML document, + giving an output XML document, using the specified XSLT document + as the transformer. + \param input the parent containing the <tag>'s. + \param filename the <tag> in question. + */ + bool XSLTTransform(std::string& output); + + +private: + xmlDocPtr m_xmlInput; + xmlDocPtr m_xmlOutput; + xmlDocPtr m_xmlStylesheet; + xsltStylesheetPtr m_xsltStylesheet; +}; diff --git a/xbmc/win32/Win32DelayedDllLoad.cpp b/xbmc/win32/Win32DelayedDllLoad.cpp index cd04546d43..174be08197 100644 --- a/xbmc/win32/Win32DelayedDllLoad.cpp +++ b/xbmc/win32/Win32DelayedDllLoad.cpp @@ -60,6 +60,12 @@ FARPROC WINAPI delayHookNotifyFunc (unsigned dliNotify, PDelayLoadInfo pdli) HMODULE hMod = LoadLibraryEx(strDll.c_str(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); return (FARPROC)hMod; } + if (stricmp(pdli->szDll, "libxslt.dll") == 0) + { + CStdString strDll = CSpecialProtocol::TranslatePath("special://xbmcbin/system/libxslt.dll"); + HMODULE hMod = LoadLibraryEx(strDll.c_str(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); + return (FARPROC)hMod; + } break; } return NULL; |