before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
if ((regexppos <= regexp2pos && regexppos != -1) || // season (or 'ep') match (regexppos >= 0 && regexp2pos == -1)) { GetEpisodeAndSeasonFromRegExp(reg, episode, defaultSeason); if (currentSeason == episode.iSeason) { // Already added S...
I thought errors were going to move to the next regexp? Same a bit further down.
if (episode.cDate == parent.cDate) episode.isFolder = true; } else { GetEpisodeAndSeasonFromRegExp(reg, parent, defaultSeason); if (episode.iSeason == parent.iSeason && episode.iEpisode == parent.iEpisode) episode.isFolder = true; } ...
@@ -1323,36 +1323,108 @@ CVideoInfoScanner::~CVideoInfoScanner() // add what we found by now episodeList.push_back(episode); + const bool disableEpisodeRanges{ + CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_disableEpisodeRanges}; + CRegExp reg2(true, CRegExp::aut...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.643
suggestion
81
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
// check the remainder of the string for any further episodes. if (!byDate && reg2.RegComp(m_advancedSettings->m_tvshowMultiPartEnumRegExp)) { int offset{0}; int currentSeason{episode.iSeason}; int currentEpisode{episode.iEpisode}; // we want "long circuit" OR below so...
LogF in new code please (this and other instances)
*/ std::string strBasePath = item->GetBaseMoviePath(true); URIUtils::RemoveSlashAtEnd(strBasePath); strBasePath = URIUtils::GetFileName(strBasePath); if (reg.RegFind(strBasePath.c_str()) > -1) { EPISODE parent; if (byDate) { GetAirDateFromRegExp(re...
@@ -1323,36 +1323,108 @@ CVideoInfoScanner::~CVideoInfoScanner() // add what we found by now episodeList.push_back(episode); + const bool disableEpisodeRanges{ + CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_disableEpisodeRanges}; + CRegExp reg2(true, CRegExp::aut...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.143
suggestion
50
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
CRegExp reg2(true, CRegExp::autoUtf8); // check the remainder of the string for any further episodes. if (!byDate && reg2.RegComp(m_advancedSettings->m_tvshowMultiPartEnumRegExp)) { int offset{0}; int currentSeason{episode.iSeason}; int currentEpisode{episode.iEpisode}; ...
the function is getting pretty long, this block that expands a range is very similar to another block further down - could they be refactored/extracted? or could the function be refactored some other way?
* actual media file, we set episode.isFolder to true. */ std::string strBasePath = item->GetBaseMoviePath(true); URIUtils::RemoveSlashAtEnd(strBasePath); strBasePath = URIUtils::GetFileName(strBasePath); if (reg.RegFind(strBasePath.c_str()) > -1) { EPISODE parent; ...
@@ -1323,36 +1323,108 @@ CVideoInfoScanner::~CVideoInfoScanner() // add what we found by now episodeList.push_back(episode); + const bool disableEpisodeRanges{ + CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_disableEpisodeRanges}; + CRegExp reg2(true, CRegExp::aut...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.571
refactor
204
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
} offset = 0; } else if ((regexp2pos < regexppos && regexp2pos != -1) || // episode match (regexp2pos >= 0 && regexppos == -1)) { const int last{std::stoi(reg2.GetMatch(1))}; const int next{remainder.starts_with("-") && !di...
No need to use the same variable names as in the caller. "first" and "last" would make more sense to me. I think this function should be in an anonymous namespace
remainder = reg.GetMatch(3); } else { // Two possible scenarios here: if (remainder.substr(offset, 1) != "-" || disableEpisodeRanges) { // (Sxx)Eyy has already been added and we now in a new range (eg. S00E01S01E...
@@ -1362,6 +1403,30 @@ CVideoInfoScanner::~CVideoInfoScanner() return false; } + void CVideoInfoScanner::ProcessEpisodeRange(int next, + int last, + EPISODE& episode, + EPISO...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.5
suggestion
163
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
(regexp2pos >= 0 && regexppos == -1)) { const int last{std::stoi(reg2.GetMatch(1))}; const int next{remainder.starts_with("-") && !disableEpisodeRanges ? currentEpisode + 1 : last}; ...
the standard library seems to have a function iota() to generate ranges of integers - not sure if it would help here.
// Two possible scenarios here: if (remainder.substr(offset, 1) != "-" || disableEpisodeRanges) { // (Sxx)Eyy has already been added and we now in a new range (eg. S00E01S01E01....) // Add first episode here currentSeason = episod...
@@ -1362,6 +1403,30 @@ CVideoInfoScanner::~CVideoInfoScanner() return false; } + void CVideoInfoScanner::ProcessEpisodeRange(int next, + int last, + EPISODE& episode, + EPISO...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.286
suggestion
117
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
using KODI::MESSAGING::HELPERS::DialogResponse; using KODI::UTILITY::CDigest; namespace { void ProcessEpisodeRange(int first, int last, VIDEO::EPISODE& episode, VIDEO::EPISODELIST& episodeList, const std::string& regex)...
More helpful log: ```suggestion CLog::LogF(LOGDEBUG, "VideoInfoScanner: Removing season {}, episode {} as range {}-{} is backwards", episode.iSeason, episode.iEpisode, first, last); ```
using KODI::MESSAGING::HELPERS::DialogResponse; using KODI::UTILITY::CDigest; namespace { void ProcessEpisodeRange(int first, int last, VIDEO::EPISODE& episode, VIDEO::EPISODELIST& episodeList, const std::string& regex)...
@@ -66,6 +66,34 @@ using namespace KODI; using KODI::MESSAGING::HELPERS::DialogResponse; using KODI::UTILITY::CDigest; +namespace +{ +void ProcessEpisodeRange(int first, + int last, + VIDEO::EPISODE& episode, + VIDEO::EPISODELIST& episodeList, ...
xbmc/video/VideoInfoScanner.cpp
26
C++
1
bug
208
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
int currentEpisode{episode.iEpisode}; // we want "long circuit" OR below so that both offsets are evaluated while (static_cast<int>((regexp2pos = reg2.RegFind(remainder.c_str() + offset)) > -1) | static_cast<int>((regexppos = reg.RegFind(remainder.c_str() + offset)) > -1)) ...
Needs to take the offset into account I think. try the case {"foo S00E01E03-S01E01.mkv", {{0, 1}, {0, 3}}, {{0, 1}, {0, 3}, {1, 1}}}, with current error handling, is supposed to fail the second season the same way it does for foo.S01E01-S02E03.mkv
int currentSeason{episode.iSeason}; int currentEpisode{episode.iEpisode}; // we want "long circuit" OR below so that both offsets are evaluated while (static_cast<int>((regexp2pos = reg2.RegFind(remainder.c_str() + offset)) > -1) | static_cast<int>((regexppos = reg.RegFin...
@@ -1323,36 +1351,79 @@ CVideoInfoScanner::~CVideoInfoScanner() // add what we found by now episodeList.push_back(episode); + const bool disableEpisodeRanges{m_advancedSettings->m_disableEpisodeRanges}; + CRegExp reg2(true, CRegExp::autoUtf8); // check the remainder of the string for ...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.857
bug
250
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
* SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "FileItem.h" #include "ServiceBroker.h" #include "settings/AdvancedSettings.h" #include "settings/SettingsComponent.h" #include "video/VideoInfoScanner.h" #include <gtest/gtest.h> using namespace KODI; using :...
Please move to the bottom with the other multi season failure cases.
* SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "FileItem.h" #include "ServiceBroker.h" #include "settings/AdvancedSettings.h" #include "settings/SettingsComponent.h" #include "video/VideoInfoScanner.h" #include <gtest/gtest.h> using namespace KODI; using :...
@@ -16,29 +19,71 @@ using ::testing::Test; using ::testing::WithParamInterface; using ::testing::ValuesIn; -typedef struct +typedef struct results { const char* path; - int season; - int episode[4]; // for multi-episodes + std::vector<VIDEO::EPISODE> ranges; + std::vector<VIDEO::EPISODE> noranges; } TestEn...
xbmc/video/test/TestVideoInfoScanner.cpp
26
C++
0.357
bug
68
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
using KODI::MESSAGING::HELPERS::DialogResponse; using KODI::UTILITY::CDigest; namespace { void ProcessEpisodeRange(int first, int last, VIDEO::EPISODE& episode, VIDEO::EPISODELIST& episodeList, const std::string& regex...
please combine as else if (!episodeList.empty())
using KODI::MESSAGING::HELPERS::DialogResponse; using KODI::UTILITY::CDigest; namespace { void ProcessEpisodeRange(int first, int last, VIDEO::EPISODE& episode, VIDEO::EPISODELIST& episodeList, const std::string& regex...
@@ -66,6 +66,38 @@ using namespace KODI; using KODI::MESSAGING::HELPERS::DialogResponse; using KODI::UTILITY::CDigest; +namespace +{ +void ProcessEpisodeRange(int first, + int last, + VIDEO::EPISODE& episode, + VIDEO::EPISODELIST& episodeList, ...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.071
suggestion
48
51
51
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "FileItem.h" #include "ServiceBroker.h" #include "settings/AdvancedSettings.h" #include "settings/SettingsComponent.h" ...
please apply Copilots's nitpick ```suggestion struct TestEntry ```
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "FileItem.h" #include "ServiceBroker.h" #include "settings/AdvancedSettings.h" #include "settings/SettingsComponent.h" ...
@@ -19,26 +22,67 @@ using ::testing::ValuesIn; typedef struct
xbmc/video/test/TestVideoInfoScanner.cpp
22
C++
0.857
suggestion
70
47
47
false
[VideoInfoScanner] Allow scraper to correctly process episodes in files named with the format SxxExx-Eyy and add further tests.
26,439
xbmc/xbmc
17,740
C++
CrystalP
78andyp
#include "CompileInfo.h" #include "application/AppParams.h" #include "utils/StringUtils.h" #include <algorithm> #include <array> #include <iostream> #include <vector> namespace { std::vector<std::string> availableWindowSystems = CCompileInfo::GetAvailableWindowSystems(); std::array<std::string, 1> availableLogTargets...
this should read "targets" (plural)
#include "CompileInfo.h" #include "application/AppParams.h" #include "utils/StringUtils.h" #include <algorithm> #include <array> #include <iostream> #include <vector> namespace { std::vector<std::string> availableWindowSystems = CCompileInfo::GetAvailableWindowSystems(); std::array<std::string, 1> availableLogTargets...
@@ -33,7 +33,7 @@ Selected window system not available: {} constexpr const char* loggingText = R"""( Selected logging target not available: {} - Available log targest: {} + Available log target: {}
xbmc/platform/linux/AppParamParserLinux.cpp
26
C++
0.286
suggestion
35
51
51
false
Fix typos in xbmc/platform directory
26,456
xbmc/xbmc
17,740
C++
ksooo
luzpaz
item->SetPath(item->GetVideoInfoTag()->GetPath()); } } } const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); // quietly return if Internet lookups are disabled if (!profileManager->GetCurrentProfile().canWriteDatabases() && !g_...
while you are at it, could you change `!todo` to `@todo`?
item->SetPath(item->GetVideoInfoTag()->GetPath()); } } } const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); // quietly return if Internet lookups are disabled if (!profileManager->GetCurrentProfile().canWriteDatabases() && !g_...
@@ -479,7 +479,7 @@ bool CGUIWindowVideoBase::ShowInfo(const CFileItemPtr& item2, const ScraperPtr& do { // reload images - //! !todo we need this to update images in video info dialog immediatly after refresh, but why? + //! !todo we need this to update images in video info dialog immediately after re...
xbmc/video/windows/GUIWindowVideoBase.cpp
26
C++
0.571
question
57
51
51
false
Fix typos in xbmc/(utils|video|windowing) directories
26,457
xbmc/xbmc
17,740
C++
ksooo
luzpaz
* A newly-created buffer always has a position of zero and a limit set to the * capacity. The initial content of a buffer is, in general, undefined. * * Example: * Buffer buffer(1024); * buffer.putInt(1).putString("hello there").putLongLong( ((long long)2)^40 ); * buffer.flip(); * std::cout ...
should read `the gets` (remove apostrophe from get's; it's just plural )
* A newly-created buffer always has a position of zero and a limit set to the * capacity. The initial content of a buffer is, in general, undefined. * * Example: * Buffer buffer(1024); * buffer.putInt(1).putString("hello there").putLongLong( ((long long)2)^40 ); * buffer.flip(); * std::cout ...
@@ -73,7 +73,7 @@ namespace XbmcCommons * printf("buffer contents: %d, \"%s\", %ll\n", buffer.getInt(), * buffer.getCharPointerDirect(), buffer.getLongLong()); * - * This would also produce erroneous results as they get's will be evaluated + * This would also produce erroneous results as the get...
xbmc/commons/Buffer.h
26
C/C++
0.571
suggestion
73
51
51
false
Fix typos in various xbmc subdirectories
26,468
xbmc/xbmc
17,740
C++
ksooo
luzpaz
{ if (m_pMode) { pp_free_mode(m_pMode); m_pMode = NULL; } if(m_pContext) { pp_free_context(m_pContext); m_pContext = NULL; } m_iInitWidth = 0; m_iInitHeight = 0; } bool CDVDVideoPPFFmpeg::CheckInit(int iWidth, int iHeight) { if (m_iInitWidth != iWidth || m_iInitHeight != iHeight) {...
For the PP_FORMAT_420 - not so sure, as when we are doing SW decoding chances are hight that we also cope with 444, 422 or others.
{ if (m_pMode) { pp_free_mode(m_pMode); m_pMode = NULL; } if(m_pContext) { pp_free_context(m_pContext); m_pContext = NULL; } m_iInitWidth = 0; m_iInitHeight = 0; } bool CDVDVideoPPFFmpeg::CheckInit(int iWidth, int iHeight) { if (m_iInitWidth != iWidth || m_iInitHeight != iHeight) {...
@@ -54,7 +54,7 @@ bool CDVDVideoPPFFmpeg::CheckInit(int iWidth, int iHeight) Dispose(); } - m_pContext = pp_get_context(iWidth, iHeight, PPCPUFlags() | PP_FORMAT_420); + m_pContext = pp_get_context(iWidth, iHeight, PP_CPU_CAPS_AUTO | PP_FORMAT_420);
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp
26
C++
0.286
style
130
51
51
false
[Video] make use of internal FFmpeg CPU capabilities detection for video post-processing
26,471
xbmc/xbmc
17,740
C++
fritsch
thexai
* SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "BlurayDirectory.h" #include "File.h" #include "FileItem.h" #include "FileItemList.h" #include "LangInfo.h" #include "URL.h" #include "filesystem/BlurayCallback.h" #include "filesystem/Directory.h" #include "gui...
Can you keep this include alphabetical
* SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "BlurayDirectory.h" #include "File.h" #include "FileItem.h" #include "FileItemList.h" #include "LangInfo.h" #include "URL.h" #include "filesystem/BlurayCallback.h" #include "filesystem/Directory.h" #include "fil...
@@ -28,6 +28,9 @@ #include <memory> #include <stdlib.h> #include <string> +#ifdef HAVE_GETMNTENT_R +#include <mntent.h>
xbmc/filesystem/BlurayDirectory.cpp
26
C++
0.071
style
38
51
51
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
fuzzard
sgonauer
void CBlurayDirectory::FindMountPoint(std::string* file) { #ifdef HAVE_GETMNTENT_R const char* device = file->c_str(); /* bd path may be a symlink (e.g. /dev/dvd -> /dev/sr0), so make sure * we look up the real device */ char* bd_device = realpath(device, NULL); if (bd_device == NULL) return; stru...
Better to use CLog:LogF, and then the ``__func__`` is unneccessary
Dispose(); m_url = url; std::string root = m_url.GetHostName(); std::string file = m_url.GetFileName(); URIUtils::RemoveSlashAtEnd(file); URIUtils::RemoveSlashAtEnd(root); if (!InitializeBluray(root)) return false; if(file == "root") GetRoot(items); else if(file == "root/titles") GetTitl...
@@ -212,6 +215,44 @@ void CBlurayDirectory::GetRoot(CFileItemList &items) items.Add(item); } +void CBlurayDirectory::FindMountPoint(std::string* file) +{ +#ifdef HAVE_GETMNTENT_R + const char* device = file->c_str(); + + /* bd path may be a symlink (e.g. /dev/dvd -> /dev/sr0), so make sure + * we look up th...
xbmc/filesystem/BlurayDirectory.cpp
26
C++
0.571
suggestion
66
51
51
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
fuzzard
sgonauer
path.SetFileName(URIUtils::AddFileToFolder(m_url.GetFileName(), "titles")); item = std::make_shared<CFileItem>(); item->SetPath(path.Get()); item->m_bIsFolder = true; item->SetLabel(g_localizeStrings.Get(25002) /* All titles */); item->SetArt("icon", "DefaultVideoPlaylists.png"); items.Add(...
This is specific to Linux. Wouldn't it be possible to move to the base directory and somehow implement it only on Linux? Other implementations would return file
item = std::make_shared<CFileItem>(); item->SetPath(path.Get()); item->m_bIsFolder = true; item->SetLabel(g_localizeStrings.Get(25002) /* All titles */); item->SetArt("icon", "DefaultVideoPlaylists.png"); items.Add(item); const BLURAY_DISC_INFO* disc_info = bd_get_disc_info(m_bd); if (d...
@@ -212,6 +215,42 @@ void CBlurayDirectory::GetRoot(CFileItemList &items) items.Add(item); } +void CBlurayDirectory::FindMountPoint(std::string* file)
xbmc/filesystem/BlurayDirectory.cpp
26
C++
0.5
suggestion
161
51
51
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
enen92
sgonauer
const std::string& filename = url.GetFileName(); return CURL(host.append(filename)); } bool CBlurayDirectory::InitializeBluray(const std::string &root) { bd_set_debug_handler(CBlurayCallback::bluray_logger); bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV); std::string real_path = root; FindMountPoint(&...
With the proposed function signature this could be changed as such: ```cpp m_realPath = FindMountPoint(root); if (!bd_open_files(m_bd, &m_realPath, CBlurayCallback::dir_open, CBlurayCallback::file_open)) ```
std::string CBlurayDirectory::HexToString(const uint8_t *buf, int count) { std::array<char, 42> tmp; for (int i = 0; i < count; i++) { sprintf(tmp.data() + (i * 2), "%02x", buf[i]); } return std::string(std::begin(tmp), std::end(tmp)); } std::vector<BLURAY_TITLE_INFO*> CBlurayDirectory::GetUserPlaylist...
@@ -284,7 +326,8 @@ bool CBlurayDirectory::InitializeBluray(const std::string &root) g_LangCodeExpander.ConvertToISO6392T(g_langInfo.GetDVDMenuLanguage(), langCode); bd_set_player_setting_str(m_bd, BLURAY_PLAYER_SETTING_MENU_LANG, langCode.c_str()); - if (!bd_open_files(m_bd, const_cast<std::string*>(&root), C...
xbmc/filesystem/BlurayDirectory.cpp
26
C++
1
suggestion
215
51
51
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
neo1973
sgonauer
#pragma once #include "IDirectory.h" #include "URL.h" #include <memory> class CFileItem; class CFileItemList; typedef struct bluray BLURAY; typedef struct bd_title_info BLURAY_TITLE_INFO; namespace XFILE { class CBlurayDirectory : public IDirectory { public: CBlurayDirectory() = default; ~CBlurayDirectory() ...
Please move the function to the `private` section.
#pragma once #include "IDirectory.h" #include "URL.h" #include <memory> class CFileItem; class CFileItemList; typedef struct bluray BLURAY; typedef struct bd_title_info BLURAY_TITLE_INFO; namespace XFILE { class CBlurayDirectory : public IDirectory { public: CBlurayDirectory() = default; ~CBlurayDirectory() ...
@@ -30,6 +30,7 @@ class CBlurayDirectory : public IDirectory bool GetDirectory(const CURL& url, CFileItemList &items) override; bool InitializeBluray(const std::string &root); + void FindMountPoint(std::string* file);
xbmc/filesystem/BlurayDirectory.h
26
C/C++
0.571
suggestion
50
51
51
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
neo1973
sgonauer
\brief Create the directory \param url Directory to create. \return Returns \e true, if directory is created or if it already exists \sa CDirectoryFactory */ virtual bool Create(const CURL& url) { return false; } /*! \brief Check for directory existence \param url Directory to check. \return Returns...
```suggestion virtual std::string ResolveMountPoint(const std::string& path) const { return path; } ```
\brief Create the directory \param url Directory to create. \return Returns \e true, if directory is created or if it already exists \sa CDirectoryFactory */ virtual bool Create(const CURL& url) { return false; } /*! \brief Check for directory existence \param url Directory to check. \return Returns...
@@ -103,6 +103,13 @@ class IDirectory */ virtual bool Remove(const CURL& url) { return false; } + /*! + \brief Provided a path, attempts to resolve to a mount point + \param path Path to resolve + \return Returns the mountpoint if found, else the provided path + */ + virtual std::string ResolveMountPoint(...
xbmc/filesystem/IDirectory.h
26
C/C++
1
suggestion
107
51
51
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
enen92
sgonauer
closedir(dir); if (success) { if (rmdir(root.c_str()) != 0) success = false; } return success; } bool CPosixDirectory::Exists(const CURL& url) { std::string path = url.Get(); if (IsAliasShortcut(path, true)) TranslateAliasShortcut(path); struct stat buffer; if (stat(path.c_str(), &...
```suggestion std::string CPosixDirectory::ResolveMountPoint(const std::string& file) const ```
closedir(dir); if (success) { if (rmdir(root.c_str()) != 0) success = false; } return success; } bool CPosixDirectory::Exists(const CURL& url) { std::string path = url.Get(); if (IsAliasShortcut(path, true)) TranslateAliasShortcut(path); struct stat buffer; if (stat(path.c_str(), &...
@@ -206,3 +210,51 @@ bool CPosixDirectory::Exists(const CURL& url) return false; return S_ISDIR(buffer.st_mode) ? true : false; } + +std::string CPosixDirectory::ResolveMountPoint(const std::string& file)
xbmc/platform/posix/filesystem/PosixDirectory.cpp
26
C++
0.857
suggestion
97
51
51
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
enen92
sgonauer
/* * Copyright (C) 2014-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "filesystem/IDirectory.h" namespace XFILE { class CPosixDirectory : public IDirectory { public: CPosi...
```suggestion std::string ResolveMountPoint(const std::string& file) const override; ```
/* * Copyright (C) 2014-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "filesystem/IDirectory.h" namespace XFILE { class CPosixDirectory : public IDirectory { public: CPosi...
@@ -23,6 +23,8 @@ class CPosixDirectory : public IDirectory bool Exists(const CURL& url) override; bool Remove(const CURL& url) override; bool RemoveRecursive(const CURL& url) override; + std::string ResolveMountPoint(const std::string& file) override;
xbmc/platform/posix/filesystem/PosixDirectory.h
26
C/C++
0.857
suggestion
92
32
32
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
enen92
sgonauer
typedef struct bluray BLURAY; typedef struct bd_title_info BLURAY_TITLE_INFO; namespace XFILE { class CBlurayDirectory : public IDirectory { public: CBlurayDirectory() = default; ~CBlurayDirectory() override; bool GetDirectory(const CURL& url, CFileItemList &items) override; bool InitializeBluray(const std::...
This is not needed, seems like a leftover. IDirectory has a default implementation anyway.
typedef struct bluray BLURAY; typedef struct bd_title_info BLURAY_TITLE_INFO; namespace XFILE { class CBlurayDirectory : public IDirectory { public: CBlurayDirectory() = default; ~CBlurayDirectory() override; bool GetDirectory(const CURL& url, CFileItemList &items) override; bool InitializeBluray(const std::...
@@ -41,6 +41,7 @@ class CBlurayDirectory : public IDirectory }; void Dispose(); + std::string FindMountPoint(const std::string& file);
xbmc/filesystem/BlurayDirectory.h
26
C/C++
0.143
suggestion
90
41
40
false
Bluray: Fix linux support
26,473
xbmc/xbmc
17,740
C++
enen92
sgonauer
/// /// ///----------------------------------------------------------------------- /// /// **Example:** /// ~~~~~~~~~~~~~{.py} /// .. /// # Define own function where becomes called from Kodi /// def onInit(self): /// print("Window.onInit method called from K...
Could you also change "after it will" to "afterwards will", please?
/// /// ///----------------------------------------------------------------------- /// /// **Example:** /// ~~~~~~~~~~~~~{.py} /// .. /// # Define own function where becomes called from Kodi /// def onInit(self): /// print("Window.onInit method called from K...
@@ -514,7 +514,7 @@ namespace XBMCAddon /// @brief \python_func{ show() } /// Show this window. /// - /// Shows this window by activating it, calling close() after it wil + /// Shows this window by activating it, calling close() after it will
xbmc/interfaces/legacy/Window.h
26
C/C++
0.357
question
67
51
51
false
Fix typos in xbmc/interfaces/legacy
26,479
xbmc/xbmc
17,740
C++
ksooo
luzpaz
private: static constexpr std::string_view enumToSV(VideoDbContentType type) { using namespace std::literals::string_view_literals; switch (type) { case VideoDbContentType::UNKNOWN: return "unknown"sv; case VideoDbContentType::MOVIES: return "movies"sv; case VideoDbCon...
For `std::invalid_argument`, `#include <stdexcept>` should be added.
{ return fmt::formatter<std::string_view>::format(enumToSV(type), ctx); } private: static constexpr std::string_view enumToSV(VideoDbContentType type) { using namespace std::literals::string_view_literals; switch (type) { case VideoDbContentType::UNKNOWN: return "unknown"sv; ...
@@ -180,6 +181,40 @@ enum class VideoDbContentType MUSICALBUMS = 6 }; +template<> +struct fmt::formatter<VideoDbContentType> : fmt::formatter<std::string_view> +{ + template<typename FormatContext> + constexpr auto format(const VideoDbContentType& type, FormatContext& ctx) + { + return fmt::formatter<string...
xbmc/video/VideoDatabase.h
26
C/C++
0.571
suggestion
68
51
51
false
Scoped enum VideoContentType is not formattable
26,481
xbmc/xbmc
17,740
C++
ksooo
janbar
#define VIDEODB_TYPE_UNUSED 0 #define VIDEODB_TYPE_STRING 1 #define VIDEODB_TYPE_INT 2 #define VIDEODB_TYPE_FLOAT 3 #define VIDEODB_TYPE_BOOL 4 #define VIDEODB_TYPE_COUNT 5 #define VIDEODB_TYPE_STRINGARRAY 6 #define VIDEODB_TYPE_DATE 7 #define VIDEODB_TYPE_DATETIME 8 enum class VideoDbContentType { UNKNOWN = -1, M...
For `std::string_view`, `#include <string_view>` should be added.
#define VIDEODB_DETAILS_MUSICVIDEO_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 12 #define VIDEODB_DETAILS_MUSICVIDEO_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 13 #define VIDEODB_TYPE_UNUSED 0 #define VIDEODB_TYPE_STRING 1 #define VIDEODB_TYPE_INT 2 #define VIDEODB_TYPE_FLOAT 3 #define VIDEODB_TYPE_BOOL 4 #define VIDEODB_TYPE_COUNT...
@@ -180,6 +181,40 @@ enum class VideoDbContentType MUSICALBUMS = 6 }; +template<> +struct fmt::formatter<VideoDbContentType> : fmt::formatter<std::string_view>
xbmc/video/VideoDatabase.h
26
C/C++
0.571
suggestion
65
51
51
false
Scoped enum VideoContentType is not formattable
26,481
xbmc/xbmc
17,740
C++
ksooo
janbar
VIDEODB_ID_CREDITS = 6, VIDEODB_ID_YEAR = 7, // unused VIDEODB_ID_THUMBURL = 8, VIDEODB_ID_IDENT_ID = 9, VIDEODB_ID_SORTTITLE = 10, VIDEODB_ID_RUNTIME = 11, VIDEODB_ID_MPAA = 12, VIDEODB_ID_TOP250 = 13, VIDEODB_ID_GENRE = 14, VIDEODB_ID_DIRECTOR = 15, VIDEODB_ID_ORIGINALTITLE = 16, VIDEODB_ID_TH...
could be just me, isn't throwing excessive? As far as I know Kodi only has a catch at the top level of threads except for few specific areas of the code (db). ``` default: return {}; ``` would be fine?
{ return fmt::formatter<std::string_view>::format(enumToSV(type), ctx); } private: static constexpr std::string_view enumToSV(VideoDbContentType type) { using namespace std::literals::string_view_literals; switch (type) { case VideoDbContentType::UNKNOWN: return "unknown"sv; ...
@@ -180,6 +184,40 @@ enum class VideoDbContentType MUSICALBUMS = 6 }; +template<> +struct fmt::formatter<VideoDbContentType> : fmt::formatter<std::string_view> +{ + template<typename FormatContext> + constexpr auto format(const VideoDbContentType& type, FormatContext& ctx) + { + return fmt::formatter<std::s...
xbmc/video/VideoDatabase.h
26
C/C++
1
question
210
51
51
false
Scoped enum VideoContentType is not formattable
26,481
xbmc/xbmc
17,740
C++
CrystalP
janbar
* Copyright (C) 2023 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "VideoSelectActionProcessor.h" #include "ContextMenuManager.h" #include "FileItem.h" #include "ServiceBroker.h" #include "sett...
Maybe add a to-do so this can be removed in future versions. Otherwise it might be forgotten.
* Copyright (C) 2023-2025 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "VideoSelectActionProcessor.h" #include "ContextMenuManager.h" #include "FileItem.h" #include "ServiceBroker.h" #include ...
@@ -17,28 +17,33 @@ #include "utils/guilib/GUIContentUtils.h" #include "video/VideoFileItemClassify.h" #include "video/guilib/VideoGUIUtils.h" +#include "video/guilib/VideoPlayActionProcessor.h" namespace KODI::VIDEO::GUILIB { -Action CVideoSelectActionProcessor::GetDefaultSelectAction() -{ - return static_ca...
xbmc/video/guilib/VideoSelectActionProcessor.cpp
26
C++
0.357
suggestion
94
51
51
false
[video] Cleanup settings 'default select action' and 'default play action' logics.
26,522
xbmc/xbmc
17,740
C++
enen92
ksooo
/*! * \brief Get an IP for a hostname from the cache * * \param strHostName The hostname to look up * \param[out] strIpAddress Contains the IP for the hostname if the info is in the cache, otherwise unchanged * * \return true if the IP is cached */ static bool GetCached(const std::string& strHo...
https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#member-variables `_instance`-> `ms_instance`
/*! * \brief Get an IP for a hostname from the cache * * \param strHostName The hostname to look up * \param[out] strIpAddress Contains the IP for the hostname if the info is in the cache, otherwise unchanged * * \return true if the IP is cached */ bool GetCached(const std::string& strHostName,...
@@ -8,27 +8,65 @@ #pragma once -#include <string> -#include <vector> +#include "threads/CriticalSection.h" -class CCriticalSection; +#include <chrono> +#include <optional> +#include <string> +#include <unordered_map> -class CDNSNameCache +class CDNSNameCache final { public: - class CDNSName - { - public: ...
xbmc/network/DNSNameCache.h
26
C/C++
0.5
suggestion
112
39
36
false
DNSNameCache: Add a Time To Live for cached names
26,525
xbmc/xbmc
17,740
C++
ksooo
neo1973
/*! * \brief Get an IP for a hostname from the cache * * \param strHostName The hostname to look up * \param[out] strIpAddress Contains the IP for the hostname if the info is in the cache, otherwise unchanged * * \return true if the IP is cached */ static bool GetCached(const std::string& strHo...
Shouldn't this rather be a `CServiceBroker` component, to be able to control instance's live time? I thought we agreed not to introduce new globals...
/*! * \brief Get an IP for a hostname from the cache * * \param strHostName The hostname to look up * \param[out] strIpAddress Contains the IP for the hostname if the info is in the cache, otherwise unchanged * * \return true if the IP is cached */ bool GetCached(const std::string& strHostName,...
@@ -8,27 +8,65 @@ #pragma once -#include <string> -#include <vector> +#include "threads/CriticalSection.h" -class CCriticalSection; +#include <chrono> +#include <optional> +#include <string> +#include <unordered_map> -class CDNSNameCache +class CDNSNameCache final { public: - class CDNSName - { - public: ...
xbmc/network/DNSNameCache.h
26
C/C++
0.714
suggestion
150
39
36
false
DNSNameCache: Add a Time To Live for cached names
26,525
xbmc/xbmc
17,740
C++
ksooo
neo1973
class CDNSNameCache final { public: /*! * \brief Add the IP for a hostname to the cache. From the time of adding it stays in the cache for \ref TTL * * \param strHostName The hostname * \param strIpAddress The IP for that hostname. Can be IPv4 or IPv6 */ void Add(const std::string& strHostName, const...
Could this member function be `const`now?
class CDNSNameCache final { public: /*! * \brief Add the IP for a hostname to the cache. From the time of adding it stays in the cache for \ref TTL * * \param strHostName The hostname * \param strIpAddress The IP for that hostname. Can be IPv4 or IPv6 */ void Add(const std::string& strHostName, const...
@@ -40,7 +40,7 @@ class CDNSNameCache final * * \return true if the IP is cached */ - static bool GetCached(const std::string& strHostName, std::string& strIpAddress); + bool GetCached(const std::string& strHostName, std::string& strIpAddress);
xbmc/network/DNSNameCache.h
26
C/C++
0.5
question
41
51
51
false
DNSNameCache: Add a Time To Live for cached names
26,525
xbmc/xbmc
17,740
C++
ksooo
neo1973
* \brief Add the IP for a hostname to the cache indefinitely * * \param strHostName The hostname * \param strIpAddress The IP for that hostname. Can be IPv4 or IPv6 */ void AddPermanent(const std::string& strHostName, const std::string& strIpAddress); /*! * \brief Get an IP for a hostname from the...
Could this member function be `const`now?
* \brief Add the IP for a hostname to the cache indefinitely * * \param strHostName The hostname * \param strIpAddress The IP for that hostname. Can be IPv4 or IPv6 */ void AddPermanent(const std::string& strHostName, const std::string& strIpAddress); /*! * \brief Get an IP for a hostname from the...
@@ -51,13 +51,10 @@ class CDNSNameCache final * * \return true if the IP is cached or the DNS query was successful */ - static bool Lookup(const std::string& strHostName, std::string& strIpAddress); + bool Lookup(const std::string& strHostName, std::string& strIpAddress);
xbmc/network/DNSNameCache.h
26
C/C++
0.5
question
41
42
42
false
DNSNameCache: Add a Time To Live for cached names
26,525
xbmc/xbmc
17,740
C++
ksooo
neo1973
int delta{1}; const auto nextCheck = ClosestNextCheck(); if (nextCheck.IsValid()) { // Repos were already checked once and we know when to check next delta = std::max(1, (nextCheck - CDateTime::GetCurrentDateTime()).GetSecondsTotal() * 1000); CLog::Log(LOGDEBUG, "CRepositoryUpdater: closest next up...
Just nitpicking, but I would keep the "ms" so the log reader knows the unit of measurement of the value.
return; if (!m_addonMgr.HasAddons(AddonType::REPOSITORY)) return; milliseconds delta{1}; const auto nextCheck = ClosestNextCheck(); if (nextCheck.IsValid()) { // Repos were already checked once and we know when to check next. // delta must be positive and not zero (m_timer.Start() ignores 0 ...
@@ -322,32 +326,29 @@ void CRepositoryUpdater::ScheduleUpdate(UpdateScheduleType scheduleType) if (!m_addonMgr.HasAddons(AddonType::REPOSITORY)) return; - int delta{1}; + milliseconds delta{1}; const auto nextCheck = ClosestNextCheck(); if (nextCheck.IsValid()) { - // Repos were already checked ...
xbmc/addons/RepositoryUpdater.cpp
26
C++
0.286
nitpick
104
31
32
false
[Addons] RepositoryUpdater: fix time calculation overflow
26,531
xbmc/xbmc
17,740
C++
ksooo
mglae
} catch(...) { CLog::Log(LOGERROR, "{} ({}) failed", __FUNCTION__, item.GetVideoInfoTag()->m_strFileNameAndPath); } } void CVideoDatabase::GetEpisodesByBlurayPath(const std::string& path, std::vector<CVideoInfoTag>& episodes) { // url will be in...
`blurayPath`could be moved inside the `try`block.
} catch(...) { CLog::Log(LOGERROR, "{} ({}) failed", __FUNCTION__, item.GetVideoInfoTag()->m_strFileNameAndPath); } } void CVideoDatabase::GetEpisodesByBlurayPath(const std::string& path, std::vector<CVideoInfoTag>& episodes) { try { // ur...
@@ -3570,22 +3571,102 @@ void CVideoDatabase::DeleteResumeBookMark(const CFileItem& item) } } -void CVideoDatabase::GetEpisodesByFile(const std::string& strFilenameAndPath, std::vector<CVideoInfoTag>& episodes) +void CVideoDatabase::GetEpisodesByBlurayPath(const std::string& path, + ...
xbmc/video/VideoDatabase.cpp
26
C++
0.5
suggestion
49
51
51
false
[Video][Blurays] Introduce/modify some functions that are necessary pre-requisites for the larger bluray episode/version changes to come.
26,542
xbmc/xbmc
17,740
C++
ksooo
78andyp
return IsNfs(CSpecialProtocol::TranslatePath(strFile)); CURL url(strFile); if (HasParentInHostname(url)) return IsNfs(url.GetHostName()); return IsProtocol(strFile, "nfs"); } bool URIUtils::IsVideoDb(const std::string& strFile) { return IsProtocol(strFile, "videodb"); } bool URIUtils::IsBlurayPath(c...
No need to construct this vector with every call to this method. Either make it `static`, even better as it has only fixed members, make it even more simple. Less fancy, but performant. ```c++ const std::string filename{GetFileName(file)}; return (StringUtils::EqualsNoCase(filename, "index.bdmv") || StringUtils::E...
{ return StringUtils::StartsWith(strFile, "pvr://recordings/tv"); } bool URIUtils::IsPVRRadioRecordingFileOrFolder(const std::string& strFile) { return StringUtils::StartsWith(strFile, "pvr://recordings/radio"); } bool URIUtils::IsMusicDb(const std::string& strFile) { return IsProtocol(strFile, "musicdb"); } b...
@@ -1239,6 +1287,15 @@ bool URIUtils::IsBlurayPath(const std::string& strFile) return IsProtocol(strFile, "bluray"); } +bool URIUtils::IsBDFile(const std::string& file) +{ + const std::vector<std::string> files = {"index.bdmv", "INDEX.BDM", "MovieObject.bdmv", + "MOVIEOBJ...
xbmc/utils/URIUtils.cpp
26
C++
1
suggestion
370
51
51
false
[Video][Blurays] Introduce/modify some functions that are necessary pre-requisites for the larger bluray episode/version changes to come.
26,542
xbmc/xbmc
17,740
C++
ksooo
78andyp
if (IsBlurayPath(path)) { const CURL url(path); const CURL url2(url.GetHostName()); // strip bluray:// if (url2.IsProtocol("udf")) // ISO return url2.GetHostName(); // strip udf:// return AddFileToFolder(url2.Get(), "BDMV", "index.bdmv"); // BDMV } return std::string{}; } std::strin...
`std::to_string(x));` is shorter and more performant than `StringUtils::Format("{}", x)`.
if (IsBlurayPath(path)) { const CURL url(path); const CURL url2(url.GetHostName()); // strip bluray:// if (url2.IsProtocol("udf")) // ISO return url2.GetHostName(); // strip udf:// return AddFileToFolder(url2.Get(), "BDMV", "index.bdmv"); // BDMV } return std::string{}; } std::strin...
@@ -519,6 +528,17 @@ std::string URIUtils::GetBlurayTitlesPath(const std::string& path) return AddFileToFolder(GetBlurayPath(path), "root", "titles"); } +std::string URIUtils::GetBlurayEpisodePath(const std::string& path, int season, int episode) +{ + return AddFileToFolder(GetBlurayPath(path), "root", "episode"...
xbmc/utils/URIUtils.cpp
26
C++
0.357
style
89
51
51
false
[Video][Blurays] Introduce/modify some functions that are necessary pre-requisites for the larger bluray episode/version changes to come.
26,542
xbmc/xbmc
17,740
C++
ksooo
78andyp
} std::string URIUtils::GetBlurayFile(const std::string& path) { if (IsBlurayPath(path)) { const CURL url(path); const CURL url2(url.GetHostName()); // strip bluray:// if (url2.IsProtocol("udf")) // ISO return url2.GetHostName(); // strip udf:// return AddFileToFolder(url2.Get(), "BDMV"...
I have seen code checking for exactly this four files elsewhere in this PR. Any chance to consolidate that "files to check lists"? Like: ```c++ const std::string filename{GetFileName(file)}; return IsBDFile(filename) || StringUtils::EqualsNoCase(filename, "video_ts.ifo") || (StringUtils:...
} std::string URIUtils::GetBlurayFile(const std::string& path) { if (IsBlurayPath(path)) { const CURL url(path); const CURL url2(url.GetHostName()); // strip bluray:// if (url2.IsProtocol("udf")) // ISO return url2.GetHostName(); // strip udf:// return AddFileToFolder(url2.Get(), "BDMV"...
@@ -518,6 +518,18 @@ std::string URIUtils::GetBlurayFile(const std::string& path) return std::string{}; } +bool URIUtils::IsOpticalMediaFile(const std::string& file) +{ + const std::string filename{GetFileName(file)}; + return StringUtils::EqualsNoCase(filename, "video_ts.ifo") || + (StringUtils::Starts...
xbmc/utils/URIUtils.cpp
26
C++
0.929
suggestion
446
51
51
false
[Video][Blurays] Introduce/modify some functions that are necessary pre-requisites for the larger bluray episode/version changes to come.
26,542
xbmc/xbmc
17,740
C++
ksooo
78andyp
if(!file.empty() && file != strFolder) { AddSlashAtEnd(file); url.SetFileName(file); strFolder = url.Get(); } return; } if (!HasSlashAtEnd(strFolder)) { if (IsDOSPath(strFolder)) strFolder += '\\'; else strFolder += '/'; } } bool URIUtils::HasSlashAtEnd(co...
Can't all these methods be moved to DiscUtils? They all seem to be disc related, not really Uri related
bool URIUtils::IsNfs(const std::string& strFile) { if (IsStack(strFile)) return IsNfs(CStackDirectory::GetFirstStackedFile(strFile)); if (IsSpecial(strFile)) return IsNfs(CSpecialProtocol::TranslatePath(strFile)); CURL url(strFile); if (HasParentInHostname(url)) return IsNfs(url.GetHostName()); ...
@@ -1239,6 +1307,28 @@ bool URIUtils::IsBlurayPath(const std::string& strFile) return IsProtocol(strFile, "bluray"); } +bool URIUtils::IsOpticalMediaFile(const std::string& file)
xbmc/utils/URIUtils.cpp
26
C++
0.5
suggestion
103
51
51
false
[Video][Blurays] Introduce/modify some functions that are necessary pre-requisites for the larger bluray episode/version changes to come.
26,542
xbmc/xbmc
17,740
C++
enen92
78andyp
URIUtils::GetParentPath(item->GetPath(), value); value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILE...
Please add a constant with a speaking name for this magic number 3. A comment explaining what you are doing here would also not harm I guess.
URIUtils::GetParentPath(item->GetPath(), value); value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILE...
@@ -549,6 +550,18 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont value = item->GetPath(); value = CURL(value).GetWithoutUserDetails(); + + // Decode path for readability + if (info.m_info == LISTITEM_DECODED_FILENAME_AND_PATH) + { + ...
xbmc/guilib/guiinfo/VideoGUIInfo.cpp
26
C++
0.286
suggestion
142
51
51
false
[Video][Skin] Always show full path in video information dialog.
26,544
xbmc/xbmc
17,740
C++
ksooo
78andyp
value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILENAME_AND_PATH: case LISTITEM_DECODED_FILENAME_AND_PATH...
Shouldn't the absence of % be part of the for loop stop condition? I can imagine a case with 4 layers if the iso was zipped - not sure it would actually ever happen. For performance reasons, would it make sense to apply only to bluray (or a short list of protocols)? I didn't check if Decode is expensive. This functi...
if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILENAME_AND_PATH: case LISTITEM_DECODED_FILENAME_AND_PATH: if (VIDEO::IsVideoDb(*item)) value...
@@ -549,6 +552,15 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont value = item->GetPath(); value = CURL(value).GetWithoutUserDetails(); + + // Decode path for readability + // Loop up to 3 times as each call to CURL::Decode() decodes one 'layer' + ...
xbmc/guilib/guiinfo/VideoGUIInfo.cpp
26
C++
0.929
performance
363
51
51
false
[Video][Skin] Always show full path in video information dialog.
26,544
xbmc/xbmc
17,740
C++
CrystalP
78andyp
if (!item->HasArt("thumb")) { CVideoThumbLoader loader; loader.LoadItem(item); } // find a thumb for this stream if (NETWORK::IsInternetStream(*item)) { if (!g_application.m_strPlayListFile.empty()) { CLog::Log(LOGDEBUG, "Streaming media detected... using {} to f...
Please move this definition as close to where it is used in the code. Around line 560
if (!item->HasArt("thumb")) { CVideoThumbLoader loader; loader.LoadItem(item); } // find a thumb for this stream if (NETWORK::IsInternetStream(*item)) { if (!g_application.m_strPlayListFile.empty()) { CLog::Log(LOGDEBUG, "Streaming media detected... using {} to f...
@@ -98,6 +98,8 @@ bool CVideoGUIInfo::InitCurrentItem(CFileItem *item) return false; } +static constexpr unsigned int MAX_DECODE_PASSES = 5;
xbmc/guilib/guiinfo/VideoGUIInfo.cpp
26
C++
0.357
refactor
85
51
51
false
[Video][Skin] Always show full path in video information dialog.
26,544
xbmc/xbmc
17,740
C++
ksooo
78andyp
else if (item->HasMusicInfoTag()) // special handling for music videos, which have both a videotag and a musictag break; else URIUtils::GetParentPath(item->GetPath(), value); value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) ...
Replace the hard coded 5 with the name of the constant you introduced. So you don’t need to touch the content when the constant changes.
else URIUtils::GetParentPath(item->GetPath(), value); value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case ...
@@ -549,6 +552,19 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont value = item->GetPath(); value = CURL(value).GetWithoutUserDetails(); + + // Decode path for readability + // Loop up to 5 times as each call to CURL::Decode() decodes one 'layer'
xbmc/guilib/guiinfo/VideoGUIInfo.cpp
26
C++
0.5
suggestion
137
51
51
false
[Video][Skin] Always show full path in video information dialog.
26,544
xbmc/xbmc
17,740
C++
ksooo
78andyp
{ URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILENAME_AND_PATH: case LISTITEM_DECODED_FILENAME_AND_PATH: if (VIDEO::IsVideoDb(*item)) value = tag->m_strFileNameAndPath; else if (i...
I meant this: ```suggestion for (unsigned int i = 0; value.find('%') == std::string::npos && i < MAX_DECODE_PASSES; ++i) value = CURL::Decode(value); ```
value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILENAME_AND_PATH: case LISTITEM_DECODED_FILENAME_AND_PATH: if (VIDEO::IsVideoDb(*item)) value = tag->m_strFileNameAndPath; else if (item->HasMusicInfoTag()) // special handling for music v...
@@ -549,6 +552,19 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont value = item->GetPath(); value = CURL(value).GetWithoutUserDetails(); + + // Decode path for readability + // Loop up to 5 times as each call to CURL::Decode() decodes one 'layer' + ...
xbmc/guilib/guiinfo/VideoGUIInfo.cpp
26
C++
1
suggestion
181
51
51
false
[Video][Skin] Always show full path in video information dialog.
26,544
xbmc/xbmc
17,740
C++
CrystalP
78andyp
value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILENAME_AND_PATH: if (VIDEO::IsVideoDb(*item)) ...
@78andyp One of those things I would have suggested to be changed before merge: Evaluate logically ANDed expressions always from cheap to expensive, CPU-clock wise. `value.find('%') != std::string::npos` is far more expensive than `i < MAX_DECODE_PASSES`. First check i, then presence of '%', not the other way around....
value = CURL(value).GetWithoutUserDetails(); if (info.m_info == LISTITEM_FOLDERNAME) { URIUtils::RemoveSlashAtEnd(value); value = URIUtils::GetFileName(value); } return true; case LISTITEM_FILENAME_AND_PATH: case LISTITEM_DECODED_FILENAME_AND_PATH...
@@ -549,6 +550,18 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont value = item->GetPath(); value = CURL(value).GetWithoutUserDetails(); + + // Decode path for readability + // Loop up to MAX_DECODE_PASSES times as each call to CURL::Decode() decode...
xbmc/guilib/guiinfo/VideoGUIInfo.cpp
26
C++
0.857
performance
321
51
51
false
[Video][Skin] Always show full path in video information dialog.
26,544
xbmc/xbmc
17,740
C++
ksooo
78andyp
m_confirmed = false; Close(); } void CGUIDialogMediaSource::UpdateButtons() { if (!m_paths->Size()) // sanity return; CONTROL_ENABLE_ON_CONDITION(CONTROL_OK, !m_paths->Get(0)->GetPath().empty() && !m_name.empty()); CONTROL_ENABLE_ON_CONDITION(CONTROL_PATH_ADD, !m_paths->Get(0)->GetPath().empty()); CON...
@jjd-uk please adapt the comment according to changed string => // "Enter path..."
m_confirmed = false; Close(); } void CGUIDialogMediaSource::UpdateButtons() { if (!m_paths->Size()) // sanity return; CONTROL_ENABLE_ON_CONDITION(CONTROL_OK, !m_paths->Get(0)->GetPath().empty() && !m_name.empty()); CONTROL_ENABLE_ON_CONDITION(CONTROL_PATH_ADD, !m_paths->Get(0)->GetPath().empty()); CON...
@@ -487,7 +487,8 @@ void CGUIDialogMediaSource::UpdateButtons() std::string path; CURL url(item->GetPath()); path = url.GetWithoutUserDetails(); - if (path.empty()) path = "<" + g_localizeStrings.Get(231) + ">"; // <None> + if (path.empty()) + path = g_localizeStrings.Get(1020); // "New path"
xbmc/dialogs/GUIDialogMediaSource.cpp
26
C++
0.357
suggestion
82
51
51
false
Media Source Dialog - change string for new path from <None> to Enter path...
26,563
xbmc/xbmc
17,740
C++
ksooo
jjd-uk
// ie. removable:// needs to be resolved to the actual path // (which is contained the fileItem m_path) const std::string newPath{URIUtils::GetBlurayPlaylistPath(item.GetPath())}; const CURL pathUrl{path}; item.SetDynPath(URIUtils::AddFileToFolder(ne...
It'd be nice to have this sort of stuff centralised. I've added resolve() to IDirectory a while ago : https://github.com/xbmc/xbmc/blob/699cfeba428179057939c0419b58d107fb72d3e0/xbmc/filesystem/IDirectory.h#L157 Stuff like this without tests will break sooner or later, so by having this well contained you can easily ...
if (item.HasProperty("StartPercent")) { options.startpercent = item.GetProperty("StartPercent").asDouble(); item.SetStartOffset(0); } options.starttime = CUtil::ConvertMilliSecsToSecs(item.GetStartOffset()); if (bRestart) { // have to be set here due to playstack using this for starting the f...
@@ -2384,10 +2384,35 @@ bool CApplication::PlayFile(CFileItem item, CVideoDatabase dbs; dbs.Open(); - std::string path = item.GetPath(); - std::string videoInfoTagPath(item.GetVideoInfoTag()->m_strFileNameAndPath); - if (videoInfoTagPath.starts_with("removable://") || VIDEO::IsVideoDb(ite...
xbmc/application/Application.cpp
26
C++
0.429
suggestion
348
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
enen92
78andyp
{ std::string tmppath1, tmppath2, tmppath3; CFileItemList items; CFileItemPtr itemptr; tmppath1 = CSpecialProtocol::TranslatePath("special://temp/"); tmppath1 = URIUtils::AddFileToFolder(tmppath1, "TestDirectory"); tmppath2 = tmppath1; tmppath2 = URIUtils::AddFileToFolder(tmppath2, "subdir"); EXPECT_TRU...
Maybe better to add a new test case instead of reusing the general one right? This is quite specific to bluray
{ std::string tmppath1, tmppath2, tmppath3; CFileItemList items; CFileItemPtr itemptr; tmppath1 = CSpecialProtocol::TranslatePath("special://temp/"); tmppath1 = URIUtils::AddFileToFolder(tmppath1, "TestDirectory"); tmppath2 = tmppath1; tmppath2 = URIUtils::AddFileToFolder(tmppath2, "subdir"); EXPECT_TRU...
@@ -41,6 +43,36 @@ TEST(TestDirectory, General) EXPECT_TRUE(XFILE::CDirectory::Exists(tmppath1)); EXPECT_TRUE(XFILE::CDirectory::Remove(tmppath1)); EXPECT_FALSE(XFILE::CDirectory::Exists(tmppath1)); + + // Resolve tests
xbmc/filesystem/test/TestDirectory.cpp
26
C++
0.5
suggestion
110
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
enen92
78andyp
int GetFileIdByMovie(int idMovie); std::string GetFileBasePathById(int idFile); /*! * @brief Check the passed in list of images if used in this database. Used to clean the image cache. * @param imagesToCheck * @return a list of the passed in images used by this database. */ std::vector<std::string>...
```suggestion /*! * \brief Find a playlist path for a removable bluray disc. * \param originalPath A path in the format of bluray://removable://<ttile_ID>/BDMV/index.bdmv * \return A path in the format of bluray://removable://<ttile_ID>/BDMV/PLAYLIST/00000.mpls if found, otherwise an empty string. ...
void UpdateVideoVersionTypeTable(); bool GetVideoVersionsNav(const std::string& strBaseDir, CFileItemList& items, VideoDbContentType idContent = VideoDbContentType::UNKNOWN, const Filter& filter = Filter()); VideoAssetInfo GetVideoVe...
@@ -1212,6 +1212,13 @@ class CVideoDatabase : public CDatabase */ std::vector<std::string> GetUsedImages(const std::vector<std::string>& imagesToCheck); + /*! \brief Find a playlist path for a removable bluray disc. + \param originalPath A path in the format of bluray://removable://<ttile_ID>/BDMV/index.bdm...
xbmc/video/VideoDatabase.h
26
C/C++
1
suggestion
329
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
CastagnaIT
78andyp
item.SetPath("E:\\BDMV\\index.bdmv"); std::string pathToResolve{ "bluray://removable%3a%2f%2fsometitle_0000000000000000000000000000000000000000%00%cc" "/BDMV/index.bdmv"}; item.SetDynPath(pathToResolve); tag->m_strFileNameAndPath = pathToResolve; if (const std::unique_ptr<XFILE::IDirectory> dir{X...
Minor: Empty line at the end of the file please
item.SetPath("E:\\BDMV\\index.bdmv"); std::string pathToResolve{ "bluray://removable%3a%2f%2fsometitle_0000000000000000000000000000000000000000%00%cc" "/BDMV/index.bdmv"}; item.SetDynPath(pathToResolve); tag->m_strFileNameAndPath = pathToResolve; if (const std::unique_ptr<XFILE::IDirectory> dir{X...
@@ -55,3 +57,37 @@ TEST(TestDirectory, CreateRecursive) EXPECT_TRUE(XFILE::CDirectory::Create(path2)); EXPECT_TRUE(XFILE::CDirectory::RemoveRecursive(path1)); } + +#ifdef HAVE_LIBBLURAY +TEST(TestDirectory, BlurayResolve) +{ + CFileItem item; + CVideoInfoTag* tag{item.GetVideoInfoTag()}; + + // Emulate first ...
xbmc/filesystem/test/TestDirectory.cpp
26
C++
0.071
nitpick
47
26
27
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
enen92
78andyp
return; // Adjust paths of new fileItem for physical/removable blurays // If first play then DynPath contains the mpls played // If resume then DynPath is empty and VideoInfoTag()->m_strFileNameAndPath contains the mpls played if (fileItem.HasVideoInfoTag() && fileItem.GetVideoInfoTag()->m_strFileNam...
DynPath falls back to Path if path is set and dynpath isn't. Storing state in two places could introduce inconsistencies. DynPath is made to be dynamic, but path isn't. If we're updating the non-dynamic component, I feel like we should clear the dynpath (or leave it empty) to convey the intention that it's the non-dyna...
return; // Adjust paths of new fileItem for physical/removable blurays // DynPath contains the mpls (playlist) played // VideoInfoTag()->m_strFileNameAndPath contains the removable:// path // We need to update DynPath with the removable:// path (for the database), keeping the playlist if (fileItem.HasVid...
@@ -114,6 +114,33 @@ void CApplicationPlayerCallback::OnPlayerCloseFile(const CFileItem& file, if (bookmark.timeInSeconds == 0.0) return; + // Adjust paths of new fileItem for physical/removable blurays + // If first play then DynPath contains the mpls played + // If resume then DynPath is empty and VideoI...
xbmc/application/ApplicationPlayerCallback.cpp
26
C++
0.643
suggestion
363
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
garbear
78andyp
* This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once // CAutorun - Autorun for different Cd Media // like DVD Movies or XBOX Games // // by Bobbin007 in 2003 // // // #ifdef HAS_OPTICAL_DRIVE #i...
Definitions should come after forward declarations. And structs should probably be defined after enums (from type-ish to object-ish). And then probably move this into the `MEDIA_DETECT` namespace.
* This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once // CAutorun - Autorun for different Cd Media // like DVD Movies or XBOX Games // // by Bobbin007 in 2003 // // // #ifdef HAS_OPTICAL_DRIVE #i...
@@ -25,6 +25,13 @@ struct IntegerSettingOption; +struct PlayDiscOptions
xbmc/Autorun.h
26
C/C++
1
refactor
196
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
garbear
78andyp
(VIDEO::IsBDFile(item) || item.IsDiscImage())) || (forceSelection && URIUtils::IsBlurayPath(item.GetDynPath()))) { // No video selection when using external or remote players (they handle it if supported) const bool isSimpleMenuAllowed = [&]() { const std::string defaulPlayer{ ...
What if, to guard against new fields not being reset, you do: ```c++ options = {}; ``` Not sure if this even works but that's the idea.
} if (options.starttime == 0.0 && item.HasVideoInfoTag()) { // No resume point is set, but check if this item is part of a multi-episode file const CVideoInfoTag *tag = item.GetVideoInfoTag(); if (tag->m_iBookmarkId > 0) { CBookmark bookmark;...
@@ -2486,6 +2486,11 @@ bool CApplication::PlayFile(CFileItem item, // Check if we must show the simplified bd menu. if (!CGUIDialogSimpleMenu::ShowPlaySelection(item, forceSelection)) return true; + + // Reset any resume state as new playlist chosen + options.startpercent = 0.0; + ...
xbmc/application/Application.cpp
26
C++
0.786
suggestion
143
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
garbear
78andyp
g_application.OnAction(CAction(ACTION_PLAYER_RESET)); } return 0; } /*! \brief Play currently inserted DVD. * \param params The parameters. * \details params[0] = "restart" to restart from resume point (optional). */ static int PlayDVD(const std::vector<std::string>& params) { #ifdef HAS_OPTICAL_DRIVE ...
Even one more word would improve this documentation. You don't have to write an essay about obvious documentation but some specificity would be an improvement.
g_application.OnAction(CAction(ACTION_PLAYER_RESET)); } return 0; } /*! \brief Play currently inserted DVD. * \param params The parameters. * \details params[0] = "restart" to restart from resume point (optional). */ static int PlayDVD(const std::vector<std::string>& params) { #ifdef HAS_OPTICAL_DRIVE ...
@@ -426,7 +426,23 @@ static int PlayDVD(const std::vector<std::string>& params) bool restart = false; if (!params.empty() && StringUtils::EqualsNoCase(params[0], "restart")) restart = true; - MEDIA_DETECT::CAutorun::PlayDisc(CServiceBroker::GetMediaManager().GetDiscPath(), true, restart); + PlayDiscOptions...
xbmc/interfaces/builtins/PlayerBuiltins.cpp
26
C++
0.286
suggestion
159
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
garbear
78andyp
/// be used for playing a directory. `\,1` will start the media without switching to fullscreen. /// If media is a playlist or a disc image stack or a video file stack\, you can use /// playoffset=xx where xx is the position to start playback from. /// where xx is the position to start playback from. //...
Is this documentation intended to be duplicated from the above line?
/// be used for playing a directory. `\,1` will start the media without switching to fullscreen. /// If media is a playlist or a disc image stack or a video file stack\, you can use /// playoffset=xx where xx is the position to start playback from. /// where xx is the position to start playback from. //...
@@ -891,6 +907,7 @@ CBuiltins::CommandMap CPlayerBuiltins::GetOperations() const return { {"playdisc", {"Plays the inserted disc, like CD, DVD or Blu-ray, in the disc drive.", 0, PlayDVD}}, {"playdvd", {"Plays the inserted disc, like CD, DVD or Blu-ray, in the disc driv...
xbmc/interfaces/builtins/PlayerBuiltins.cpp
26
C++
0.143
refactor
68
39
39
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
garbear
78andyp
{ CLog::Log(LOGDEBUG, "GetDiskUniqueId: Retrieving ID for path {} failed, ID is empty.", CURL::GetRedacted(mediaPath)); return ""; } std::string strID{StringUtils::Format("removable://{}_{}", info.name, info.serial)}; if (info.type == UTILS::DISCS::DiscType::BLURAY) { CURL url("blur...
I didn't even know it was possible to use a semicolon in an if condition 🙂 For code clarity it would be better to not be "tricky" and code in a way that makes it the most readable. Expected code is easier to read than unexpected code.
if (info.empty()) { CLog::Log(LOGDEBUG, "GetDiskUniqueId: Retrieving ID for path {} failed, ID is empty.", CURL::GetRedacted(mediaPath)); return ""; } std::string strID{StringUtils::Format("removable://{}_{}", info.name, info.serial)}; if (info.type == UTILS::DISCS::DiscType::BLURAY) ...
@@ -609,6 +610,26 @@ std::string CMediaManager::GetDiskUniqueId(const std::string& devicePath) return strID; } +bool CMediaManager::HasMediaBlurayPlaylist(const std::string& devicePath) +{ +#ifdef HAVE_LIBBLURAY + const std::string mediaPath{TranslateDevicePath(devicePath)}; + if (UTILS::DISCS::DiscInfo info{Ge...
xbmc/storage/MediaManager.cpp
26
C++
0.571
suggestion
235
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
garbear
78andyp
m_bEnable = true; } void CAutorun::Disable() { m_bEnable = false; } bool CAutorun::IsEnabled() const { return m_bEnable; } bool CAutorun::PlayDiscAskResume(const std::string& path) { PlayDiscOptions options({.bypassSettings = true, .startFromBeginning = !CanResumePlayDVD(path) || ...
Good use of designated initializers — the explicit field names make the intent super clear.
#endif } void CAutorun::Enable() { m_bEnable = true; } void CAutorun::Disable() { m_bEnable = false; } bool CAutorun::IsEnabled() const { return m_bEnable; } bool CAutorun::PlayDiscAskResume(const std::string& path) { PlayDiscOptions options({.bypassSettings = true, .startFromBegi...
@@ -537,10 +556,13 @@ bool CAutorun::IsEnabled() const bool CAutorun::PlayDiscAskResume(const std::string& path) { - return PlayDisc(path, true, - !CanResumePlayDVD(path) || - HELPERS::ShowYesNoDialogText(CVariant{341}, CVariant{""}, CVariant{13404}, - ...
xbmc/Autorun.cpp
26
C++
0.357
suggestion
91
50
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
garbear
78andyp
void UpdateVideoVersionTypeTable(); bool GetVideoVersionsNav(const std::string& strBaseDir, CFileItemList& items, VideoDbContentType idContent = VideoDbContentType::UNKNOWN, const Filter& filter = Filter()); VideoAssetInfo GetVideoVe...
Typo in documentation: 'ttile_ID' should be 'title_ID'. ```suggestion \return A path in the format of bluray://removable://<title_ID>/BDMV/PLAYLIST/00000.mpls if found, otherwise an empty string. ```
void UpdateVideoVersionTypeTable(); bool GetVideoVersionsNav(const std::string& strBaseDir, CFileItemList& items, VideoDbContentType idContent = VideoDbContentType::UNKNOWN, const Filter& filter = Filter()); VideoAssetInfo GetVideoVe...
@@ -1224,6 +1224,12 @@ class CVideoDatabase : public CDatabase */ std::vector<std::string> GetUsedImages(const std::vector<std::string>& imagesToCheck); + /*! \brief Find a playlist path for a removable bluray disc. + \param originalPath A path in the format of bluray://removable://<title_ID>/BDMV/index.bdm...
xbmc/video/VideoDatabase.h
26
C/C++
1
suggestion
202
51
51
false
[Video][Bluray] Extend bluray:// functionality to removable bluray discs.
26,566
xbmc/xbmc
17,740
C++
Copilot
78andyp
m_data = VariantArray{}; } if (type() == VariantTypeArray) std::get<VariantArray>(m_data).emplace_back(std::move(variant)); } void CVariant::append(const CVariant &variant) { push_back(variant); } void CVariant::append(CVariant&& variant) { push_back(std::move(variant)); } const char *CVariant::c_st...
[nitpick] The swap implementation forces rhs to become a ConstNull variant when the current variant is ConstNull, which deviates from symmetric swapping. If this behavior is intentional, please add an inline comment to clarify this special case. ```suggestion { // If the current variant is ConstNull, force rhs to bec...
m_data = VariantArray{}; } if (type() == VariantTypeArray) std::get<VariantArray>(m_data).emplace_back(std::move(variant)); } void CVariant::append(const CVariant &variant) { push_back(variant); } void CVariant::append(CVariant&& variant) { push_back(std::move(variant)); } const char *CVariant::c_st...
@@ -599,7 +599,10 @@ const char *CVariant::c_str() const void CVariant::swap(CVariant& rhs) noexcept {
xbmc/utils/Variant.cpp
26
C++
1
suggestion
442
51
51
false
CVariant: Fix `swap()` so it doesn't change a `VariantTypeConstNull` variant
26,581
xbmc/xbmc
17,740
C++
Copilot
neo1973
if (playedOnly && !channel->LastWatched()) continue; if (dateAdded) { const CDateTime dtChannelAdded{channel->DateTimeAdded()}; if (!dtChannelAdded.IsValid()) continue; const std::shared_ptr<const CPVRClient> client{ CServiceBro...
Instead of this, please remove `const` in line 848.
const CPVRChannelsPath path(m_url.GetWithoutOptions()); if (path.IsValid()) { if (path.IsEmpty()) { std::shared_ptr<CFileItem> item; // all tv channels item = std::make_shared<CFileItem>(CPVRChannelsPath::PATH_TV_CHANNELS, true); item->SetLabel(g_localizeStrings.Get(19020)); // TV...
@@ -849,7 +849,7 @@ bool CPVRGUIDirectory::GetChannelsDirectory(CFileItemList& results) const if (dateAdded) item->SetProperty("hideable", true); - results.Add(std::move(item)); + results.Add(item);
xbmc/pvr/filesystem/PVRGUIDirectory.cpp
26
C++
0.571
suggestion
51
51
51
false
[clang-tidy] fix modernize-* and performance-* warnings
26,589
xbmc/xbmc
17,740
C++
ksooo
Rechi
}; using DBusMessagePtr = std::unique_ptr<DBusMessage, DBusMessageDeleter>; class CDBusMessage { public: CDBusMessage(const char *destination, const char *object, const char *interface, const char *method); CDBusMessage(std::string const& destination, std::string const& object, std::string const& interface, std::s...
I think we also want to pass the variadic part as reference: ```suggestion void AppendArguments(const TFirst& first, const TArgs&... args) ```
}; using DBusMessagePtr = std::unique_ptr<DBusMessage, DBusMessageDeleter>; class CDBusMessage { public: CDBusMessage(const char *destination, const char *object, const char *interface, const char *method); CDBusMessage(std::string const& destination, std::string const& object, std::string const& interface, std::s...
@@ -56,13 +56,13 @@ class CDBusMessage void AppendArgument(const char **arrayString, unsigned int length); template<typename TFirst> - void AppendArguments(const TFirst first) + void AppendArguments(const TFirst& first) { AppendArgument(first); // Recursion end } template<typename TFirst, t...
xbmc/platform/linux/DBusMessage.h
26
C/C++
1
suggestion
147
51
51
false
[clang-tidy] fix modernize-* and performance-* warnings
26,589
xbmc/xbmc
17,740
C++
neo1973
Rechi
using namespace XFILE::VIDEODATABASEDIRECTORY; //! @todo does the node type need to match the type requested by the parent node? //! this type of node is used for MOVIE_ASSETS MOVIE_ASSETS_VERSIONS MOVIE_ASSETS_EXTRAS CDirectoryNodeMovieAssets::CDirectoryNodeMovieAssets(const std::string& strName, ...
This could be simplified to: ```c++ const int details{items.GetProperty("set_videodb_details").asInteger32(VideoDbDetailsStream)}; ```
using namespace XFILE::VIDEODATABASEDIRECTORY; //! @todo does the node type need to match the type requested by the parent node? //! this type of node is used for MOVIE_ASSETS MOVIE_ASSETS_VERSIONS MOVIE_ASSETS_EXTRAS CDirectoryNodeMovieAssets::CDirectoryNodeMovieAssets(const std::string& strName, ...
@@ -41,7 +41,7 @@ bool CDirectoryNodeMovieAssets::GetContent(CFileItemList& items) const const int details{items.HasProperty("set_videodb_details") ? items.GetProperty("set_videodb_details").asInteger32() - : VideoDbDetailsNone}; + : VideoDbDet...
xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMovieAssets.cpp
26
C++
1
suggestion
141
51
51
false
[GUI] Add Sorting Methods to the movie versions/extras folders
26,627
xbmc/xbmc
17,740
C++
ksooo
CrystalP
} else if (stream->m_streamType == INPUTSTREAM_TYPE_VIDEO) { CDemuxStreamVideo *videoStream = new CDemuxStreamVideo(); videoStream->iFpsScale = stream->m_FpsScale; videoStream->iFpsRate = stream->m_FpsRate; videoStream->iWidth = stream->m_Width; videoStream->iHeight = stream->m_Height; vi...
```suggestion // Determine the HDR type ```
} else if (stream->m_streamType == INPUTSTREAM_TYPE_VIDEO) { CDemuxStreamVideo *videoStream = new CDemuxStreamVideo(); videoStream->iFpsScale = stream->m_FpsScale; videoStream->iFpsRate = stream->m_FpsRate; videoStream->iWidth = stream->m_Width; videoStream->iHeight = stream->m_Height; vi...
@@ -444,6 +444,20 @@ KODI_HANDLE CInputStreamAddon::cb_get_stream_transfer(KODI_HANDLE handle, videoStream->colorTransferCharacteristic = static_cast<AVColorTransferCharacteristic>(stream->m_colorTransferCharacteristic); + // Determinate the HDR type
xbmc/cores/VideoPlayer/DVDInputStreams/InputStreamAddon.cpp
26
C++
1
suggestion
49
51
51
false
[InputStreamAddon] Implemented HDR types
26,631
xbmc/xbmc
17,740
C++
thexai
CastagnaIT
// sort by group's local position std::sort(m_groups.begin(), m_groups.end(), [](const auto& group1, const auto& group2) { return group1->GetPosition() < group2->GetPosition(); }); } void CPVRChannelGroups::SortGroups() { bool orderChanged{false}; { std::unique_lock<CCriticalSection> lock(m_critSecti...
Is it necessary to compare the path? As the sorting only shuffles around pointers I'd assume that comparing the pointers should also be sufficient. In that case we could just do: ```cpp orderChanged = m_groups != groupsInOldOrder; ```
// sort by group's local position std::sort(m_groups.begin(), m_groups.end(), [](const auto& group1, const auto& group2) { return group1->GetPosition() < group2->GetPosition(); }); } void CPVRChannelGroups::SortGroups() { bool orderChanged{false}; { std::unique_lock<CCriticalSection> lock(m_critSecti...
@@ -212,15 +208,32 @@ void CPVRChannelGroups::SortGroupsByLocalOrder() void CPVRChannelGroups::SortGroups() { - const bool backendOrderSort = - m_settings.GetBoolValue(CSettings::SETTING_PVRMANAGER_BACKENDCHANNELGROUPSORDER); + bool orderChanged{false}; + { + std::unique_lock<CCriticalSection> lock(m_cri...
xbmc/pvr/channels/PVRChannelGroups.cpp
26
C++
1
style
237
51
51
false
[PVR] Reduce number of published events
26,635
xbmc/xbmc
17,740
C++
neo1973
ksooo
* This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUIIncludes.h" #include "GUIInfoManager.h" #include "addons/Skin.h" #include "guilib/GUIComponent.h" #include "guilib/guiinfo/GUIInfoLabel.h" #include "interf...
I'm not opposed to switch to `std::array`, but I think using the `std::range::find` in the checks hurts readability a little. I suggest to add a small function that makes the intention clearer: ```cpp static constexpr std::array<std::string_view, 17> CONSTANT_ATTRIBUTES = { "x", "y", "width", "height", "c...
* This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUIIncludes.h" #include "GUIInfoManager.h" #include "addons/Skin.h" #include "guilib/GUIComponent.h" #include "guilib/guiinfo/GUIInfoLabel.h" #include "interf...
@@ -18,71 +18,37 @@ #include "utils/XMLUtils.h" #include "utils/log.h" +#include <algorithm> + using namespace KODI::GUILIB; -CGUIIncludes::CGUIIncludes() -{ - m_constantAttributes.insert("x"); - m_constantAttributes.insert("y"); - m_constantAttributes.insert("width"); - m_constantAttributes.insert("height")...
xbmc/guilib/GUIIncludes.cpp
26
C++
1
suggestion
682
51
51
false
[GUIIncludes]: Minor cleanup and performance optimizations
26,639
xbmc/xbmc
17,740
C++
neo1973
raphaelthegreat
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUIIncludes.h" #include "GUIInfoManager.h" #include "addons/Skin.h" #include "guilib/GUIComponent.h" #include "guilib...
Please change the name to `CONSTANT_ATTRIBUTES` according to our [Code Guidelines](https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#82-constants). Same for the other constants.
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUIIncludes.h" #include "GUIInfoManager.h" #include "addons/Skin.h" #include "guilib/GUIComponent.h" #include "guilib...
@@ -18,72 +18,84 @@ #include "utils/XMLUtils.h" #include "utils/log.h" +#include <algorithm> + using namespace KODI::GUILIB; -CGUIIncludes::CGUIIncludes() -{ - m_constantAttributes.insert("x"); - m_constantAttributes.insert("y"); - m_constantAttributes.insert("width"); - m_constantAttributes.insert("height")...
xbmc/guilib/GUIIncludes.cpp
26
C++
0.714
suggestion
192
51
51
false
[GUIIncludes]: Minor cleanup and performance optimizations
26,639
xbmc/xbmc
17,740
C++
neo1973
raphaelthegreat
* This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUIIncludes.h" #include "GUIInfoManager.h" #include "addons/Skin.h" #include "guilib/GUIComponent.h" #include "guilib/guiinfo/GUIInfoLabel.h" #include "interf...
It should be checked at compile time that the arrays are sorted correctly: ```cpp static_assert(std::ranges::is_sorted(constantAttributes)); ```
* This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUIIncludes.h" #include "GUIInfoManager.h" #include "addons/Skin.h" #include "guilib/GUIComponent.h" #include "guilib/guiinfo/GUIInfoLabel.h" #include "interf...
@@ -18,72 +18,84 @@ #include "utils/XMLUtils.h" #include "utils/log.h" +#include <algorithm> + using namespace KODI::GUILIB; -CGUIIncludes::CGUIIncludes() -{ - m_constantAttributes.insert("x"); - m_constantAttributes.insert("y"); - m_constantAttributes.insert("width"); - m_constantAttributes.insert("height")...
xbmc/guilib/GUIIncludes.cpp
26
C++
1
suggestion
147
51
51
false
[GUIIncludes]: Minor cleanup and performance optimizations
26,639
xbmc/xbmc
17,740
C++
neo1973
raphaelthegreat
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "interfaces/info/InfoBool.h" #include <map> #include <string> #include <unordered_map> #include <vector>...
Adding back the `<utility>` header for `std::pair` should make Jenkins happy.
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "interfaces/info/InfoBool.h" #include <map> #include <string> #include <unordered_map> #include <utility...
@@ -11,9 +11,8 @@ #include "interfaces/info/InfoBool.h" #include <map> -#include <set> #include <string> -#include <utility> +#include <unordered_map> #include <vector>
xbmc/guilib/GUIIncludes.h
17
C/C++
0.571
refactor
77
42
42
false
[GUIIncludes]: Minor cleanup and performance optimizations
26,639
xbmc/xbmc
17,740
C++
neo1973
raphaelthegreat
}; static_assert(std::ranges::is_sorted(CONSTANT_ATTRIBUTES)); static constexpr std::array<std::string_view, 35> CONSTANT_NODES = { "bordersize", "bottom", "centerbottom", "centerleft", "centerright", "centertop", "depth", "fadetime", "focusposition", "height", "itemgap", "left", "mov...
Now that you changed the approach and the std lib function returns a boolean, maybe it's not necessary to have a function for this anymore and it will not be changed to std::ranges::contains later.
}; static_assert(std::ranges::is_sorted(CONSTANT_ATTRIBUTES)); static constexpr std::array<std::string_view, 35> CONSTANT_NODES = { "bordersize", "bottom", "centerbottom", "centerleft", "centerright", "centertop", "depth", "fadetime", "focusposition", "height", "itemgap", "left", "mov...
@@ -18,72 +18,43 @@ #include "utils/XMLUtils.h" #include "utils/log.h" +#include <algorithm> + using namespace KODI::GUILIB; -CGUIIncludes::CGUIIncludes() +static constexpr std::array<std::string_view, 16> CONSTANT_ATTRIBUTES = { + "acceleration", "border", "center", "delay", "end", "h", "height", "max", ...
xbmc/guilib/GUIIncludes.cpp
26
C++
0.5
suggestion
197
51
51
false
[GUIIncludes]: Minor cleanup and performance optimizations
26,639
xbmc/xbmc
17,740
C++
CrystalP
raphaelthegreat
bool XSLTUtils::SetInput(const std::string& input) { m_xmlInput = xmlParseMemory(input.c_str(), input.size()); if (!m_xmlInput) return false; return true; } bool XSLTUtils::SetStylesheet(const std::string& stylesheet) { if (m_xsltStylesheet) { xsltFreeStylesheet(m_xsltStylesheet); m_xsltStylesheet ...
Consider enhancing the error message for clarity by adding a space (e.g., "could not read stylesheet doc"). ```suggestion CLog::Log(LOGDEBUG, "could not read stylesheet doc"); ```
return true; } bool XSLTUtils::SetInput(const std::string& input) { m_xmlInput = xmlReadMemory(input.c_str(), input.size(), NULL, NULL, XML_PARSE_NOENT); if (!m_xmlInput) return false; return true; } bool XSLTUtils::SetStylesheet(const std::string& stylesheet) { if (m_xsltStylesheet) { xsltFreeStyl...
@@ -84,10 +88,12 @@ bool XSLTUtils::SetStylesheet(const std::string& stylesheet) m_xsltStylesheet = NULL; } - m_xmlStylesheet = xmlParseMemory(stylesheet.c_str(), stylesheet.size()); + m_xmlStylesheet = + xmlReadMemory(stylesheet.c_str(), stylesheet.size(), NULL, NULL, XML_PARSE_NOENT); + if (!m_xml...
xbmc/utils/XSLTUtils.cpp
26
C++
1
bug
183
33
39
false
[tools/depends] Bump libxml2, libxslt, gpg-error, libgcrypt
26,652
xbmc/xbmc
17,740
C++
Copilot
fuzzard
m_processInfo->SeekFinished(0); SetCaching(CACHESTATE_FLUSH); CDVDMsgPlayerSeekChapter& msg(*std::static_pointer_cast<CDVDMsgPlayerSeekChapter>(pMsg)); double start = DVD_NOPTS_VALUE; int offset = 0; // This should always be the case. if (m_pDemuxer) { // SeekCh...
I don't think the `duration_cast` is needed: ```suggestion const auto endTime{std::chrono::duration<double, std::milli>(m_State.timeMax)}; ```
m_processInfo->SeekFinished(0); SetCaching(CACHESTATE_FLUSH); CDVDMsgPlayerSeekChapter& msg(*std::static_pointer_cast<CDVDMsgPlayerSeekChapter>(pMsg)); double start = DVD_NOPTS_VALUE; int offset = 0; // This should always be the case. if (m_pDemuxer) { // SeekCh...
@@ -2878,12 +2878,40 @@ void CVideoPlayer::HandleMessages() int offset = 0; // This should always be the case. - if(m_pDemuxer && m_pDemuxer->SeekChapter(msg.GetChapter(), &start)) + if (m_pDemuxer) { - FlushBuffers(start, true, true); - int64_t beforeSeek = GetTime(); - ...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
1
suggestion
157
51
51
false
[VideoPlayer][EDL] Fix issues when playing file with chapters along with an EDL
26,655
xbmc/xbmc
17,740
C++
neo1973
78andyp
* SPDX-License-Identifier: MIT * See LICENSES/README.md for more information. */ #pragma once #include "qry_dat.h" #include <cstdio> #include <list> #include <map> #include <stdarg.h> #include <string> #include <unordered_map> namespace dbiplus { class Dataset; // forward declaration of class Dataset #define ...
Constexpr int? I think we're moving away from defines
* SPDX-License-Identifier: MIT * See LICENSES/README.md for more information. */ #pragma once #include "qry_dat.h" #include <cstdio> #include <list> #include <map> #include <stdarg.h> #include <string> #include <unordered_map> namespace dbiplus { class Dataset; // forward declaration of class Dataset #define ...
@@ -31,7 +31,7 @@ class Dataset; // forward declaration of class Dataset #define DB_CONNECTION_NONE 0 #define DB_CONNECTION_OK 1 -#define DB_CONNECTION_BAD 2 +#define DB_CONNECTION_DATABASE_NOT_FOUND 2
xbmc/dbwrappers/dataset.h
26
C/C++
0.143
suggestion
54
51
51
false
[database] Fix 'endless' waiting on splash screen when connect to remote database(s) fails.
26,661
xbmc/xbmc
17,740
C++
enen92
ksooo
m_dbStatus.clear(); CLog::Log(LOGDEBUG, "{}, updating databases...", __FUNCTION__); const std::shared_ptr<CAdvancedSettings> advancedSettings = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings(); // NOTE: Order here is important. In particular, CTextureDatabase has to be updated // before...
Could you avoid the double-negative? instead, std::all_of(..,..,[](){return db.second == DBStatus::READY;})
m_dbStatus.clear(); CLog::Log(LOGDEBUG, "{}, updating databases...", __FUNCTION__); const std::shared_ptr<CAdvancedSettings> advancedSettings = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings(); // NOTE: Order here is important. In particular, CTextureDatabase has to be updated // before...
@@ -60,6 +61,9 @@ void CDatabaseManager::Initialize() CLog::Log(LOGDEBUG, "{}, updating databases... DONE", __FUNCTION__); m_bIsUpgrading = false; + + return std::none_of(m_dbStatus.cbegin(), m_dbStatus.cend(), + [](const auto& db) { return db.second != DBStatus::READY; });
xbmc/DatabaseManager.cpp
26
C++
0.5
question
108
51
51
false
[database] Fix 'endless' waiting on splash screen when connect to remote database(s) fails.
26,661
xbmc/xbmc
17,740
C++
CrystalP
ksooo
/*! * @brief Get the number of DELETE queries in the queue. * @return The number of queries. */ size_t GetDeleteQueriesCount(); virtual bool GetFilter(CDbUrl& dbUrl, Filter& filter, SortDescription& sorting) { return true; } virtual bool BuildSQL(const std::string& strBaseDir, ...
newline to separate from next line please
/*! * @brief Get the number of DELETE queries in the queue. * @return The number of queries. */ size_t GetDeleteQueriesCount(); virtual bool GetFilter(CDbUrl& dbUrl, Filter& filter, SortDescription& sorting) { return true; } virtual bool BuildSQL(const std::string& strBaseDir, ...
@@ -255,7 +255,13 @@ class CDatabase CDbUrl& dbUrl, SortDescription& sorting); - bool Connect(const std::string& dbName, const DatabaseSettings& db, bool create); + enum class ConnectionState + { + STATE_ERROR, + STATE_DATABASE_NOT_FOUND, + STATE_CONNECTED...
xbmc/dbwrappers/Database.h
26
C/C++
0.071
style
41
51
51
false
[database] Fix 'endless' waiting on splash screen when connect to remote database(s) fails.
26,661
xbmc/xbmc
17,740
C++
CrystalP
ksooo
const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); profileManager->GetEventLog().Add(EventPtr(new CNotificationEvent( StringUtils::Format(g_localizeStrings.Get(177), g_sysinfo.GetAppName()), StringUtils::Format(g_localizeStrings.Get(178...
@ksooo can this be read like "if the submitted event takes longer than 1000ms then display the text message on the splash"? i'm asking because i'm testing LE13 on a slow raspberry pi and i _always_ see the message "Database migration in progress... please wait" ..... even though there is no database migration exec...
const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); profileManager->GetEventLog().Add(EventPtr(new CNotificationEvent( StringUtils::Format(g_localizeStrings.Get(177), g_sysinfo.GetAppName()), StringUtils::Format(g_localizeStrings.Get(178...
@@ -577,18 +577,23 @@ bool CApplication::Initialize() // initialize (and update as needed) our databases CDatabaseManager &databaseManager = m_ServiceManager->GetDatabaseManager(); + bool allDatabasesInitialized{false}; CEvent event(true); - CServiceBroker::GetJobManager()->Submit([&databaseManager, &event...
xbmc/application/Application.cpp
26
C++
0.643
performance
588
51
51
false
[database] Fix 'endless' waiting on splash screen when connect to remote database(s) fails.
26,661
xbmc/xbmc
17,740
C++
howie-f
ksooo
// load media manager sources (e.g. root addon type sources depend on language strings to be available) CServiceBroker::GetMediaManager().LoadSources(); const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); profileManager->GetEventLog().Add(EventP...
or is it maybe this `if` that needs to be restored. just guessing
// load media manager sources (e.g. root addon type sources depend on language strings to be available) CServiceBroker::GetMediaManager().LoadSources(); const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); profileManager->GetEventLog().Add(EventP...
@@ -577,18 +577,23 @@ bool CApplication::Initialize() // initialize (and update as needed) our databases CDatabaseManager &databaseManager = m_ServiceManager->GetDatabaseManager(); + bool allDatabasesInitialized{false}; CEvent event(true); - CServiceBroker::GetJobManager()->Submit([&databaseManager, &event...
xbmc/application/Application.cpp
26
C++
0.357
suggestion
65
51
51
false
[database] Fix 'endless' waiting on splash screen when connect to remote database(s) fails.
26,661
xbmc/xbmc
17,740
C++
howie-f
ksooo
// returns negative if left < right, positive if left > right // and 0 if they are identical. // See also the equivalent StringUtils::AlphaNumericCollation() for UFT8 data int64_t StringUtils::AlphaNumericCompare(std::wstring_view left, std::wstring_view right) noexcept { auto l = left.begin(); auto r = right.begin...
The std::distance arguments are reversed. Instead of std::distance(ld, l) which computes l - ld, it should be std::distance(l, ld) to correctly enforce that the number of processed digits is less than 15.
// returns negative if left < right, positive if left > right // and 0 if they are identical. // See also the equivalent StringUtils::AlphaNumericCollation() for UFT8 data int64_t StringUtils::AlphaNumericCompare(std::wstring_view left, std::wstring_view right) noexcept { auto l{left.cbegin()}; auto r{right.cbegin(...
@@ -1066,14 +1067,14 @@ int64_t StringUtils::AlphaNumericCompare(std::wstring_view left, std::wstring_vi { ld = l; lnum = *ld++ - L'0'; - while (ld != left.end() && *ld >= L'0' && *ld <= L'9' && ld < l + 15) + while (ld != left.end() && *ld >= L'0' && *ld <= L'9' && std::distance(ld, l) < 1...
xbmc/utils/StringUtils.cpp
26
C++
0.571
suggestion
204
51
51
false
StringUtils: Fix MSVC iterator assertion
26,664
xbmc/xbmc
17,740
C++
Copilot
neo1973
// returns negative if left < right, positive if left > right // and 0 if they are identical. // See also the equivalent StringUtils::AlphaNumericCollation() for UFT8 data int64_t StringUtils::AlphaNumericCompare(std::wstring_view left, std::wstring_view right) noexcept { auto l = left.begin(); auto r = right.begin...
Similarly, the std::distance call here is reversed; it should be std::distance(r, rd) to correctly determine the digit count in the right-hand string. ```suggestion while (rd != right.end() && *rd >= L'0' && *rd <= L'9' && std::distance(r, rd) < 15) ```
// returns negative if left < right, positive if left > right // and 0 if they are identical. // See also the equivalent StringUtils::AlphaNumericCollation() for UFT8 data int64_t StringUtils::AlphaNumericCompare(std::wstring_view left, std::wstring_view right) noexcept { auto l{left.cbegin()}; auto r{right.cbegin(...
@@ -1066,14 +1067,14 @@ int64_t StringUtils::AlphaNumericCompare(std::wstring_view left, std::wstring_vi { ld = l; lnum = *ld++ - L'0'; - while (ld != left.end() && *ld >= L'0' && *ld <= L'9' && ld < l + 15) + while (ld != left.end() && *ld >= L'0' && *ld <= L'9' && std::distance(ld, l) < 1...
xbmc/utils/StringUtils.cpp
26
C++
1
suggestion
259
51
51
false
StringUtils: Fix MSVC iterator assertion
26,664
xbmc/xbmc
17,740
C++
Copilot
neo1973
EXPECT_EQ(1, StringUtils::FindNumber("aabcaadeaa", "b")); } TEST(TestStringUtils, AlphaNumericCompare) { // less than EXPECT_LT(StringUtils::AlphaNumericCompare(L"123abc", L"abc123"), 0); EXPECT_LT(StringUtils::AlphaNumericCompare(L"123abc", L"124abc"), 0); EXPECT_LT(StringUtils::AlphaNumericCompare(L"123abc...
Something like `EXPECT_LT(StringUtils::AlphaNumericCompare(L"2", L"12"), 0);` would be good as a test of the numeric comparison. The 15 characters limit is weird. It works to avoid overflowing the int64_t used internally, but behavior after 15 digits doesn't make a lot of sense. It's not a practical case though so do...
EXPECT_EQ(1, StringUtils::FindNumber("aabcaadeaa", "b")); } TEST(TestStringUtils, AlphaNumericCompare) { // less than EXPECT_LT(StringUtils::AlphaNumericCompare(L"123abc", L"abc123"), 0); EXPECT_LT(StringUtils::AlphaNumericCompare(L"123abc", L"124abc"), 0); EXPECT_LT(StringUtils::AlphaNumericCompare(L"123abc...
@@ -408,11 +408,25 @@ TEST(TestStringUtils, FindNumber) TEST(TestStringUtils, AlphaNumericCompare) { - int64_t ref, var; - - ref = 0; - var = StringUtils::AlphaNumericCompare(L"123abc", L"abc123"); - EXPECT_LT(var, ref); + // less than + EXPECT_LT(StringUtils::AlphaNumericCompare(L"123abc", L"abc123"), 0); + ...
xbmc/utils/test/TestStringUtils.cpp
26
C++
1
bug
333
51
51
false
StringUtils: Fix MSVC iterator assertion
26,664
xbmc/xbmc
17,740
C++
CrystalP
neo1973
return 0xFFFD; auto plane = planemap[index]; if (plane == nullptr) return r; return static_cast<wchar_t>(plane[r & 0xFF]); } // Compares separately the numeric and alphabetic parts of a wide string. // returns negative if left < right, positive if left > right // and 0 if they are identical. // See also ...
Suggestion: declare lnum here ```suggestion int64_t lnum{*ld++ - L'0'}; ``` so it's not left uninitialized on declaration, and available in the smallest required scope. Same for rnum. lsym and rsym could have a similar treatment (and be const)
return 0xFFFD; auto plane = planemap[index]; if (plane == nullptr) return r; return static_cast<wchar_t>(plane[r & 0xFF]); } // Compares separately the numeric and alphabetic parts of a wide string. // returns negative if left < right, positive if left > right // and 0 if they are identical. // See also ...
@@ -1066,14 +1067,14 @@ int64_t StringUtils::AlphaNumericCompare(std::wstring_view left, std::wstring_vi { ld = l; lnum = *ld++ - L'0';
xbmc/utils/StringUtils.cpp
26
C++
1
suggestion
254
51
51
false
StringUtils: Fix MSVC iterator assertion
26,664
xbmc/xbmc
17,740
C++
CrystalP
neo1973
} bool CDirectoryProvider::OnContextMenu(const std::shared_ptr<CGUIListItem>& item) { const auto fileItem{std::static_pointer_cast<CFileItem>(item)}; const std::string target{GetTarget(*fileItem)}; if (!target.empty()) fileItem->SetProperty("targetwindow", target); return CONTEXTMENU::ShowFor(fileItem, CC...
The condition checking for an unchanged URL may inadvertently skip update processing when m_currentUrl is empty. Please clarify or document the intended behavior for empty URLs to ensure that this case is handled correctly. ```suggestion if (value.empty()) return false; // Explicitly handle empty URLs if ...
} bool CDirectoryProvider::OnContextMenu(const std::shared_ptr<CGUIListItem>& item) { const auto fileItem{std::static_pointer_cast<CFileItem>(item)}; const std::string target{GetTarget(*fileItem)}; if (!target.empty()) fileItem->SetProperty("targetwindow", target); return CONTEXTMENU::ShowFor(fileItem, CC...
@@ -546,32 +698,23 @@ bool CDirectoryProvider::OnContextMenu(const std::shared_ptr<CGUIListItem>& item bool CDirectoryProvider::IsUpdating() const { std::unique_lock<CCriticalSection> lock(m_section); - return m_jobID || m_updateState == DONE || m_updateState == INVALIDATED; + return m_jobID || m_jobPending || m...
xbmc/guilib/listproviders/DirectoryProvider.cpp
26
C++
1
suggestion
409
51
51
false
[guilib/listproviders] Improvements and Fixes
26,665
xbmc/xbmc
17,740
C++
Copilot
ksooo
"SELECT itemType FROM videoversiontype WHERE itemType NOT IN (%i, %i) " "LIMIT 1 ", VIDEOASSETTYPE_VERSION_OLD, VIDEOASSETTYPE_EXTRA_OLD, VIDEOASSETTYPE_VERSION_OLD, VIDEOASSETTYPE_EXTRA_OLD)); if (!m_pDS->eof()) { CLog::LogF(LOGE...
Consider defining the prefix 'pvr://recordings/' as a constant and deriving its length rather than using the hardcoded value 17. This change would improve maintainability if the base URL ever changes.
"SELECT itemType FROM videoversiontype WHERE itemType NOT IN (%i, %i) " "LIMIT 1 ", VIDEOASSETTYPE_VERSION_OLD, VIDEOASSETTYPE_EXTRA_OLD, VIDEOASSETTYPE_VERSION_OLD, VIDEOASSETTYPE_EXTRA_OLD)); if (!m_pDS->eof()) { CLog::LogF(LOGE...
@@ -6698,11 +6698,39 @@ void CVideoDatabase::UpdateTables(int iVersion) "UPDATE videoversiontype SET itemType = itemType + 1 WHERE itemType IN (%i, %i)", VIDEOASSETTYPE_VERSION_OLD, VIDEOASSETTYPE_EXTRA_OLD)); } + + if (iVersion < 135) + { + // Fix PVR recording path encoding bug. + m_pDS-...
xbmc/video/VideoDatabase.cpp
26
C++
0.571
suggestion
200
51
51
false
[pvr][video] Fix PVR recordings URL encoding bug (needs video database schema bump).
26,678
xbmc/xbmc
17,740
C++
Copilot
ksooo
class CPVRSubscriber : public CDirectoryProvider::CSubscriber { public: explicit CPVRSubscriber(ISubscriberCallback& invalidate) : CDirectoryProvider::CSubscriber(invalidate) { CServiceBroker::GetPVRManager().Events().Subscribe(this, &CPVRSubscriber::OnPVRManagerEvent); } ~CPVRSubscriber() override { C...
The use of m_pvrStarted.test() may be problematic since std::atomic_flag does not define a test() function in standard C++. Consider switching to std::atomic<bool> or an alternative method to check the flag state. ```suggestion bool IsReadyToUse() const override { return m_pvrStarted.load(); } private: void OnPVRM...
OnEventPublished(); } }; class CPVRSubscriber : public CDirectoryProvider::CSubscriber { public: explicit CPVRSubscriber(ISubscriberCallback& invalidate) : CDirectoryProvider::CSubscriber(invalidate) { CServiceBroker::GetPVRManager().Events().Subscribe(this, &CPVRSubscriber::OnPVRManagerEvent); } ...
@@ -157,9 +160,20 @@ class CPVRSubscriber : public CDirectoryProvider::CSubscriber } ~CPVRSubscriber() override { CServiceBroker::GetPVRManager().Events().Unsubscribe(this); } + bool IsReadyToUse() const override { return m_pvrStarted.test(); } + private: void OnPVRManagerEvent(const PVR::PVREvent& event) ...
xbmc/guilib/listproviders/DirectoryProvider.cpp
26
C++
1
suggestion
663
51
51
false
[guilib/listproviders] CDirectoryProvider: Ignore PVR events until PVR manager is fully initalized.
26,699
xbmc/xbmc
17,740
C++
Copilot
ksooo
if (offset < 0) offset = 0; dirty |= nib->SetPosition(background->GetXPosition() + offset, background->GetYPosition()); } else { offset = GetProportion(selector) * m_height - rect.Height() / 2; if (offset > m_height - rect.Height()) offset = m_height - rect.Height(); if (offset < 0...
I'm pretty sure this falls apart if the foreground object is opaque, while the background object has transparency. The background would render on top, as both occupy the same layer. For this case, each UI elements has two layers. See https://github.com/sarbes/xbmc/blob/51bef9501591cc8a753c91f97b8f554ad73049cb/xbmc/...
if (offset < 0) offset = 0; dirty |= nib->SetPosition(background->GetXPosition() + offset, background->GetYPosition()); } else { offset = GetProportion(selector) * m_height - rect.Height() / 2; if (offset > m_height - rect.Height()) offset = m_height - rect.Height(); if (offset < 0...
@@ -218,10 +218,19 @@ bool CGUISliderControl::ProcessSelector(CGUITexture* background, void CGUISliderControl::Render() { - if (!IsDisabled()) - m_guiBackground->Render(); - else - m_guiBackgroundDisabled->Render(); + const bool renderFrontToBack = CServiceBroker::GetWinSystem()->GetGfxContext().GetRenderO...
xbmc/guilib/GUISliderControl.cpp
26
C++
0.429
suggestion
352
51
51
false
GUI: Fix front-to-back rendering for some controls
26,701
xbmc/xbmc
17,740
C++
sarbes
neo1973
info.serial = dvdNavigator.GetDVDSerialString(); } return info; } UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& mediaPath) { DiscInfo info; #ifdef HAVE_LIBBLURAY XFILE::CBlurayDirectory bdDir; if (!bdDir.InitializeBluray(mediaPath)) return info; info.type = DiscType::...
`static constexpr ...` - no need to construct the arry on every invocation of the function.
info.serial = dvdNavigator.GetDVDSerialString(); } return info; } UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& mediaPath) { DiscInfo info; #ifdef HAVE_LIBBLURAY XFILE::CBlurayDirectory bdDir; if (!bdDir.InitializeBluray(mediaPath)) return info; info.type = DiscType::...
@@ -66,3 +75,26 @@ UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& medi #endif return info; } + +bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) +{ + if (!item.IsDiscImage()) + return false; + + constexpr std::array<const char*, 4> blurayFiles = {
xbmc/utils/DiscsUtils.cpp
26
C++
0.357
suggestion
91
43
42
false
Fix - After #26319 DVD ISO images no longer play.
26,705
xbmc/xbmc
17,740
C++
ksooo
78andyp
#ifdef HAVE_LIBBLURAY XFILE::CBlurayDirectory bdDir; if (!bdDir.InitializeBluray(mediaPath)) return info; info.type = DiscType::BLURAY; info.name = bdDir.GetBlurayTitle(); info.serial = bdDir.GetBlurayID(); #endif return info; } bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) { if (!item...
shorter: ```c++ CURL url("udf://"); url.SetHostName(item.GetDynPath()); ```
#ifdef HAVE_LIBBLURAY XFILE::CBlurayDirectory bdDir; if (!bdDir.InitializeBluray(mediaPath)) return info; info.type = DiscType::BLURAY; info.name = bdDir.GetBlurayTitle(); info.serial = bdDir.GetBlurayID(); #endif return info; } bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) { if (!item...
@@ -66,3 +75,26 @@ UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& medi #endif return info; } + +bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) +{ + if (!item.IsDiscImage()) + return false; + + constexpr std::array<const char*, 4> blurayFiles = { + "index.bdmv", +...
xbmc/utils/DiscsUtils.cpp
26
C++
0.643
suggestion
85
35
34
false
Fix - After #26319 DVD ISO images no longer play.
26,705
xbmc/xbmc
17,740
C++
ksooo
78andyp
info.serial = dvdNavigator.GetDVDSerialString(); } return info; } UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& mediaPath) { DiscInfo info; #ifdef HAVE_LIBBLURAY XFILE::CBlurayDirectory bdDir; if (!bdDir.InitializeBluray(mediaPath)) return info; info.type = DiscType::...
`std::array<std::string_view, 4>` saves calling `strlen` over and over again.
info.serial = dvdNavigator.GetDVDSerialString(); } return info; } UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& mediaPath) { DiscInfo info; #ifdef HAVE_LIBBLURAY XFILE::CBlurayDirectory bdDir; if (!bdDir.InitializeBluray(mediaPath)) return info; info.type = DiscType::...
@@ -66,3 +75,25 @@ UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& medi #endif return info; } + +bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) +{ + if (!item.IsDiscImage()) + return false; + + static constexpr std::array<const char*, 4> blurayFiles = {
xbmc/utils/DiscsUtils.cpp
26
C++
0.357
suggestion
77
42
42
false
Fix - After #26319 DVD ISO images no longer play.
26,705
xbmc/xbmc
17,740
C++
neo1973
78andyp
info.name = bdDir.GetBlurayTitle(); info.serial = bdDir.GetBlurayID(); #endif return info; } bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) { if (!item.IsDiscImage()) return false; static constexpr std::array<const char*, 4> blurayFiles = { "index.bdmv", "INDEX.BDM", "BDMV...
```suggestion return std::ranges::any_of(blurayFiles, [&url](std::string_view file) { url.SetFileName(file); return XFILE::CFile::Exists(url.Get()); }); ``` If y...
info.name = bdDir.GetBlurayTitle(); info.serial = bdDir.GetBlurayID(); #endif return info; } bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) { if (!item.IsDiscImage()) return false; static constexpr std::array<std::string_view, 4> blurayFiles = { "index.bdmv", "INDEX.BDM", ...
@@ -66,3 +75,25 @@ UTILS::DISCS::DiscInfo UTILS::DISCS::ProbeBlurayDiscInfo(const std::string& medi #endif return info; } + +bool UTILS::DISCS::IsBlurayDiscImage(const CFileItem& item) +{ + if (!item.IsDiscImage()) + return false; + + static constexpr std::array<const char*, 4> blurayFiles = { + "index.b...
xbmc/utils/DiscsUtils.cpp
26
C++
1
suggestion
592
28
28
false
Fix - After #26319 DVD ISO images no longer play.
26,705
xbmc/xbmc
17,740
C++
neo1973
78andyp
* Copyright (C) 2022 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "DiscsUtils.h" #include "FileItem.h" #include "URL.h" //! @todo it's wrong to include videoplayer scoped files, refactor // d...
The `<ranges>` header isn't needed, `std::ranges::any_of` is in `<algorithm>`.
* Copyright (C) 2022 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "DiscsUtils.h" #include "FileItem.h" #include "URL.h" //! @todo it's wrong to include videoplayer scoped files, refactor // d...
@@ -18,6 +20,14 @@ #include "filesystem/BlurayDirectory.h" #endif +#include "filesystem/File.h" + +#include <algorithm> +#include <array> +#include <ranges>
xbmc/utils/DiscsUtils.cpp
26
C++
0.357
suggestion
78
51
51
false
Fix - After #26319 DVD ISO images no longer play.
26,705
xbmc/xbmc
17,740
C++
neo1973
78andyp
class CFileItemList : public CFileItem { public: enum class CacheType { NEVER = 0, IF_SLOW, ALWAYS }; CFileItemList(); explicit CFileItemList(const std::string& strPath); ~CFileItemList() override; void Archive(CArchive& ar) override; CFileItemPtr operator[](int iItem); const CFileItemPtr...
Update any related documentation or comments to reflect that GetList() now returns a reference to a std::vector<std::shared_ptr<CFileItem>>. ```suggestion CFileItemPtr Get(int iItem) const; /*! \brief Get the list of file items This method returns a constant reference to the internal vector of shared pointer...
class CFileItemList : public CFileItem { public: enum class CacheType { NEVER = 0, IF_SLOW, ALWAYS }; CFileItemList(); explicit CFileItemList(const std::string& strPath); ~CFileItemList() override; void Archive(CArchive& ar) override; CFileItemPtr operator[](int iItem); const CFileItemPtr...
@@ -50,7 +50,7 @@ class CFileItemList : public CFileItem void Remove(CFileItem* pItem); void Remove(int iItem); CFileItemPtr Get(int iItem) const;
xbmc/FileItemList.h
26
C/C++
1
suggestion
489
51
51
false
Remove VECFILEITEMS
26,717
xbmc/xbmc
17,740
C++
Copilot
notspiff
{ "title", FieldTitle, CDatabaseQueryRule::TEXT_FIELD, NULL, true, 556 }, { "sorttitle", FieldSortTitle, CDatabaseQueryRule::TEXT_FIELD, NULL, false, 171 }, { "originaltitle", FieldOrig...
20410 was an existing language field for "Trailer" Not sure if its OK to re-use that here? I also wasnt sure about "browsable" value here. I've gone with false
{ "title", FieldTitle, CDatabaseQueryRule::TEXT_FIELD, NULL, true, 556 }, { "sorttitle", FieldSortTitle, CDatabaseQueryRule::TEXT_FIELD, NULL, false, 171 }, { "originaltitle", FieldOrig...
@@ -94,6 +94,7 @@ static const translateField fields[] = { { "actor", FieldActor, CDatabaseQueryRule::TEXT_FIELD, NULL, true, 20337 }, { "writers", FieldWriter, CDatabaseQueryRule::TEXT_FIELD, NULL, ...
xbmc/playlists/SmartPlayList.cpp
26
C++
0.5
suggestion
165
51
51
false
[TVSHOWS][JSON-RPC] Add hastrailer filter and expose trailer property
26,719
xbmc/xbmc
17,740
C++
matthuisman
matthuisman
std::string CSmartPlaylistRule::GetBooleanQuery(const std::string &negate, const std::string &strType) const { if (strType == "movies") { if (m_field == FieldInProgress) return "movie_view.idFile " + negate + " IN (SELECT DISTINCT idFile FROM bookmark WHERE type = 1)"; else if (m_field == FieldTrailer...
this is adding the hastrailer logic for tvshows to match movies :)
{ if (strType == "movies") { if (m_field == FieldInProgress) return "movie_view.idFile " + negate + " IN (SELECT DISTINCT idFile FROM bookmark WHERE type = 1)"; else if (m_field == FieldTrailer) return negate + GetField(m_field, strType) + "!= ''"; else if (m_field == FieldHasVideoVersions |...
@@ -865,6 +867,8 @@ std::string CSmartPlaylistRule::GetBooleanQuery(const std::string &negate, const "(SELECT 1 FROM episode_view WHERE episode_view.idShow = " + GetField(FieldId, strType) + " AND episode_view.resumeTimeInSeconds > 0)" ")" ...
xbmc/playlists/SmartPlayList.cpp
26
C++
0.143
suggestion
66
51
51
false
[TVSHOWS][JSON-RPC] Add hastrailer filter and expose trailer property
26,719
xbmc/xbmc
17,740
C++
matthuisman
matthuisman
if (index < 0) return index; if (asIndex) { // see VideoDatabase.h // the first field is the item's ID and the second is the item's file ID index += 2; } } else if (mediaType == MediaTypeTvShow) { if (field == FieldId) return 0; else if (field == FieldTitle) index ...
jenkins wanted this on newline
if (index < 0) return index; if (asIndex) { // see VideoDatabase.h // the first field is the item's ID and the second is the item's file ID index += 2; } } else if (mediaType == MediaTypeTvShow) { // clang-format off if (field == FieldId) return 0; else if (fie...
@@ -741,6 +743,8 @@ int DatabaseUtils::GetField(Field field, const MediaType &mediaType, bool asInde else if (field == FieldGenre) index = VIDEODB_ID_TV_GENRE; else if (field == FieldMPAA) index = VIDEODB_ID_TV_MPAA; else if (field == FieldStudio) index = VIDEODB_ID_TV_STUDIOS; + else if (field == Fie...
xbmc/utils/DatabaseUtils.cpp
26
C++
0.071
style
30
51
51
false
[TVSHOWS][JSON-RPC] Add hastrailer filter and expose trailer property
26,719
xbmc/xbmc
17,740
C++
matthuisman
matthuisman
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "playlists/PlayListTypes.h" #include "video/VideoDatabase.h" #include "video/VideoThumbLoader.h" #include...
It would be beneficial to document the specific enum return values (RESULT_ERROR, RESULT_OK_UPDATED, RESULT_OK_NOT_UPDATED) to clarify the function's behavior for future maintainers.
static bool OnUnAssignContent(const std::string &path, int header, int text); static bool StackingAvailable(const CFileItemList &items); void UpdateVideoVersionItems(); void UpdateVideoVersionItemsLabel(const std::string& directory); CGUIDialogProgress* m_dlgProgress; CVideoDatabase m_database; CVideo...
@@ -122,11 +122,19 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse bool m_stackingAvailable; private: + enum class ShowInfoResult + { + RESULT_ERROR, // some error occured + RESULT_OK_UPDATED, // no error, data updated + RESULT_OK_NOT_UPDATED, // no error, data not u...
xbmc/video/windows/GUIWindowVideoBase.h
26
C/C++
0.571
suggestion
182
133
31
false
[video] Fix CGUIWindowVideoBase::ShowInfoAndRefresh return value. …
26,723
xbmc/xbmc
17,740
C++
Copilot
ksooo
const int itemNumber{m_viewControl.GetSelectedItem()}; Refresh(); m_viewControl.SetSelectedItem(itemNumber); } return ret; } void CGUIWindowVideoBase::OnQueueItem(int iItem, bool first) { if (iItem < 0 || iItem >= m_vecItems->Size()) return; OnQueueItem(m_vecItems->Get(iItem), iItem, first); ...
[nitpick] If all enum cases for ShowInfoResult are explicitly handled in the switch, consider either removing the default branch or adding a comment to clarify its inclusion for future maintainers.
const ShowInfoResult result{ShowInfo(item, info)}; switch (result) { using enum ShowInfoResult; case RESULT_ERROR: return false; case RESULT_OK_NOT_UPDATED: return true; case RESULT_OK_UPDATED: { // Test IsActive() since we can be called from other windows (music, home) we n...
@@ -506,22 +511,37 @@ bool CGUIWindowVideoBase::ShowInfo(const CFileItemPtr& item2, const ScraperPtr& listNeedsUpdating = true; } while (needsRefresh); - return listNeedsUpdating; + return listNeedsUpdating ? RESULT_OK_UPDATED : RESULT_OK_NOT_UPDATED; } bool CGUIWindowVideoBase::ShowInfoAndRefresh(const...
xbmc/video/windows/GUIWindowVideoBase.cpp
26
C++
0.786
suggestion
197
51
51
false
[video] Fix CGUIWindowVideoBase::ShowInfoAndRefresh return value. …
26,723
xbmc/xbmc
17,740
C++
Copilot
ksooo
#include "AutoSwitch.h" #include "FileItem.h" #include "FileItemList.h" #include "ServiceBroker.h" #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" #include "guilib/WindowIDs.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "view/ViewState.h" #include <algorithm>...
The naming doesn't follow the code guide: https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#83-enums
#include "AutoSwitch.h" #include "FileItem.h" #include "FileItemList.h" #include "ServiceBroker.h" #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" #include "guilib/WindowIDs.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "view/ViewState.h" #include <algorithm>...
@@ -18,21 +18,29 @@ #include "settings/SettingsComponent.h" #include "view/ViewState.h" -#define METHOD_BYFOLDERS 0 -#define METHOD_BYFILES 1 -#define METHOD_BYTHUMBPERCENT 2 -#define METHOD_BYFILECOUNT 3 -#define METHOD_BYFOLDERTHUMBS 4 +#include <algorithm> -CAutoSwitch::CAutoSwitch(void) = default; +namespa...
xbmc/AutoSwitch.cpp
26
C++
0.286
style
115
51
51
false
CAutoSwitch: simplify and clean up
26,724
xbmc/xbmc
17,740
C++
neo1973
notspiff
{ std::unique_lock<CCriticalSection> lock(m_lock); if (iItem > -1 && iItem < static_cast<int>(m_items.size())) return m_items[iItem]; return CFileItemPtr(); } CFileItemPtr CFileItemList::Get(const std::string& strPath) const { std::unique_lock<CCriticalSection> lock(m_lock); if (m_fastLookup) { ...
I think you can do ```c++ return it != m_items.end() ? *it : {}; ``` Saves an extra reference to an unnecessary-to-begin-with typedef.
{ std::unique_lock<CCriticalSection> lock(m_lock); if (iItem > -1 && iItem < static_cast<int>(m_items.size())) return m_items[iItem]; return CFileItemPtr(); } CFileItemPtr CFileItemList::Get(const std::string& strPath) const { std::unique_lock<CCriticalSection> lock(m_lock); if (m_fastLookup) { ...
@@ -299,20 +284,15 @@ CFileItemPtr CFileItemList::Get(const std::string& strPath) const return CFileItemPtr(); } // slow method... - for (unsigned int i = 0; i < m_items.size(); i++) - { - CFileItemPtr pItem = m_items[i]; - if (pItem->IsPath(m_ignoreURLOptions ? CURL(strPath).GetWithoutOptions() : st...
xbmc/FileItemList.cpp
26
C++
1
suggestion
142
51
51
false
CFileItemList: some janitoring
26,733
xbmc/xbmc
17,740
C++
garbear
notspiff
} //////////////////////////////////////////////////////////////////////////////////// // Function: ParseTag() // Reads CUE data from string buffer, and constructs the track database information //////////////////////////////////////////////////////////////////////////////////// bool CCueDocument::ParseTag(const std::...
I wonder if this is really necessary, it seems to me that using transform reduces code readability
{ FileReader reader(strFilePath); return Parse(reader, strFilePath); } //////////////////////////////////////////////////////////////////////////////////// // Function: ParseTag() // Reads CUE data from string buffer, and constructs the track database information ///////////////////////////////////////////////////...
@@ -169,66 +172,71 @@ bool CCueDocument::ParseTag(const std::string &strContent) ////////////////////////////////////////////////////////////////////////////////// void CCueDocument::GetSongs(VECSONGS &songs) { - const std::shared_ptr<CAdvancedSettings> advancedSettings = CServiceBroker::GetSettingsComponent()->Get...
xbmc/CueDocument.cpp
26
C++
0.143
suggestion
98
51
51
false
CueDocument; some janitoring
26,737
xbmc/xbmc
17,740
C++
CastagnaIT
notspiff
case LOGWARNING: return spdlog::level::warn; case LOGERROR: return spdlog::level::err; case LOGFATAL: return spdlog::level::critical; case LOGNONE: return spdlog::level::off; default: break; } return spdlog::level::info; } void CLog::FormatAndLogInternal(spdlog::...
`FormatLineBreaks()` only is used here, then maybe remove this method and call directly: `StringUtils::Replace(message, "\n", "\n ");`
return spdlog::level::warn; case LOGERROR: return spdlog::level::err; case LOGFATAL: return spdlog::level::critical; case LOGNONE: return spdlog::level::off; default: break; } return spdlog::level::info; } void CLog::FormatAndLogInternal(spdlog::level::level_enum lev...
@@ -272,6 +272,21 @@ spdlog::level::level_enum CLog::MapLogLevel(int level) return spdlog::level::info; } +void CLog::FormatAndLogInternal(spdlog::level::level_enum level, + fmt::string_view format, + fmt::format_args args) +{ + if (level < m_defaultL...
xbmc/utils/log.cpp
26
C++
0.714
refactor
194
51
51
false
CLog: Format log message only if message is actually logged
26,745
xbmc/xbmc
17,740
C++
thexai
neo1973
return spdlog::level::warn; case LOGERROR: return spdlog::level::err; case LOGFATAL: return spdlog::level::critical; case LOGNONE: return spdlog::level::off; default: break; } return spdlog::level::info; } void CLog::FormatAndLogInternal(spdlog::level::level_enum lev...
Can anybody tell me what "prefix length" is and why we need this fixup?
case LOGERROR: return spdlog::level::err; case LOGFATAL: return spdlog::level::critical; case LOGNONE: return spdlog::level::off; default: break; } return spdlog::level::info; } void CLog::FormatAndLogInternal(spdlog::level::level_enum level, ...
@@ -282,7 +282,7 @@ void CLog::FormatAndLogInternal(spdlog::level::level_enum level, auto message = fmt::vformat(format, args); // fixup newline alignment, number of spaces should equal prefix length - FormatLineBreaks(message); + StringUtils::Replace(message, "\n", "\n ...
xbmc/utils/log.cpp
26
C++
0.143
question
71
51
51
false
CLog: Format log message only if message is actually logged
26,745
xbmc/xbmc
17,740
C++
ksooo
neo1973
.clips = {}, .languages = {}}; if (!m_groups.empty() && m_groups.back().back().playlist == playlist - 1) m_groups.back().emplace_back(groupPlaylist); else m_groups.emplace_back(std::vector{group...
You can consider using a transform instead of a loop: ```cpp std::ranges::transform( longPlaylists, std::back_inserter(m_groups), [](const auto& PlaylistInformation) -> std::vector<CandidatePlaylistInformation> { const auto& [playlist, playlistInformation] = Playlis...
.clips = {}, .languages = {}}; if (!m_groups.empty() && m_groups.back().back().playlist == playlist - 1) m_groups.back().emplace_back(groupPlaylist); else m_groups.emplace_back(std::vector{group...
@@ -226,36 +240,38 @@ void CDiscDirectoryHelper::FindGroups(const PlaylistMap& playlists) .duration = playlistInformation.duration, .clips = {}, .languages = {}}; - ...
xbmc/filesystem/DiscDirectoryHelper.cpp
26
C++
1
suggestion
592
51
51
false
[Video][Bluray] Further improvements to episode matching heuristics.
26,750
xbmc/xbmc
17,740
C++
neo1973
78andyp