2010-09-01, 15:17
Hi,
this is continuation of pilluli's thread.
Short overview:
This patch allow XBMC to check if library items are available / accessible when we navigate through libraries. This is useful for people who store their media on "not always turned on" devices - such as: external portable hard drives or network shares on normal desktop computers/notebooks.
Details:
Information about availability of item is storem in CFileItem's bool property "unavailable". This way both skins and code itself has easy access to it.
For the need of this feature i created abstract class CAvailabilityChecker with abstract method bool virtual Check(CFileItem *pItem) = 0; (return true if pItem "unavailable" property has changed). For now only Video items checking is available (through CVideoAvailabilityChecker class inheriting from CAvailabilityChecker). These classes reside now in ThumbLoader.h.
Modifications for CVideoThumbloader class where main work of this feature is done:
Notes:
I would like to start that by default this feature is disabled - so XBMC doesn't do any additional work until user will enable this feature in settings -> video -> library.
As all "unavailable" info is stored in property, adding this feature doesn't force skinners to update skins to keep XBMC working. More or less anyway because without skin modification end user won't see any effects of availability checking. So enabling this feature with skin that doesn't support displaying unavailable information won't give any effects - unavailable items will still look like normal ordinary items.
Any comments are welcome!
Quick look on effects:
New item in Settings -> Video -> Library (disabled by default)
Modified Confluence skin with support of unavailability checking feature - if "Enable availability checks" is enabled in settings new option is visible - "Hide unavailable"
with patch v2 "Hide Unavailable" is change to "Hide unavailable" - lowercased to fit GUI conventiion
Modified Confluence skin with support of unavailability checking feature - if "Hide unavailable" is checked it filters out unavailable items
Modified Confluence skin with support of unavailability checking feature - TVShows example
Modified Confluence skin with support of unavailability checking feature - TVShow's Seasons example
Changelog:
Links:
this is continuation of pilluli's thread.
Short overview:
This patch allow XBMC to check if library items are available / accessible when we navigate through libraries. This is useful for people who store their media on "not always turned on" devices - such as: external portable hard drives or network shares on normal desktop computers/notebooks.
Details:
Information about availability of item is storem in CFileItem's bool property "unavailable". This way both skins and code itself has easy access to it.
For the need of this feature i created abstract class CAvailabilityChecker with abstract method bool virtual Check(CFileItem *pItem) = 0; (return true if pItem "unavailable" property has changed). For now only Video items checking is available (through CVideoAvailabilityChecker class inheriting from CAvailabilityChecker). These classes reside now in ThumbLoader.h.
Modifications for CVideoThumbloader class where main work of this feature is done:
- Added protected members:
- CVideoAvailabilityChecker m_AvailChecker; - class checking and updating CFileItem "unavailable" property, providing info if GUI update is needed
- Reseting count of items with change "unavailable" property
Code:void CVideoThumbLoader::OnLoaderStart()
{
m_AvailChecker.ResetCounter();
} - If any item has changed "unavailable" property - update GUI
Code:void CVideoThumbLoader::OnLoaderFinish()
{
if (m_AvailChecker.AnyChanges())
{
CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_FILTER_ITEMS, 1);
g_windowManager.SendThreadMessage(msg);
m_AvailChecker.ResetCounter();
}
} - If user enabled this feature - availability checking is done
Code:bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
{
// real file availability checking is done here - first lets check if user enabled this feature
if (g_guiSettings.GetBool("videolibrary.fileavailabilitychecking"))
{
m_AvailChecker.Check(pItem);
}
//continue standard code
if (pItem->m_bIsShareOrDrive
|| pItem->IsParentFolder())
return false;
[...] - Logic used to determine what actualy CFileItem is:
Code:if(pItem->m_bIsFolder)
{
CVideoInfoTag *tag = pItem->GetVideoInfoTag();
if(tag->m_iEpisode > 0)
{
// tvshow or tvshow's season
if(tag->m_iSeason > -1)
{
// it's tvshow's season
}
else
{
// it's tvshow
}
}
}
else
// it's either movie or tvshow's episode - we can simply check CFileItem->Exists()
Notes:
I would like to start that by default this feature is disabled - so XBMC doesn't do any additional work until user will enable this feature in settings -> video -> library.
As all "unavailable" info is stored in property, adding this feature doesn't force skinners to update skins to keep XBMC working. More or less anyway because without skin modification end user won't see any effects of availability checking. So enabling this feature with skin that doesn't support displaying unavailable information won't give any effects - unavailable items will still look like normal ordinary items.
Any comments are welcome!
Quick look on effects:
New item in Settings -> Video -> Library (disabled by default)
Modified Confluence skin with support of unavailability checking feature - if "Enable availability checks" is enabled in settings new option is visible - "Hide unavailable"
with patch v2 "Hide Unavailable" is change to "Hide unavailable" - lowercased to fit GUI conventiion
Modified Confluence skin with support of unavailability checking feature - if "Hide unavailable" is checked it filters out unavailable items
Modified Confluence skin with support of unavailability checking feature - TVShows example
Modified Confluence skin with support of unavailability checking feature - TVShow's Seasons example
Changelog:
- 2010-09-14 23:55
- Patch v2d
- Fixed: wrong item was focused when user was re-entering navigation window with Hide Unavailable toggle turned on
- Patch v2d
- 2010-09-11 23:28
- Patch v2c
- Added pilluli's changes: Not using cache values for checking file / directory existance
- If only 1 season of tvshow is available, flatting tvshows is set to 'only if 1 season' and 'Hide unavailable' is toggled navigation GUI automaticly go to only available season but thinking it's still in season navigation to preserve navigation history. If flatting tvshows is disabled it will remove "All Episodes" item from Navigation leaving only 1 available season to pick.
- Patch v2c
- 2010-09-03 19:16
- Patch v2b
- Added new setting in AdvancedSettings:
by default set to false, if set to true - force checking files instead of just paths. Read pilluli's post in patch ticket to know when to use this setting.Code:<videolibrary>
<availabilitycheckingbyfile>true / false</availabilitycheckingbyfile>
</videolibrary>
Note: file checking is slower than path checking, so if You don't need it - don't turn it on
- Added 2 new methods to CVideoDatabase (needed to perform file checking)
- bool GetFileNamesForTvShow(int idShow, std::vector<CStdString>& paths);
- bool GetFileNamesForSeason(int idShow, int iSeason, std::vector<CStdString>& paths);
- Encapsulated unavailable property changed in item list flag to CAvailabalityChecker
- Patch v2b
- 2010-09-03 02:07
- Patch v2
- Code reformated to use xbmc coding conventions
- Partially merged hiding unavailable items into GetFilteredItems method (didn't want to put it in Video dedicated class as I have plans to add support for Music items too). Now I reuse GUI_MSG_FILTER_ITEMS msg to notify GUI.
- Different approach aplied: instead of checking files, now paths are checked (suggested by jmarshall on patch ticket)
- Added 2 methods in CVideoDatabase to improve availability checking performance (both based on bool GetPathsForTvShow(int idShow, std::vector<int>& paths) ):
- bool GetPathsForTvShow(int idShow, std::vector<CStdString>& paths);
- bool GetPathsForSeason(int idShow, int iSeason, std::vector<CStdString>& paths);
- Patch v2
- 2010-09-01 16:04
- Patch v1
- First dirty working solution
Links:
- trac ticket http://trac.xbmc.org/ticket/10047
- patch v2d for xbmc http://wojtek.piechowiak.eu/mich/unavail..._v2d.patch
- patch for confluence skin http://wojtek.piechowiak.eu/mich/confluence_patch.patch
- icon http://wojtek.piechowiak.eu/mich/unavailable.png - need do be copied to addons/skin.confluence/media and then rebuild confluence skin