Permalink
Browse files

adds support for inprogress in shows (kicks in if watchedcount > 0 an…

…d watchedcount < totalCounts)
  • Loading branch information...
Jonathan Marshall
Jonathan Marshall committed Sep 1, 2012
1 parent 33a36f0 commit 5c57c76fc8836a3e3b57220cae5f56c65b3abc5b
Showing with 6 additions and 0 deletions.
  1. +6 −0 xbmc/playlists/SmartPlayList.cpp
@@ -408,6 +408,7 @@ vector<Field> CSmartPlaylistRule::GetFields(const CStdString &type)
fields.push_back(FieldStudio);
fields.push_back(FieldMPAA);
fields.push_back(FieldDateAdded);
+ fields.push_back(FieldInProgress);
}
else if (type == "episodes")
{
@@ -723,6 +724,11 @@ CStdString CSmartPlaylistRule::GetWhereClause(const CDatabase &db, const CStdStr
if (m_field == FieldInProgress)
return "episodeview.idFile " + negate + " IN (select idFile from bookmark where type = 1)";
}
+ else if (strType == "tvshows")
+ {
+ if (m_field == FieldInProgress)
+ return GetField(FieldId, strType) + negate + " IN (select idShow from tvshowview where watchedcount > 0 AND watchedcount < totalCount)";
+ }
}
// now the query parameter

3 comments on commit 5c57c76

@MartijnKaijser

This comment has been minimized.

Show comment Hide comment
@MartijnKaijser

MartijnKaijser Sep 19, 2012

Member

imo this isn't entirely correct.
For me inprogress means that even if only start to watch the first episode and don't finish it completely it is still something in progress.
atm these tvshows are excluded from the list.

Member

MartijnKaijser replied Sep 19, 2012

imo this isn't entirely correct.
For me inprogress means that even if only start to watch the first episode and don't finish it completely it is still something in progress.
atm these tvshows are excluded from the list.

@jmarshallnz

This comment has been minimized.

Show comment Hide comment
@jmarshallnz

jmarshallnz Sep 19, 2012

Member

If you can come up with suitable SQL for grabbing it we could make the change. The tricky bit is you want both, and that the episode in progress query needs to be done on the bookmark/file/episode tables (to grab idShow where a resume bookmark is set).

Member

jmarshallnz replied Sep 19, 2012

If you can come up with suitable SQL for grabbing it we could make the change. The tricky bit is you want both, and that the episode in progress query needs to be done on the bookmark/file/episode tables (to grab idShow where a resume bookmark is set).

@Montellese

This comment has been minimized.

Show comment Hide comment
@Montellese

Montellese Sep 19, 2012

Member

Yeah that's gonna be one hell of an ugly SQL query. Either you have to do another sub-select query or you have to come up with an EXISTS() condition. Being able to cover both cases isn't that much of a problem, just do

... where (watchedcount > 0 AND watchedcount < totalCount) OR (watchedcount == 0 AND foobar)

Member

Montellese replied Sep 19, 2012

Yeah that's gonna be one hell of an ugly SQL query. Either you have to do another sub-select query or you have to come up with an EXISTS() condition. Being able to cover both cases isn't that much of a problem, just do

... where (watchedcount > 0 AND watchedcount < totalCount) OR (watchedcount == 0 AND foobar)

Please sign in to comment.