Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -7318,7 +7318,19 @@ msgctxt "#13521"
msgid "Choose art type"
msgstr ""

#empty strings from id 13522 to 13549
#. label of a setting that allows splitting of albums into component discs
#: system/settings/settings.xml
msgctxt "#13522"
msgid "Split albums into individual discs"
msgstr ""

#. Description of setting with label #13522 "Split albums into individual discs"
#: system/settings/settings.xml
msgctxt "#13523"
msgid "When enabled, opening a multi-disc album shows the discs as individual items instead of all the songs. Opening a disc then shows the songs on that disc."
msgstr ""

#empty strings from id 13524 to 13549

#: system/settings/settings.xml
msgctxt "#13550"
Expand Down Expand Up @@ -7786,6 +7798,7 @@ msgctxt "#14086"
msgid "Playback"
msgstr ""

#: xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp
#: system/settings/settings.xml
msgctxt "#14087"
msgid "Discs"
Expand Down Expand Up @@ -8399,12 +8412,14 @@ msgstr ""
#: xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRcentlyAdded.cpp
#: xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRcentlyPlayed.cpp
#: xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.cpp
#: xbmc/music/windows/MusicFileItemListModifier.cpp
msgctxt "#15102"
msgid "* All albums"
msgstr ""

#: xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp
#: xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.cpp
#: xbmc/music/windows/MusicFileItemListModifier.cpp
msgctxt "#15103"
msgid "* All artists"
msgstr ""
Expand Down Expand Up @@ -12764,7 +12779,7 @@ msgctxt "#20340"
msgid "Do you want to remove all items within this path from your library?"
msgstr ""

#empty string with id 20341
#empty string with id #20341

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change


#: xbmc/dialogs/GUIDialogMediaFilter.cpp
#: xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp
Expand Down Expand Up @@ -21145,8 +21160,24 @@ msgctxt "#38073"
msgid "Do you want to refresh information for this item now?"
msgstr ""

#empty strings from id 38074 to 38099
#strings 38074 to 38099 reserved for music library
#: system/library/music/musicroles/boxsets.xml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My error system/library/music/boxsets.xml

msgctxt "#38074"
msgid "boxsets"
msgstr ""

#: xbmc/music/windows/MusicFileItemListModifier.cpp
#: xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeDisc.cpp
msgctxt "#38075"
msgid "* All discs"
msgstr ""

#: addons/skin.estuary/xml/Variables.xml
msgctxt "#38076"
msgid "Disc title"
msgstr ""

#empty strings from id 38077 to 38099
#strings 38076 to 38099 reserved for music library

#. Description of section #14200 "Player""
#: system/settings/settings.xml
Expand Down
2 changes: 1 addition & 1 deletion addons/skin.estuary/xml/MusicVisualisation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<top>80</top>
<width>1600</width>
<height>40</height>
<label>$INFO[MusicPlayer.Album]$INFO[MusicPlayer.Year,[COLOR button_focus] [,][/COLOR]]</label>
<label>$INFO[MusicPlayer.Album]$INFO[MusicPlayer.DiscTitle, {,}]$INFO[MusicPlayer.Year,[COLOR button_focus] [,][/COLOR]]</label>
<font>font37</font>
<shadowcolor>black</shadowcolor>
<scroll>true</scroll>
Expand Down
2 changes: 1 addition & 1 deletion addons/skin.estuary/xml/Variables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<value condition="String.IsEqual(listitem.dbtype,musicvideo) | String.IsEqual(listitem.dbtype,video)">$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Plot]</value>
<value condition="String.IsEqual(listitem.dbtype,artist)">$INFO[ListItem.Property(artist_description)]</value>
<value condition="!String.IsEmpty(ListItem.Plot)">$INFO[ListItem.Plot]</value>
<value condition="String.IsEqual(listitem.dbtype,song)">$VAR[MusicTrackInfo,[COLOR button_focus]$LOCALIZE[554]:[/COLOR],[CR]]$INFO[ListItem.Artist,[COLOR button_focus]$LOCALIZE[557]: [/COLOR],[CR]]$INFO[listitem.Album,[COLOR button_focus]$LOCALIZE[558]: [/COLOR],[CR]]$INFO[ListItem.DiscNumber,[COLOR button_focus]$LOCALIZE[427]: [/COLOR],[CR]]$INFO[ListItem.Year,[COLOR button_focus]$LOCALIZE[345]: [/COLOR],[CR]]$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Duration,[COLOR button_focus]$LOCALIZE[180]: [/COLOR],[CR]]$INFO[ListItem.Playcount,[COLOR button_focus]$LOCALIZE[567]: [/COLOR],[CR]]</value>
<value condition="String.IsEqual(listitem.dbtype,song)">$VAR[MusicTrackInfo,[COLOR button_focus]$LOCALIZE[554]:[/COLOR],[CR]]$INFO[ListItem.Artist,[COLOR button_focus]$LOCALIZE[557]: [/COLOR],[CR]]$INFO[listitem.Album,[COLOR button_focus]$LOCALIZE[558]: [/COLOR],[CR]]$INFO[ListItem.DiscNumber,[COLOR button_focus]$LOCALIZE[427]: [/COLOR],[CR]]$INFO[ListItem.DiscTitle,[COLOR button_focus]$LOCALIZE[38076]: [/COLOR],[CR]]$INFO[ListItem.Year,[COLOR button_focus]$LOCALIZE[345]: [/COLOR],[CR]]$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]$INFO[ListItem.Duration,[COLOR button_focus]$LOCALIZE[180]: [/COLOR],[CR]]$INFO[ListItem.Playcount,[COLOR button_focus]$LOCALIZE[567]: [/COLOR],[CR]]</value>
<value>$INFO[ListItem.Genre,[COLOR button_focus]$LOCALIZE[515]: [/COLOR],[CR]]</value>
</variable>
<variable name="MusicTrackInfo">
Expand Down
6 changes: 6 additions & 0 deletions system/library/music/boxsets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<node order="99" type="folder" visible="Library.HasContent(Boxsets)">
<label>38074</label>
<icon>DefaultSets.png</icon>
<path>musicdb://albums/?boxset=true</path>
</node>
5 changes: 5 additions & 0 deletions system/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,11 @@
<default>true</default>
<control type="toggle" />
</setting>
<setting id="musiclibrary.showdiscs" type="boolean" label="13522" help="13523">
<level>0</level>
<default>true</default>
<control type="toggle" />
</setting>
<setting id="musiclibrary.useartistsortname" type="boolean" label="20228" help="36294">
<level>1</level>
<default>false</default>
Expand Down
30 changes: 30 additions & 0 deletions xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,14 @@ const infomap musicpartymode[] = {{ "enabled", MUSICPM_ENABLED },
/// @skinning_v17 **[New Infolabel]** \link MusicPlayer_DBID `MusicPlayer.DBID`\endlink
/// <p>
/// }
/// \table_row3{ <b>`MusicPlayer.DiscTitle`</b>,
/// \anchor MusicPlayer_DiscTitle
/// _string_,
/// @return The title of the disc currently playing.
/// <p><hr>
/// @skinning_v19 **[New Infolabel]** \link MusicPlayer_DiscTitle `MusicPlayer.DiscTitle`\endlink
/// <p>
/// }
/// \table_end
///
/// -----------------------------------------------------------------------------
Expand All @@ -2540,6 +2548,8 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE },
{ "samplerate", MUSICPLAYER_SAMPLERATE },
{ "codec", MUSICPLAYER_CODEC },
{ "discnumber", MUSICPLAYER_DISC_NUMBER },
{ "disctitle", MUSICPLAYER_DISC_TITLE },
{ "isboxset", MUSICPLAYER_IS_BOXSET },
{ "rating", MUSICPLAYER_RATING },
{ "ratingandvotes", MUSICPLAYER_RATING_AND_VOTES },
{ "userrating", MUSICPLAYER_USER_RATING },
Expand Down Expand Up @@ -5717,6 +5727,14 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY },
/// @skinning_v19 **[New Infolabel]** \link ListItem_CurrentItem `ListItem.CurrentItem`\endlink
/// <p>
/// }
/// \table_row3{ <b>`ListItem.DiscTitle`</b>,
/// \anchor ListItem_DiscTitle
/// _string_,
/// @return The disc title of the currently selected album or song.
/// <p><hr>
/// @skinning_v19 **[New Infolabel]** \link ListItem_DiscTitle `ListItem.DiscTitle`\endlink
/// <p>
/// }
/// \table_end
///
/// -----------------------------------------------------------------------------
Expand All @@ -5736,6 +5754,8 @@ const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB },
{ "contributors", LISTITEM_CONTRIBUTORS },
{ "contributorandrole", LISTITEM_CONTRIBUTOR_AND_ROLE },
{ "director", LISTITEM_DIRECTOR },
{ "disctitle", LISTITEM_DISC_TITLE },
{ "isboxset", LISTITEM_IS_BOXSET },
{ "filename", LISTITEM_FILENAME },
{ "filenameandpath", LISTITEM_FILENAME_AND_PATH },
{ "fileextension", LISTITEM_FILE_EXTENSION },
Expand Down Expand Up @@ -8455,6 +8475,14 @@ const infomap slideshow[] = {{ "ispaused", SLIDESHOW_ISPAUSED
/// @skinning_v17 **[New Boolean Condition]** \link Library_HasContent_Role_Mixer `Library.HasContent(Role.Mixer)`\endlink
/// <p>
/// }
/// \table_row3{ <b>`Library.HasContent(boxsets)`</b>,
/// \anchor Library_HasContent_Boxsets
/// _boolean_,
/// @return **True** if there are albums in the library which are boxsets.
/// <p><hr>
/// @skinning_v19 **[New Boolean Condition]** \link Library_HasContent_Boxsets `Library.HasContent(boxsets)`\endlink
/// <p>
/// }
/// \table_end
///
/// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -8869,6 +8897,8 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool
return LIBRARY_HAS_SINGLES;
else if (cat == "compilations")
return LIBRARY_HAS_COMPILATIONS;
else if (cat == "boxsets")
return LIBRARY_HAS_BOXSETS;
else if (cat == "role" && prop.num_params() > 1)
return AddMultiInfo(CGUIInfo(LIBRARY_HAS_ROLE, prop.param(1), 0));
}
Expand Down
6 changes: 5 additions & 1 deletion xbmc/filesystem/LibraryDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ bool CLibraryDirectory::GetDirectory(const CURL& url, CFileItemList &items)
}
else if (type == "folder")
{
std::string label;
if (XMLUtils::GetString(node, "label", label))
label = CGUIControlFactory::FilterLabel(label);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes to CLibraryDirectory can be dropped, they are in PR 16626

items.SetLabel(label);
std::string path;
XMLUtils::GetPath(node, "path", path);
if (!path.empty())
{
URIUtils::AddSlashAtEnd(path);
return CDirectory::GetDirectory(path, items, m_strFileMask, m_flags);
return CDirectory::GetDirectory(path, items, m_strFileMask, m_flags); // Sets localized label based on node type
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions xbmc/filesystem/MusicDatabaseDirectory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(SOURCES DirectoryNodeAlbumCompilations.cpp
DirectoryNodeAlbumTop100.cpp
DirectoryNodeAlbumTop100Song.cpp
DirectoryNodeArtist.cpp
DirectoryNodeDiscs.cpp
DirectoryNode.cpp
DirectoryNodeGrouped.cpp
DirectoryNodeOverview.cpp
Expand All @@ -31,6 +32,7 @@ set(HEADERS DirectoryNode.h
DirectoryNodeAlbumTop100.h
DirectoryNodeAlbumTop100Song.h
DirectoryNodeArtist.h
DirectoryNodeDiscs.h
DirectoryNodeGrouped.h
DirectoryNodeOverview.h
DirectoryNodeRoot.h
Expand Down
3 changes: 3 additions & 0 deletions xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "DirectoryNodeAlbumTop100.h"
#include "DirectoryNodeAlbumTop100Song.h"
#include "DirectoryNodeArtist.h"
#include "DirectoryNodeDiscs.h"
#include "DirectoryNodeGrouped.h"
#include "DirectoryNodeOverview.h"
#include "DirectoryNodeRoot.h"
Expand Down Expand Up @@ -102,6 +103,8 @@ CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const std::string& st
case NODE_TYPE_ROLE:
case NODE_TYPE_YEAR:
return new CDirectoryNodeGrouped(Type, strName, pParent);
case NODE_TYPE_DISC:
return new CDirectoryNodeDiscs(strName, pParent);
case NODE_TYPE_ARTIST:
return new CDirectoryNodeArtist(strName, pParent);
case NODE_TYPE_ALBUM:
Expand Down
3 changes: 2 additions & 1 deletion xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ namespace XFILE
NODE_TYPE_YEAR,
NODE_TYPE_YEAR_ALBUM,
NODE_TYPE_YEAR_SONG,
NODE_TYPE_SINGLES
NODE_TYPE_SINGLES,
NODE_TYPE_DISC,
} NODE_TYPE;

typedef struct {
Expand Down
20 changes: 20 additions & 0 deletions xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
#include "DirectoryNodeAlbum.h"

#include "QueryParams.h"
#include "ServiceBroker.h"
#include "guilib/LocalizeStrings.h"
#include "music/MusicDatabase.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"

using namespace XFILE::MUSICDATABASEDIRECTORY;

Expand All @@ -22,13 +25,30 @@ CDirectoryNodeAlbum::CDirectoryNodeAlbum(const std::string& strName, CDirectoryN

NODE_TYPE CDirectoryNodeAlbum::GetChildType() const
{
if (GetName() == "-1")
return NODE_TYPE_SONG;

//! @todo: This makes all multi-disc albums album > disc > song, make disc level optional
CMusicDatabase musicdatabase;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new music lib setting to enable(default)/disable navigation from multi-disc albums to discs rather than directly to songs, and use it here to allow albums > discs navigation to be optional. That way we can give users original behaviour if they want it.

A search for musiclibrary.showcompilationartists may help you find example of how to do a new setting

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll give it a go.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done that. Default is false and navigation is as it was. Toggling it on enables disc type navigation. Incidentally, extraart still works in original navigation if you have set any up, so the covers change as you scroll up and down the tracks between the discs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users won't see the new grouping as discs feature that way around. Make default having a "discs" level, and they can change the setting to get old behaviour back

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Not 100% sure that it should be turned off for boxsets at all, given that's where we started with all this, but as I can't see a particularly clean way of doing that I'll go with it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm, yes when viewing boxed sets you do always want album > disc...
If I think of a way to do that nicely I'll let you know. At least on by default means users with boxed sets will see the immediate advantage.

if (!CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_MUSICLIBRARY_SHOWDISCS))
return NODE_TYPE_SONG;
if (musicdatabase.Open())
{
int iDiscTotal = -1;
iDiscTotal = musicdatabase.GetAlbumDiscCount(GetID());
musicdatabase.Close();
if (iDiscTotal > 1)
return NODE_TYPE_DISC;
}

return NODE_TYPE_SONG;
}

std::string CDirectoryNodeAlbum::GetLocalizedName() const
{
if (GetID() == -1)
return g_localizeStrings.Get(15102); // All Albums

CMusicDatabase db;
if (db.Open())
return db.GetAlbumById(GetID());
Expand Down
57 changes: 57 additions & 0 deletions xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeDiscs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2005-2019 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 "DirectoryNodeDiscs.h"

#include "QueryParams.h"
#include "guilib/LocalizeStrings.h"
#include "music/MusicDatabase.h"

using namespace XFILE::MUSICDATABASEDIRECTORY;

CDirectoryNodeDiscs::CDirectoryNodeDiscs(const std::string& strName,
CDirectoryNode* pParent)
: CDirectoryNode(NODE_TYPE_DISC, strName, pParent)
{
}

NODE_TYPE CDirectoryNodeDiscs::GetChildType() const
{
return NODE_TYPE_SONG;
}

std::string CDirectoryNodeDiscs::GetLocalizedName() const
{

if (GetID() == -1)
return g_localizeStrings.Get(38075); // "All discs"

// ! @todo: Find better approach, use the label of the item we click?
CQueryParams params;
CollectQueryParams(params);
CMusicDatabase db;
if (db.Open())
return db.GetBoxsetDiscById(params.GetAlbumId(), params.GetDisc());
return "";
}

bool CDirectoryNodeDiscs::GetContent(CFileItemList& items) const
{
CMusicDatabase musicdatabase;
if (!musicdatabase.Open())
return false;

CQueryParams params;
CollectQueryParams(params);

bool bSuccess = musicdatabase.GetDiscsByWhere(BuildPath(), items, params.GetAlbumId());

musicdatabase.Close();

return bSuccess;
}
27 changes: 27 additions & 0 deletions xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeDiscs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2005-2019 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 "DirectoryNode.h"

namespace XFILE
{
namespace MUSICDATABASEDIRECTORY
{
class CDirectoryNodeDiscs : public CDirectoryNode
{
public:
CDirectoryNodeDiscs(const std::string& strName, CDirectoryNode* pParent);
protected:
NODE_TYPE GetChildType() const override;
bool GetContent(CFileItemList& items) const override;
std::string GetLocalizedName() const override;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ namespace XFILE
{ NODE_TYPE_ALBUM_COMPILATIONS, "compilations", 521 },
{ NODE_TYPE_ROLE, "roles", 38033 },
{ NODE_TYPE_SOURCE, "sources", 39031 },
};
{ NODE_TYPE_DISC, "discs", 14087 },
};
};
};

Expand Down
Loading