Advertisement
Guest User

Untitled

a guest
Mar 18th, 2021
22
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- a/xbmc/filesystem/PluginDirectory.cpp   Tue Mar 16 13:28:28 2021
  2. +++ b/xbmc/filesystem/PluginDirectory.cpp   Mon Mar 15 23:15:16 2021
  3. @@ -348,6 +348,12 @@
  4.          dir->m_listItems->AddSortMethod(SortBySortTitle, 556, LABEL_MASKS("%T", "%M", "%T", "%M"), CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING) ? SortAttributeIgnoreArticle : SortAttributeNone);
  5.          break;
  6.        }
  7. +      case SORT_METHOD_VIDEO_ORIGINAL_TITLE:
  8. +      case SORT_METHOD_VIDEO_ORIGINAL_TITLE_IGNORE_THE:
  9. +      {
  10. +        dir->m_listItems->AddSortMethod(SortByOriginalTitle, 20376, LABEL_MASKS("%T", "%M", "%T", "%M"), CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING) ? SortAttributeIgnoreArticle : SortAttributeNone);
  11. +        break;
  12. +      }
  13.      case SORT_METHOD_MPAA_RATING:
  14.        {
  15.          dir->m_listItems->AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O", "%T", "%O"));
  16. --- a/xbmc/interfaces/legacy/ModuleXbmcplugin.h Tue Mar 16 13:28:28 2021
  17. +++ b/xbmc/interfaces/legacy/ModuleXbmcplugin.h Mon Mar 15 22:17:22 2021
  18. @@ -461,6 +461,8 @@
  19.      SWIG_CONSTANT(int, SORT_METHOD_VIDEO_TITLE);
  20.      SWIG_CONSTANT(int, SORT_METHOD_VIDEO_SORT_TITLE);
  21.      SWIG_CONSTANT(int, SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE);
  22. +    SWIG_CONSTANT(int, SORT_METHOD_VIDEO_ORIGINAL_TITLE);
  23. +    SWIG_CONSTANT(int, SORT_METHOD_VIDEO_ORIGINAL_TITLE_IGNORE_THE);
  24.      SWIG_CONSTANT(int, SORT_METHOD_PRODUCTIONCODE);
  25.      SWIG_CONSTANT(int, SORT_METHOD_SONG_RATING);
  26.      SWIG_CONSTANT(int, SORT_METHOD_MPAA_RATING);
  27. --- a/xbmc/playlists/SmartPlayList.cpp  Tue Mar 16 13:28:28 2021
  28. +++ b/xbmc/playlists/SmartPlayList.cpp  Tue Mar 16 11:01:06 2021
  29. @@ -525,6 +525,7 @@
  30.    else if (type == "tvshows")
  31.    {
  32.      orders.push_back(SortBySortTitle);
  33. +    orders.push_back(SortByOriginalTitle);
  34.      orders.push_back(SortByTvShowStatus);
  35.      orders.push_back(SortByVotes);
  36.      orders.push_back(SortByRating);
  37. @@ -543,6 +544,7 @@
  38.    else if (type == "episodes")
  39.    {
  40.      orders.push_back(SortByTitle);
  41. +    orders.push_back(SortByOriginalTitle);
  42.      orders.push_back(SortByTvShowTitle);
  43.      orders.push_back(SortByVotes);
  44.      orders.push_back(SortByRating);
  45. @@ -562,6 +564,7 @@
  46.    else if (type == "movies")
  47.    {
  48.      orders.push_back(SortBySortTitle);
  49. +    orders.push_back(SortByOriginalTitle);
  50.      orders.push_back(SortByVotes);
  51.      orders.push_back(SortByRating);
  52.      orders.push_back(SortByUserRating);
  53. --- a/xbmc/utils/SortUtils.cpp  Tue Mar 16 13:28:28 2021
  54. +++ b/xbmc/utils/SortUtils.cpp  Tue Mar 16 12:36:28 2021
  55. @@ -244,6 +244,22 @@
  56.    return title;
  57.  }
  58.  
  59. +std::string ByOriginalTitle(SortAttribute attributes, const SortItem& values)
  60. +{
  61. +
  62. +  std::string title = values.at(FieldOriginalTitle).asString();
  63. +  if (title.empty())
  64. +    title = values.at(FieldSortTitle).asString();
  65. +
  66. +  if (title.empty())
  67. +    title = values.at(FieldTitle).asString();
  68. +
  69. +  if (attributes & SortAttributeIgnoreArticle)
  70. +    title = SortUtils::RemoveArticles(title);
  71. +
  72. +  return title;
  73. +}
  74. +
  75.  std::string ByRating(SortAttribute attributes, const SortItem &values)
  76.  {
  77.    return StringUtils::Format("%f %s", values.at(FieldRating).asFloat(), ByLabel(attributes, values).c_str());
  78. @@ -605,6 +621,7 @@
  79.    preparators[SortByInstallDate]              = ByInstallDate;
  80.    preparators[SortByLastUpdated]              = ByLastUpdated;
  81.    preparators[SortByLastUsed]                 = ByLastUsed;
  82. +  preparators[SortByOriginalTitle]            = ByOriginalTitle;
  83.  
  84.    return preparators;
  85.  }
  86. @@ -690,6 +707,9 @@
  87.    sortingFields[SortByInstallDate].insert(FieldInstallDate);
  88.    sortingFields[SortByLastUpdated].insert(FieldLastUpdated);
  89.    sortingFields[SortByLastUsed].insert(FieldLastUsed);
  90. +  sortingFields[SortByOriginalTitle].insert(FieldOriginalTitle);
  91. +  sortingFields[SortByOriginalTitle].insert(FieldTitle);
  92. +  sortingFields[SortByOriginalTitle].insert(FieldSortTitle);
  93.    sortingFields.insert(std::pair<SortBy, Fields>(SortByRandom, Fields()));
  94.  
  95.    return sortingFields;
  96. @@ -891,6 +911,8 @@
  97.    { SortByUserRating,               SORT_METHOD_VIDEO_USER_RATING,            SortAttributeIgnoreFolders, 38018 },
  98.    { SortBySortTitle,                SORT_METHOD_VIDEO_SORT_TITLE,             SortAttributeIgnoreFolders, 171 },
  99.    { SortBySortTitle,                SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE,  (SortAttribute)(SortAttributeIgnoreFolders | SortAttributeIgnoreArticle), 171 },
  100. +  { SortByOriginalTitle,            SORT_METHOD_VIDEO_ORIGINAL_TITLE,         SortAttributeIgnoreFolders, 20376 },
  101. +  { SortByOriginalTitle,            SORT_METHOD_VIDEO_ORIGINAL_TITLE_IGNORE_THE,  (SortAttribute)(SortAttributeIgnoreFolders | SortAttributeIgnoreArticle), 20376 },
  102.    { SortByYear,                     SORT_METHOD_YEAR,                         SortAttributeIgnoreFolders, 562 },
  103.    { SortByProductionCode,           SORT_METHOD_PRODUCTIONCODE,               SortAttributeNone,          20368 },
  104.    { SortByProgramCount,             SORT_METHOD_PROGRAM_COUNT,                SortAttributeNone,          567 }, // label is "play count"
  105. @@ -1053,6 +1075,7 @@
  106.    { "installdate",      SortByInstallDate },
  107.    { "lastupdated",      SortByLastUpdated },
  108.    { "lastused",         SortByLastUsed },
  109. +  { "originaltitle",    SortByOriginalTitle },
  110.  };
  111.  
  112.  SortBy SortUtils::SortMethodFromString(const std::string& sortMethod)
  113. --- a/xbmc/utils/SortUtils.h    Tue Mar 16 13:28:28 2021
  114. +++ b/xbmc/utils/SortUtils.h    Mon Mar 15 22:07:42 2021
  115. @@ -153,6 +153,8 @@
  116.    SortByLastUpdated,
  117.    /// __52__ : Sort by last used                  <em>(String: <b><c>lastused</c></b>)</em>
  118.    SortByLastUsed,
  119. +  /// __53__ : Sort by original title             <em>(String: <b><c>OriginalTitle</c></b>)</em>
  120. +  SortByOriginalTitle,
  121.  } SortBy;
  122.  ///@}
  123.  
  124. --- a/xbmc/video/GUIViewStateVideo.cpp  Tue Mar 16 13:28:28 2021
  125. +++ b/xbmc/video/GUIViewStateVideo.cpp  Tue Mar 16 12:35:57 2021
  126. @@ -126,6 +126,7 @@
  127.      case NODE_TYPE_INPROGRESS_TVSHOWS:
  128.        {
  129.          AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%M", "%T", "%M"));  // Title, #Episodes | Title, #Episodes
  130. +        AddSortMethod(SortByOriginalTitle, sortAttributes, 20376, LABEL_MASKS("%T", "%M", "%T", "%M"));  // Title, #Episodes | Title, #Episodes
  131.  
  132.          AddSortMethod(SortByNumberOfEpisodes, 20360, LABEL_MASKS("%L", "%M", "%L", "%M"));  // Label, #Episodes | Label, #Episodes
  133.          AddSortMethod(SortByLastPlayed, 568, LABEL_MASKS("%T", "%p", "%T", "%p"));  // Title, #Last played | Title, #Last played
  134. @@ -230,11 +231,13 @@
  135.          {
  136.            AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y"));  // Title, Year | empty, empty
  137.            AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R"));  // Title, Rating | empty, empty
  138. +          AddSortMethod(SortByOriginalTitle, sortAttributes, 20376, LABEL_MASKS("%T", "%R"));  // Title, Rating | empty, empty
  139.          }
  140.          else
  141.          {
  142.            AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R", "%T", "%R"));  // Title, Rating | Title, Rating
  143. -          AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y"));  // Title, Year | Title, Year
  144. +          AddSortMethod(SortByOriginalTitle, sortAttributes, 20376, LABEL_MASKS("%T", "%R", "%T", "%R"));  // Title, Rating | Title, Rating
  145. +          AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
  146.          }
  147.          AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R", "%T", "%R"));  // Title, Rating | Title, Rating
  148.          AddSortMethod(SortByUserRating, 38018, LABEL_MASKS("%T", "%r", "%T", "%r"));  // Title, Userrating | Title, Userrating
  149. @@ -439,6 +442,8 @@
  150.  CGUIViewStateVideoMovies::CGUIViewStateVideoMovies(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
  151.  {
  152.    AddSortMethod(SortBySortTitle, 556, LABEL_MASKS("%T", "%R", "%T", "%R"),  // Title, Rating | Title, Rating
  153. +    CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING) ? SortAttributeIgnoreArticle : SortAttributeNone);
  154. +  AddSortMethod(SortByOriginalTitle, 20376, LABEL_MASKS("%T", "%R", "%T", "%R"),  // Title, Rating | Title, Rating
  155.      CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING) ? SortAttributeIgnoreArticle : SortAttributeNone);
  156.    AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y"));  // Title, Year | Title, Year
  157.    AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R", "%T", "%R"));  // Title, Rating | Title, Rating
  158. --- a/xbmc/video/VideoDatabase.cpp  Tue Mar 16 13:28:28 2021
  159. +++ b/xbmc/video/VideoDatabase.cpp  Tue Mar 16 12:33:36 2021
  160. @@ -6961,7 +6961,8 @@
  161.        sortDescription.sortBy == SortByUserRating ||
  162.        sortDescription.sortBy == SortByYear ||
  163.        sortDescription.sortBy == SortByLastPlayed ||
  164. -      sortDescription.sortBy == SortByPlaycount)
  165. +      sortDescription.sortBy == SortByPlaycount ||
  166. +      sortDescription.sortBy == SortByOriginalTitle)
  167.      sorting.sortAttributes = (SortAttribute)(sortDescription.sortAttributes | SortAttributeIgnoreFolders);
  168.  
  169.    bool success = false;
  170. --- a/xbmc/video/VideoInfoTag.cpp   Tue Mar 16 13:28:28 2021
  171. +++ b/xbmc/video/VideoInfoTag.cpp   Tue Mar 16 12:06:25 2021
  172. @@ -670,6 +670,16 @@
  173.        sortable[FieldSortTitle] = m_strSortTitle;
  174.      break;
  175.    }
  176. +  case FieldOriginalTitle:
  177. +  {
  178. +    // seasons with a custom name/title need special handling as they should be sorted by season number
  179. +    if (m_type == MediaTypeSeason && !m_strOriginalTitle.empty())
  180. +      sortable[FieldOriginalTitle] =
  181. +          StringUtils::Format(g_localizeStrings.Get(20358).c_str(), m_iSeason);
  182. +    else
  183. +      sortable[FieldOriginalTitle] = m_strOriginalTitle;
  184. +    break;
  185. +  }
  186.    case FieldTvShowStatus:             sortable[FieldTvShowStatus] = m_strStatus; break;
  187.    case FieldProductionCode:           sortable[FieldProductionCode] = m_strProductionCode; break;
  188.    case FieldAirDate:                  sortable[FieldAirDate] = m_firstAired.IsValid() ? m_firstAired.GetAsDBDate() : (m_premiered.IsValid() ? m_premiered.GetAsDBDate() : StringUtils::Empty); break;
  189. --- a/xbmc/FileItem.cpp Tue Mar 16 14:58:58 2021
  190. +++ b/xbmc/FileItem.cpp Tue Mar 16 14:58:56 2021
  191. @@ -2267,6 +2267,7 @@
  192.  {
  193.    if (sortDescription.sortBy == SortByFile ||
  194.        sortDescription.sortBy == SortBySortTitle ||
  195. +      sortDescription.sortBy == SortByOriginalTitle ||
  196.        sortDescription.sortBy == SortByDateAdded ||
  197.        sortDescription.sortBy == SortByRating ||
  198.        sortDescription.sortBy == SortByYear ||
  199. --- a/xbmc/SortFileItem.h   Tue Mar 16 13:28:28 2021
  200. +++ b/xbmc/SortFileItem.h   Tue Mar 16 12:37:23 2021
  201. @@ -54,5 +54,7 @@
  202.    SORT_METHOD_CHANNEL_NUMBER,
  203.    SORT_METHOD_BITRATE,
  204.    SORT_METHOD_DATE_TAKEN,
  205. -  SORT_METHOD_MAX
  206. +  SORT_METHOD_MAX,
  207. +  SORT_METHOD_VIDEO_ORIGINAL_TITLE,
  208. +  SORT_METHOD_VIDEO_ORIGINAL_TITLE_IGNORE_THE
  209.  } SORT_METHOD;
  210. --- a/xbmc/interfaces/json-rpc/schema/types.json    Wed Mar 17 20:32:06 2021
  211. +++ b/xbmc/interfaces/json-rpc/schema/types.json    Wed Mar 17 20:32:52 2021
  212. @@ -108,7 +108,7 @@
  213.                    "album", "albumtype", "genre", "country", "year", "rating", "userrating", "votes", "top250", "programcount",
  214.                    "playlist", "episode", "season", "totalepisodes", "watchedepisodes", "tvshowstatus", "tvshowtitle",
  215.                    "sorttitle", "productioncode", "mpaa", "studio", "dateadded", "lastplayed", "playcount", "listeners",
  216. -                  "bitrate", "random" ]
  217. +                  "bitrate", "random", "originaltitle" ]
  218.        },
  219.        "order": { "type": "string", "default": "ascending", "enum": [ "ascending", "descending" ] },
  220.        "ignorearticle": { "type": "boolean", "default": false },
  221.  
Advertisement
RAW Paste Data Copied
Advertisement