Solved Show only not watched items in video list
#1
Hello

I like to enhance the video list that it shows the unwatched items only. E.g. I select in the main menu the item 'videos' and select 'files' and go into a folder. Now i get all video files. Some are marked watched or partially watched.

I looked into the code and found the bool CGUIMediaWindow::GetDirectory(const std:Confusedtring &strDirectory, CFileItemList &items) in GUIMediaWindow.cpp.
It seems the right entry point. In this function the items are filtered from the advanced config by a regex.
Code:
if (iWindow == WINDOW_VIDEO_NAV)
    regexps = g_advancedSettings.m_videoExcludeFromListingRegExps;
  if (iWindow == WINDOW_MUSIC_NAV)
    regexps = g_advancedSettings.m_audioExcludeFromListingRegExps;
  if (iWindow == WINDOW_PICTURES)
    regexps = g_advancedSettings.m_pictureExcludeFromListingRegExps;

  if (regexps.size())
  {
    for (int i=0; i < items.Size();)
    {
      if (CUtil::ExcludeFileOrFolder(items[i]->GetPath(), regexps))
        items.Remove(i);
      else
        i++;
    }
  }
I thought i could use this to remove the items i want. So i looked into the object items but i found no property watched or something else that points to a played time.
Can someone please point me to the function or explain short how i could remove watched items.

It would be nice so i can get a deeper understanding of the code.
Reply
#2
This is actually already supported by Kodi core but not used by many/all skins. In the skin you just need to use another button (id 10 instead of 14) in the proper XML file (maybe MyVideos.xml). But I'm sure a skinner can provide you with more details on that.

Apart from solving your problem there is no variable directly indicating watched/unwatched but videos have a playcount stored in CFileItem::GetVideoInfoTag()->m_playcount which can be used to derive the watched state.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
Big thx Montellese. The answer is perfect. As i know how to modify my favorite skin, i'm sure i can implement my wanted feature based on your answer.
Reply
#4
Have to thank you again. Could solve my issue with your help. As i use Aeon Madnox i simple have to add a button with id=10 to Includes_MediaMenu.xml
Code:
control type="button" id="10">
    <include>Objects_MediaMenuButtonIcons</include>
    <visible>Control.IsEnabled(10)</visible>
</control>
Reply

Logout Mark Read Team Forum Stats Members Help
Show only not watched items in video list0