Skip to content
Browse files

Reorganize cache and temporary directories under common parents.

Previously, various cache and temporary directories were sprinkled all
over ~/.mythtv, aka MYTHCONFDIR.  This change puts them all under
~/.mythtv/cache or ~/.mythtv/tmp, though, there could still be a few
I've missed.  Some of these directories can get quite large and having
them all in more centralized locations makes it easier to track how
much space they use and to not back them up.
  • Loading branch information...
1 parent 1da2a0e commit 85b2d6d083d8fa973e162aa166f46d01ab107a38 @gigem gigem committed Mar 12, 2014
View
4 mythplugins/mythgallery/mythgallery/galleryutil.cpp
@@ -484,7 +484,7 @@ bool GalleryUtil::Rename(const QString &currDir, const QString &oldName,
// rename the file's thumbnail if it exists
if (QFile::exists(currDir + "/.thumbcache/" + oldName))
{
- QDir d(currDir + "/.thumbcache/");
+ QDir d(currDir + "/cache/gallery-thumbcache/");
d.rename(oldName, newName);
}
@@ -656,7 +656,7 @@ bool GalleryUtil::RenameDirectory(const QString &currDir, const QString &oldName
// rename the directory's thumbnail if it exists in the parent directory
if (QFile::exists(currDir + "/.thumbcache/" + oldName))
{
- QDir d(currDir + "/.thumbcache/");
+ QDir d(currDir + "/cache/gallery-thumbcache/");
d.rename(oldName, newName);
}
View
8 mythplugins/mythmusic/mythmusic/cdrip.cpp
@@ -269,7 +269,7 @@ void CDRipperThread::run(void)
}
MusicMetadata *titleTrack = NULL;
- QString saveDir = GetConfDir() + "/MythMusic/RipTemp/";
+ QString saveDir = GetConfDir() + "/tmp/RipTemp/";
QString outfile;
std::auto_ptr<Encoder> encoder;
@@ -571,10 +571,10 @@ Ripper::Ripper(MythScreenStack *parent, QString device) :
// make sure the directory where we temporarily save the rips is present
QDir dir;
- dir.mkpath(GetConfDir() + "/MythMusic/RipTemp/");
+ dir.mkpath(GetConfDir() + "/tmp/RipTemp/");
// remove any ripped tracks from the temp rip directory
- QString command = "rm -f " + GetConfDir() + "/MythMusic/RipTemp/*";
+ QString command = "rm -f " + GetConfDir() + "/tmp/RipTemp/*";
myth_system(command);
// get last host and directory we ripped to
@@ -587,7 +587,7 @@ Ripper::Ripper(MythScreenStack *parent, QString device) :
Ripper::~Ripper(void)
{
// remove any ripped tracks from the temp rip directory
- QString command = "rm -f " + GetConfDir() + "/MythMusic/RipTemp/*";
+ QString command = "rm -f " + GetConfDir() + "/tmp/RipTemp/*";
myth_system(command);
if (m_decoder)
View
8 mythplugins/mythnetvision/mythnetvision/netcommon.cpp
@@ -18,13 +18,7 @@ QString GetThumbnailFilename(QString url, QString title)
if (!dir.exists())
dir.mkdir(fileprefix);
- fileprefix += "/MythNetvision";
-
- dir = QDir(fileprefix);
- if (!dir.exists())
- dir.mkdir(fileprefix);
-
- fileprefix += "/thumbcache";
+ fileprefix += "/cache/netvision-thumbcache";
dir = QDir(fileprefix);
if (!dir.exists())
View
2 mythplugins/mythnetvision/mythnetvision/netsearch.cpp
@@ -295,7 +295,7 @@ void NetSearch::fillGrabberButtonList()
void NetSearch::cleanCacheDir()
{
- QString cache = QString("%1/MythNetvision/thumbcache")
+ QString cache = QString("%1/cache/netvision-thumbcache")
.arg(GetConfDir());
QDir cacheDir(cache);
QStringList thumbs = cacheDir.entryList(QDir::Files);
View
2 mythplugins/mythnetvision/mythnetvision/nettree.cpp
@@ -196,7 +196,7 @@ NetTree::~NetTree()
void NetTree::cleanCacheDir()
{
- QString cache = QString("%1/thumbcache")
+ QString cache = QString("%1/cache/netvision-thumbcache")
.arg(GetConfDir());
QDir cacheDir(cache);
QStringList thumbs = cacheDir.entryList(QDir::Files);
View
2 mythtv/libs/libmythbase/mythdownloadmanager.cpp
@@ -251,7 +251,7 @@ void MythDownloadManager::run(void)
m_manager = new QNetworkAccessManager(this);
m_diskCache = new QNetworkDiskCache(this);
m_proxy = new QNetworkProxy();
- m_diskCache->setCacheDirectory(GetConfDir() + "/Cache-" +
+ m_diskCache->setCacheDirectory(GetConfDir() + "/cache/" +
QCoreApplication::applicationName() + "-" +
gCoreContext->GetHostName());
m_manager->setCache(m_diskCache);
View
4 mythtv/libs/libmythmetadata/metadataimagedownload.cpp
@@ -357,7 +357,7 @@ QString getDownloadFilename(QString title, QString url)
if (!dir.exists())
dir.mkdir(fileprefix);
- fileprefix += "/thumbcache";
+ fileprefix += "/cache/metadata-thumbcache";
dir = QDir(fileprefix);
if (!dir.exists())
@@ -515,7 +515,7 @@ QString getLocalStorageGroupPath(VideoArtworkType type, QString host)
void cleanThumbnailCacheDir()
{
- QString cache = QString("%1/thumbcache")
+ QString cache = QString("%1/cache/metadata-thumbcache")
.arg(GetConfDir());
QDir cacheDir(cache);
QStringList thumbs = cacheDir.entryList(QDir::Files);
View
2 mythtv/libs/libmythmetadata/mythuiimageresults.cpp
@@ -94,7 +94,7 @@ bool ImageSearchResultsDialog::Create()
void ImageSearchResultsDialog::cleanCacheDir()
{
- QString cache = QString("%1/thumbcache")
+ QString cache = QString("%1/cache/metadata-thumbcache")
.arg(GetConfDir());
QDir cacheDir(cache);
QStringList thumbs = cacheDir.entryList(QDir::Files);
View
2 mythtv/libs/libmythmetadata/mythuimetadataresults.cpp
@@ -100,7 +100,7 @@ bool MetadataResultsDialog::Create()
void MetadataResultsDialog::cleanCacheDir()
{
- QString cache = QString("%1/thumbcache")
+ QString cache = QString("%1/cache/metadata-thumbcache")
.arg(GetConfDir());
QDir cacheDir(cache);
QStringList thumbs = cacheDir.entryList(QDir::Files);
View
2 mythtv/libs/libmythtv/previewgenerator.cpp
@@ -483,7 +483,7 @@ bool PreviewGenerator::SaveOutFile(const QByteArray &data, const QDateTime &dt)
if (m_outFileName.isEmpty())
{
QString remotecachedirname =
- QString("%1/remotecache").arg(GetConfDir());
+ QString("%1/cache/remotecache").arg(GetConfDir());
QDir remotecachedir(remotecachedirname);
if (!remotecachedir.exists())
View
2 mythtv/libs/libmythtv/previewgeneratorqueue.cpp
@@ -289,7 +289,7 @@ QString PreviewGeneratorQueue::GeneratePreviewImage(
if (streaming)
{
- ret_file = QString("%1/remotecache/%2")
+ ret_file = QString("%1/cache/remotecache/%2")
.arg(GetConfDir()).arg(filename.section('/', -1));
QFileInfo finfo(ret_file);
View
6 mythtv/libs/libmythui/mythuihelper.cpp
@@ -719,7 +719,7 @@ bool MythUIHelper::IsImageInCache(const QString &url)
QString MythUIHelper::GetThemeCacheDir(void)
{
- QString cachedirname = GetConfDir() + "/themecache/";
+ QString cachedirname = GetConfDir() + "/cache/themecache/";
QString tmpcachedir = cachedirname +
GetMythDB()->GetSetting("Theme", DEFAULT_UI_THEME) +
@@ -731,7 +731,7 @@ QString MythUIHelper::GetThemeCacheDir(void)
void MythUIHelper::ClearOldImageCache(void)
{
- QString cachedirname = GetConfDir() + "/themecache/";
+ QString cachedirname = GetConfDir() + "/cache/themecache/";
d->themecachedir = GetThemeCacheDir();
@@ -795,7 +795,7 @@ void MythUIHelper::ClearOldImageCache(void)
void MythUIHelper::RemoveCacheDir(const QString &dirname)
{
- QString cachedirname = GetConfDir() + "/themecache/";
+ QString cachedirname = GetConfDir() + "/cache/themecache/";
if (!dirname.startsWith(cachedirname))
return;
View
2 mythtv/programs/mythtv-setup/importicons.cpp
@@ -42,7 +42,7 @@ ImportIconsWizard::ImportIconsWizard(MythScreenStack *parent, bool fRefresh,
m_popupStack = GetMythMainWindow()->GetStack("popup stack");
- m_tmpDir = QDir(QString("%1/icontmp").arg(GetConfDir()));
+ m_tmpDir = QDir(QString("%1/tmp/icon").arg(GetConfDir()));
if (!m_tmpDir.exists())
m_tmpDir.mkpath(m_tmpDir.absolutePath());
View
2 mythtv/programs/scripts/metadata/Movie/tmdb3.py
@@ -279,7 +279,7 @@ def main():
print "Unable to find MythTV directory for metadata cache."
sys.exit(1)
confdir = os.path.join(confdir, '.mythtv')
- confpath = os.path.join(confdir, 'pytmdb3.cache')
+ confpath = os.path.join(confdir, 'cache/pytmdb3.cache')
if not os.access(confpath, os.F_OK|os.W_OK|os.R_OK):
print "Unable to access cache file: "+confpath
sys.exit(1)

0 comments on commit 85b2d6d

Please sign in to comment.
Something went wrong with that request. Please try again.