Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: xbmc/FileSystem/MythDirectory.cpp
- ===================================================================
- --- xbmc/FileSystem/MythDirectory.cpp.orig 2010-11-03 19:41:04.000000000 -0700
- +++ xbmc/FileSystem/MythDirectory.cpp 2010-11-03 20:03:48.000000000 -0700
- @@ -239,11 +239,7 @@
- bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items, enum FilterType type,
- const CStdString& filter)
- {
- - cmyth_conn_t control = m_session->GetControl();
- - if (!control)
- - return false;
- -
- - cmyth_proglist_t list = m_dll->proglist_get_all_recorded(control);
- + cmyth_proglist_t list = m_session->GetRecordingList();
- if (!list)
- {
- CLog::Log(LOGERROR, "%s - unable to get list of recordings", __FUNCTION__);
- @@ -339,7 +335,6 @@
- }
- items.AddSortMethod(SORT_METHOD_DATE, 552 /* Date */, LABEL_MASKS("%K", "%J"));
- - m_dll->ref_release(list);
- return true;
- }
- @@ -348,11 +343,7 @@
- */
- bool CMythDirectory::GetTvShowFolders(const CStdString& base, CFileItemList &items)
- {
- - cmyth_conn_t control = m_session->GetControl();
- - if (!control)
- - return false;
- -
- - cmyth_proglist_t list = m_dll->proglist_get_all_recorded(control);
- + cmyth_proglist_t list = m_session->GetRecordingList();
- if (!list)
- {
- CLog::Log(LOGERROR, "%s - unable to get list of recordings", __FUNCTION__);
- @@ -415,7 +406,6 @@
- items.AddSortMethod(SORT_METHOD_LABEL, 551 /* Name */, LABEL_MASKS("", "", "%L", "%J"));
- items.AddSortMethod(SORT_METHOD_DATE, 552 /* Date */, LABEL_MASKS("", "", "%L", "%J"));
- - m_dll->ref_release(list);
- return true;
- }
- Index: xbmc/FileSystem/MythSession.cpp
- ===================================================================
- --- xbmc/FileSystem/MythSession.cpp.orig 2010-11-03 19:38:48.000000000 -0700
- +++ xbmc/FileSystem/MythSession.cpp 2010-11-03 20:49:10.000000000 -0700
- @@ -57,7 +57,7 @@
- for (it = m_sessions.begin(); it != m_sessions.end(); )
- {
- CMythSession* session = *it;
- - if (session->m_timestamp + 5000 < CTimeUtils::GetTimeMS())
- + if (session->m_timestamp + 50000 < CTimeUtils::GetTimeMS())
- {
- CLog::Log(LOGINFO, "%s - closing idle connection to MythTV backend: %s", __FUNCTION__, session->m_hostname.c_str());
- delete session;
- @@ -81,14 +81,19 @@
- if (session->CanSupport(url))
- {
- m_sessions.erase(it);
- +printf("Aquiring session %p\n", session);
- return session;
- }
- }
- - return new CMythSession(url);
- + CMythSession* session = new CMythSession(url);
- +printf("Aquiring session %p\n", session);
- +
- + return session;
- }
- void CMythSession::ReleaseSession(CMythSession* session)
- {
- +printf("Releasing session: %p\n", session);
- session->SetListener(NULL);
- session->m_timestamp = CTimeUtils::GetTimeMS();
- CSingleLock lock(m_section_session);
- @@ -353,6 +358,7 @@
- m_control = NULL;
- m_event = NULL;
- m_database = NULL;
- + m_proglist = NULL;
- m_hostname = url.GetHostName();
- m_username = url.GetUserName() == "" ? MYTH_DEFAULT_USERNAME : url.GetUserName();
- m_password = url.GetPassWord() == "" ? MYTH_DEFAULT_PASSWORD : url.GetPassWord();
- @@ -423,15 +429,19 @@
- break;
- case CMYTH_EVENT_RECORDING_LIST_CHANGE:
- CLog::Log(LOGDEBUG, "%s - MythTV event RECORDING_LIST_CHANGE", __FUNCTION__);
- + GetRecordingList(true);
- break;
- case CMYTH_EVENT_RECORDING_LIST_CHANGE_ADD:
- CLog::Log(LOGDEBUG, "%s - MythTV event RECORDING_LIST_CHANGE_ADD: %s", __FUNCTION__, buf);
- + GetRecordingList(true);
- break;
- case CMYTH_EVENT_RECORDING_LIST_CHANGE_UPDATE:
- CLog::Log(LOGDEBUG, "%s - MythTV event RECORDING_LIST_CHANGE_UPDATE", __FUNCTION__);
- + GetRecordingList(true);
- break;
- case CMYTH_EVENT_RECORDING_LIST_CHANGE_DELETE:
- CLog::Log(LOGDEBUG, "%s - MythTV event RECORDING_LIST_CHANGE_DELETE: %s", __FUNCTION__, buf);
- + GetRecordingList(true);
- break;
- case CMYTH_EVENT_SCHEDULE_CHANGE:
- CLog::Log(LOGDEBUG, "%s - MythTV event SCHEDULE_CHANGE", __FUNCTION__);
- @@ -541,6 +551,23 @@
- return true;
- }
- +cmyth_proglist_t CMythSession::GetRecordingList(bool force)
- +{
- + if (! m_proglist || force)
- + {
- + CSingleLock lock(m_section);
- + if (m_proglist) {
- + m_dll->ref_release(m_proglist);
- + m_proglist = NULL;
- + }
- + cmyth_conn_t control = GetControl();
- + if (!control)
- + return NULL;
- + m_proglist = m_dll->proglist_get_all_recorded(control);
- + }
- + return m_proglist;
- +}
- +
- DllLibCMyth* CMythSession::GetLibrary()
- {
- if (m_dll->IsLoaded())
- Index: xbmc/FileSystem/MythSession.h
- ===================================================================
- --- xbmc/FileSystem/MythSession.h.orig 2010-11-03 19:58:27.000000000 -0700
- +++ xbmc/FileSystem/MythSession.h 2010-11-03 20:01:32.000000000 -0700
- @@ -60,6 +60,7 @@
- cmyth_conn_t GetControl();
- cmyth_database_t GetDatabase();
- DllLibCMyth* GetLibrary();
- + cmyth_proglist_t GetRecordingList(bool force = false);
- void SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program);
- @@ -88,6 +89,7 @@
- DllLibCMyth* m_dll;
- CCriticalSection m_section;
- unsigned int m_timestamp;
- + cmyth_proglist_t m_proglist;
- static CCriticalSection m_section_session;
- static std::vector<CMythSession*> m_sessions;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement