Repository: xbmc/xbmc
File: xbmc/windows/GUIMediaWindow.cpp (C++)

Code before:

  return bResult;
}

/*!
 * \brief On play and media queue
 *
 * \note Override if you want to change the default behavior of what is done
 * when the user clicks on a file in a "folder" with similar files.
 *
 * This function is called by OnClick()
 */
bool CGUIMediaWindow::OnPlayAndQueueMedia(const CFileItemPtr& item, const std::string& player)
{
  //play and add current directory to temporary playlist
  PLAYLIST::Id playlistId = m_guiState->GetPlaylist();
  if (playlistId != PLAYLIST::TYPE_NONE)
  {
    // Remove ZIP, RAR files and folders
    CFileItemList playlist;
    playlist.Copy(*m_vecItems, true);
    playlist.erase(std::remove_if(playlist.begin(), playlist.end(),
                                  [](const std::shared_ptr<CFileItem>& i)
                                  {
                                    const CFileItem& j = *i.get();
                                    return j.IsZIP() || j.IsRAR() || j.m_bIsFolder;
                                  }),
                   playlist.end());

    // Remove duplicates (eg. ISO/VIDEO_TS)
    playlist.erase(
        std::unique(playlist.begin(), playlist.end(),
                    [](const std::shared_ptr<CFileItem>& i, const std::shared_ptr<CFileItem>& j) {
                      return i.get()->GetVideoInfoTag()->m_basePath ==
                             j.get()->GetVideoInfoTag()->m_basePath;
                    }),
        playlist.end());

    // Chosen item
    int mediaToPlay = std::distance(playlist.begin(),
                                    std::find_if(playlist.begin(), playlist.end(),
                                                 [&item](const std::shared_ptr<CFileItem>& i) {
                                                   return i.get()->GetVideoInfoTag()->m_basePath ==
                                                          item.get()->GetVideoInfoTag()->m_basePath;
                                                 }));

    // Add to playlist
    CServiceBroker::GetPlaylistPlayer().ClearPlaylist(playlistId);
    CServiceBroker::GetPlaylistPlayer().Reset();
    CServiceBroker::GetPlaylistPlayer().Add(playlistId, playlist);


Review comment (suggestion):
```suggestion
                                    return i->IsZIP() || i->IsRAR() || i->m_bIsFolder;
```

Code after:

  if (pItem->GetStartOffset() == STARTOFFSET_RESUME)
    pItem->SetStartOffset(0);

  return bResult;
}

/*!
 * \brief On play and media queue
 *
 * \note Override if you want to change the default behavior of what is done
 * when the user clicks on a file in a "folder" with similar files.
 *
 * This function is called by OnClick()
 */
bool CGUIMediaWindow::OnPlayAndQueueMedia(const CFileItemPtr& item, const std::string& player)
{
  //play and add current directory to temporary playlist
  PLAYLIST::Id playlistId = m_guiState->GetPlaylist();
  if (playlistId != PLAYLIST::TYPE_NONE)
  {
    // Remove ZIP, RAR files and folders
    CFileItemList playlist;
    playlist.Copy(*m_vecItems, true);
    playlist.erase(std::remove_if(playlist.begin(), playlist.end(),
                                  [](const std::shared_ptr<CFileItem>& i)
                                  { return i->IsZIP() || i->IsRAR() || i->m_bIsFolder; }),
                   playlist.end());

    // Remove duplicates (eg. ISO/VIDEO_TS)
    playlist.erase(
        std::unique(playlist.begin(), playlist.end(),
                    [](const std::shared_ptr<CFileItem>& i, const std::shared_ptr<CFileItem>& j) {
                      return i->GetVideoInfoTag()->m_basePath == j->GetVideoInfoTag()->m_basePath;
                    }),
        playlist.end());

    // Chosen item
    int mediaToPlay =
        std::distance(playlist.begin(), std::find_if(playlist.begin(), playlist.end(),
                                                     [&item](const std::shared_ptr<CFileItem>& i) {
                                                       return i->GetVideoInfoTag()->m_basePath ==
                                                              item->GetVideoInfoTag()->m_basePath;
                                                     }));

    // Add to playlist
    CServiceBroker::GetPlaylistPlayer().ClearPlaylist(playlistId);
    CServiceBroker::GetPlaylistPlayer().Reset();
    CServiceBroker::GetPlaylistPlayer().Add(playlistId, playlist);

    // Save current window and directory to know where the selected item was