aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/UnrarXLib/rar.cpp9
-rw-r--r--lib/UnrarXLib/rdwrfn.cpp2
-rw-r--r--xbmc/ThumbLoader.cpp33
-rw-r--r--xbmc/URL.cpp1
-rw-r--r--xbmc/filesystem/FileRar.cpp3
-rw-r--r--xbmc/filesystem/RarManager.cpp7
-rw-r--r--xbmc/filesystem/RarManager.h1
7 files changed, 47 insertions, 9 deletions
diff --git a/lib/UnrarXLib/rar.cpp b/lib/UnrarXLib/rar.cpp
index a0e34d99eb..89f0f0e03f 100644
--- a/lib/UnrarXLib/rar.cpp
+++ b/lib/UnrarXLib/rar.cpp
@@ -202,8 +202,10 @@ int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libp
if (bShowProgress)
{
- // temporary workaround to avoid deadlocks caused by dvdplayer halting app thread
- pExtract->GetDataIO().m_pDlgProgress = NULL;//(CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
+ pExtract->GetDataIO().m_pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
+ pExtract->GetDataIO().m_pDlgProgress->SetHeading(fileToExtract);
+ pExtract->GetDataIO().m_pDlgProgress->SetCanCancel(false);
+ pExtract->GetDataIO().m_pDlgProgress->StartModal();
}
int64_t iOff=0;
@@ -232,6 +234,7 @@ int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libp
if (pExtract->GetDataIO().bQuit)
{
+ pExtract->GetDataIO().m_pDlgProgress->Close();
bRes = 2;
break;
}
@@ -265,6 +268,8 @@ int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libp
if (pExtract->GetDataIO().m_pDlgProgress)
pExtract->GetDataIO().m_pDlgProgress->ShowProgressBar(false);
}
+ if (bShowProgress)
+ pExtract->GetDataIO().m_pDlgProgress->Close();
}
}
}
diff --git a/lib/UnrarXLib/rdwrfn.cpp b/lib/UnrarXLib/rdwrfn.cpp
index 17e5b21b73..94c8ea4f4e 100644
--- a/lib/UnrarXLib/rdwrfn.cpp
+++ b/lib/UnrarXLib/rdwrfn.cpp
@@ -146,7 +146,7 @@ int ComprDataIO::UnpRead(byte *Addr,uint Count)
if (m_pDlgProgress)
{
CURL url(SrcArc->FileName);
- m_pDlgProgress->SetLine(2,url.GetWithoutUserDetails()); // update currently extracted rar file
+ m_pDlgProgress->SetLine(0,url.GetWithoutUserDetails()); // update currently extracted rar file
m_pDlgProgress->Progress();
}
}
diff --git a/xbmc/ThumbLoader.cpp b/xbmc/ThumbLoader.cpp
index d1d3778921..a37c9ab13c 100644
--- a/xbmc/ThumbLoader.cpp
+++ b/xbmc/ThumbLoader.cpp
@@ -25,6 +25,7 @@
#include "URL.h"
#include "pictures/Picture.h"
#include "filesystem/File.h"
+#include "filesystem/DirectoryCache.h"
#include "FileItem.h"
#include "settings/GUISettings.h"
#include "GUIUserMessages.h"
@@ -173,6 +174,27 @@ void CVideoThumbLoader::OnLoaderFinish()
{
}
+static void SetupRarOptions(CFileItem& item, const CStdString& path)
+{
+ CStdString path2(path);
+ if (item.IsVideoDb() && item.HasVideoInfoTag())
+ path2 = item.GetVideoInfoTag()->m_strFileNameAndPath;
+ CURL url(path2);
+ CStdString opts = url.GetOptions();
+ if (opts.Find("flags") > -1)
+ return;
+ if (opts.size())
+ opts += "&flags=8";
+ else
+ opts = "?flags=8";
+ url.SetOptions(opts);
+ if (item.IsVideoDb() && item.HasVideoInfoTag())
+ item.GetVideoInfoTag()->m_strFileNameAndPath = url.Get();
+ else
+ item.SetPath(url.Get());
+ g_directoryCache.ClearDirectory(url.GetWithoutFilename());
+}
+
/**
* Look for a thumbnail for pItem. If one does not exist, look for an autogenerated
* thumbnail. If that does not exist, attempt to autogenerate one. Finally, check
@@ -226,7 +248,11 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
else if (!item.m_bIsFolder && item.IsVideo() && g_guiSettings.GetBool("myvideos.extractthumb") &&
g_guiSettings.GetBool("myvideos.extractflags"))
{
- CThumbExtractor* extract = new CThumbExtractor(item, pItem->GetPath(), true, cachedThumb);
+ CStdString path(item.GetPath());
+ if (URIUtils::IsInRAR(item.GetPath()))
+ SetupRarOptions(item,path);
+
+ CThumbExtractor* extract = new CThumbExtractor(item, path, true, cachedThumb);
AddJob(extract);
}
}
@@ -246,7 +272,10 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
(!pItem->GetVideoInfoTag()->HasStreamDetails() ||
pItem->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() <= 0))
{
- CThumbExtractor* extract = new CThumbExtractor(*pItem,pItem->GetPath(),false);
+ CStdString path(item.GetPath());
+ if (URIUtils::IsInRAR(item.GetPath()))
+ SetupRarOptions(item,path);
+ CThumbExtractor* extract = new CThumbExtractor(item,path,false);
AddJob(extract);
}
diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp
index 16941ee645..05781f4898 100644
--- a/xbmc/URL.cpp
+++ b/xbmc/URL.cpp
@@ -159,6 +159,7 @@ void CURL::Parse(const CStdString& strURL1)
CStdString strProtocol2 = GetTranslatedProtocol();
if(m_strProtocol.Equals("rss") ||
+ m_strProtocol.Equals("rar") ||
m_strProtocol.Equals("addons"))
sep = "?";
else
diff --git a/xbmc/filesystem/FileRar.cpp b/xbmc/filesystem/FileRar.cpp
index 5bacd3e3e6..ff523262c0 100644
--- a/xbmc/filesystem/FileRar.cpp
+++ b/xbmc/filesystem/FileRar.cpp
@@ -183,6 +183,9 @@ bool CFileRar::Open(const CURL& url)
}
else
{
+ CFileInfo* info = g_RarManager.GetFileInRar(m_strRarPath,m_strPathInRar);
+ if ((!info || !CFile::Exists(info->m_strCachedPath)) && m_bFileOptions & EXFILE_NOCACHE)
+ return false;
m_bUseFile = true;
CStdString strPathInCache;
diff --git a/xbmc/filesystem/RarManager.cpp b/xbmc/filesystem/RarManager.cpp
index 60886b3c27..95e90e1a4e 100644
--- a/xbmc/filesystem/RarManager.cpp
+++ b/xbmc/filesystem/RarManager.cpp
@@ -35,6 +35,9 @@
#include "utils/log.h"
#include "filesystem/File.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/GUIWindowManager.h"
+
#include <set>
#define EXTRACTION_WARN_SIZE 50*1024*1024
@@ -99,9 +102,6 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString&
}
int iRes = 0;
-#if 0 // temporary workaround. disable dialogs as they cause deadlocks since we cannot render
- // from spawned threads and dvdplayer stalls the app thread during startup
- //Extract archived file, using existing local copy or overwriting if wanted...
if (iSize > EXTRACTION_WARN_SIZE)
{
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
@@ -116,7 +116,6 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString&
iRes = 2; // pretend to be canceled
}
}
-#endif
if (CheckFreeSpace(strDir) < iSize && iRes != 2)
{
ClearCache();
diff --git a/xbmc/filesystem/RarManager.h b/xbmc/filesystem/RarManager.h
index 53c240abbb..dd4b2f0e9e 100644
--- a/xbmc/filesystem/RarManager.h
+++ b/xbmc/filesystem/RarManager.h
@@ -38,6 +38,7 @@ class CFileItemList;
#define EXFILE_OVERWRITE 1
#define EXFILE_AUTODELETE 2
#define EXFILE_UNIXPATH 4
+#define EXFILE_NOCACHE 8
#define RAR_DEFAULT_CACHE "special://temp/"
#define RAR_DEFAULT_PASSWORD ""