media library: avoid empty listings after an update/refresh by going one level up in the hierarchy #1642

Merged
merged 1 commit into from Oct 23, 2012

Projects

None yet

2 participants

@Montellese
Member

This is a fix for something that has bugged me ever since I use XBMC. When I'm e.g. in the tvshow view and have "Hide Watched" enabled and there's only a single episode left in a season (or the whole show) and I either watch that episode or mark it as watched, the item is removed from the list leaving me with an empty view. With this change we go to the parent folder until we find a list that is not empty. It also solves the problem described in #634 but in a more general approach (i.e. not tvshow/season specific).

A few notes:

  • This does not apply when "Show parent folder items" is enabled because then the list is not empty. I wasn't sure how to handle this so I'm open to suggestions but I'm sure 50% of the people want it this way and the other 50% the other way ;-)
  • This does not apply if the list is already empty when opening it.
  • This does not apply when a filter is active i.e. when the user specifies filter conditions that have no match, the list will be empty but we will stay in the same list/view/window.
@Montellese
Member

@jmarshallnz I added an additional check of empty paths before calling GoParentFolder() recursively.

@Montellese
Member

Squashed down and waiting for sign-off.

@Montellese Montellese merged commit e01f929 into xbmc:master Oct 23, 2012
@fernandog
Contributor

nice!

@fernandog
Contributor

Is it correct when I'm at TV SHOWs and it does an "up one level" to MOVIES when list is empty?
It should up on level to tv show, isn't? Not to movies
Thanks

@Montellese
Member

That sounds odd. Can you provide a log? Please create a thread in the forum and post the problem + the debug log there and post the URL to the thread here.

@fernandog
Contributor

Oh, I could’t reproduce it anymore
When I did happen my movie library was empty (only tv-shows).
Now there’s movies and that didn't happened again
When a tv-show with only 1 episode ends, I shows the episode detail with a “seen” mark and don’t go back to the list of TV-shows. I have no filters. I'm using media-info view.
Is this what is supposed to do?
thanks

@Montellese
Member

This happened to me once as well (episode being marked as watched but not vanishing) but wasn't able to reproduce. I think the watched filter isn't properly applied in that case and obviously the logic from this PR doesn't kick in as long as there's at least one item in the list so that is not a problem with this logic but with either the update or the hide watched logic.

@fernandog
Contributor

Why don't you force a update/refresh/hide watched process on the tv-show in your code/logic?
Your idea is great.

@Montellese
Member

That wouldn't make any sense. This logic is written to be invoked whenever an update/refresh has just been performed. Triggering an update/refresh in this logic is a) the wrong place and b) might result in an infinite loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment