diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index b3840409cbeb4..338a2864bc182 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -2269,38 +2269,38 @@ void CVideoDatabase::GetBookMarksForFile(const CStdString& strFilenameAndPath, V } else { - int idFile = GetFileId(strFilenameAndPath); - if (idFile < 0) return ; - if (!bAppend) - bookmarks.erase(bookmarks.begin(), bookmarks.end()); - if (NULL == m_pDB.get()) return ; - if (NULL == m_pDS.get()) return ; + int idFile = GetFileId(strFilenameAndPath); + if (idFile < 0) return ; + if (!bAppend) + bookmarks.erase(bookmarks.begin(), bookmarks.end()); + if (NULL == m_pDB.get()) return ; + if (NULL == m_pDS.get()) return ; - CStdString strSQL=PrepareSQL("select * from bookmark where idFile=%i and type=%i order by timeInSeconds", idFile, (int)type); - m_pDS->query( strSQL.c_str() ); - while (!m_pDS->eof()) - { - CBookmark bookmark; - bookmark.timeInSeconds = m_pDS->fv("timeInSeconds").get_asDouble(); - bookmark.partNumber = partNumber; - bookmark.totalTimeInSeconds = m_pDS->fv("totalTimeInSeconds").get_asDouble(); - bookmark.thumbNailImage = m_pDS->fv("thumbNailImage").get_asString(); - bookmark.playerState = m_pDS->fv("playerState").get_asString(); - bookmark.player = m_pDS->fv("player").get_asString(); - bookmark.type = type; - if (type == CBookmark::EPISODE) + CStdString strSQL=PrepareSQL("select * from bookmark where idFile=%i and type=%i order by timeInSeconds", idFile, (int)type); + m_pDS->query( strSQL.c_str() ); + while (!m_pDS->eof()) { - CStdString strSQL2=PrepareSQL("select c%02d, c%02d from episode where c%02d=%i order by c%02d, c%02d", VIDEODB_ID_EPISODE_EPISODE, VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_EPISODE_BOOKMARK, m_pDS->fv("idBookmark").get_asInt(), VIDEODB_ID_EPISODE_SORTSEASON, VIDEODB_ID_EPISODE_SORTEPISODE); - m_pDS2->query(strSQL2.c_str()); - bookmark.episodeNumber = m_pDS2->fv(0).get_asInt(); - bookmark.seasonNumber = m_pDS2->fv(1).get_asInt(); - m_pDS2->close(); + CBookmark bookmark; + bookmark.timeInSeconds = m_pDS->fv("timeInSeconds").get_asDouble(); + bookmark.partNumber = partNumber; + bookmark.totalTimeInSeconds = m_pDS->fv("totalTimeInSeconds").get_asDouble(); + bookmark.thumbNailImage = m_pDS->fv("thumbNailImage").get_asString(); + bookmark.playerState = m_pDS->fv("playerState").get_asString(); + bookmark.player = m_pDS->fv("player").get_asString(); + bookmark.type = type; + if (type == CBookmark::EPISODE) + { + CStdString strSQL2=PrepareSQL("select c%02d, c%02d from episode where c%02d=%i order by c%02d, c%02d", VIDEODB_ID_EPISODE_EPISODE, VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_EPISODE_BOOKMARK, m_pDS->fv("idBookmark").get_asInt(), VIDEODB_ID_EPISODE_SORTSEASON, VIDEODB_ID_EPISODE_SORTEPISODE); + m_pDS2->query(strSQL2.c_str()); + bookmark.episodeNumber = m_pDS2->fv(0).get_asInt(); + bookmark.seasonNumber = m_pDS2->fv(1).get_asInt(); + m_pDS2->close(); + } + bookmarks.push_back(bookmark); + m_pDS->next(); } - bookmarks.push_back(bookmark); - m_pDS->next(); - } - //sort(bookmarks.begin(), bookmarks.end(), SortBookmarks); - m_pDS->close(); + //sort(bookmarks.begin(), bookmarks.end(), SortBookmarks); + m_pDS->close(); } } catch (...) @@ -2983,17 +2983,17 @@ bool CVideoDatabase::GetResumePoint(CVideoInfoTag& tag) } else { - CStdString strSQL=PrepareSQL("select timeInSeconds, totalTimeInSeconds from bookmark where idFile=%i and type=%i order by timeInSeconds", tag.m_iFileId, CBookmark::RESUME); - m_pDS2->query( strSQL.c_str() ); - if (!m_pDS2->eof()) - { - tag.m_resumePoint.timeInSeconds = m_pDS2->fv(0).get_asDouble(); - tag.m_resumePoint.totalTimeInSeconds = m_pDS2->fv(1).get_asDouble(); - tag.m_resumePoint.partNumber = 0; // regular files or non-iso stacks don't need partNumber - tag.m_resumePoint.type = CBookmark::RESUME; - match = true; - } - m_pDS2->close(); + CStdString strSQL=PrepareSQL("select timeInSeconds, totalTimeInSeconds from bookmark where idFile=%i and type=%i order by timeInSeconds", tag.m_iFileId, CBookmark::RESUME); + m_pDS2->query( strSQL.c_str() ); + if (!m_pDS2->eof()) + { + tag.m_resumePoint.timeInSeconds = m_pDS2->fv(0).get_asDouble(); + tag.m_resumePoint.totalTimeInSeconds = m_pDS2->fv(1).get_asDouble(); + tag.m_resumePoint.partNumber = 0; // regular files or non-iso stacks don't need partNumber + tag.m_resumePoint.type = CBookmark::RESUME; + match = true; + } + m_pDS2->close(); } } catch (...)