本文整理汇总了C++中mpd::Song::getMTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Song::getMTime方法的具体用法?C++ Song::getMTime怎么用?C++ Song::getMTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpd::Song
的用法示例。
在下文中一共展示了Song::getMTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LocateSong
void MediaLibrary::LocateSong(const MPD::Song &s)
{
std::string primary_tag = s.get(Config.media_lib_primary_tag);
if (primary_tag.empty())
{
std::string item_type = boost::locale::to_lower(
tagTypeToString(Config.media_lib_primary_tag));
Statusbar::printf("Can't use this function because the song has no %s tag", item_type);
return;
}
if (!s.isFromDatabase())
{
Statusbar::print("Song is not from the database");
return;
}
if (myScreen != this)
switchTo();
Statusbar::put() << "Jumping to song...";
Global::wFooter->refresh();
if (!hasTwoColumns)
{
if (Tags.empty())
update();
if (!MoveToTag(Tags, primary_tag))
{
// The tag could not be found. Since this was called from an existing
// song, the tag should exist in the library, but it was not listed by
// list/listallinfo. This is the case with some players where it is not
// possible to list all of the library, e.g. mopidy with mopidy-spotify.
// To workaround this we simply insert the missing tag.
Tags.addItem(PrimaryTag(primary_tag, s.getMTime()));
std::sort(Tags.beginV(), Tags.endV(), SortPrimaryTags());
Tags.refresh();
MoveToTag(Tags, primary_tag);
}
Albums.clear();
}
if (Albums.empty())
update();
// When you locate a song in the media library, if no albums or no songs
// are found, set the active column to the previous one (tags if no albums,
// and albums if no songs). This makes sure that the active column is not
// empty, which may make it impossible to move out of.
//
// The problem was if you highlight some song in the rightmost column in
// the media browser and then go to some other window and select locate
// song. If the tag or album it looked up in the media library was
// empty, the selection would stay in the songs column while it was empty.
// This made the selection impossible to change.
//
// This only is a problem if a song has some tag or album for which the
// find command doesn't return any results. This should never really happen
// unless there is some inconsistency in the player. However, it may
// happen, so we need to handle it.
//
// Note: We don't want to return when no albums are found in two column
// mode. In this case, we try to insert the album, as we do with tags when
// they are not found.
if (hasTwoColumns || !Albums.empty())
{
if (!MoveToAlbum(Albums, primary_tag, s))
{
// The album could not be found, insert it if in two column mode.
// See comment about tags not found above. This is the equivalent
// for two column mode.
Albums.addItem(AlbumEntry(
Album(primary_tag, s.getAlbum(), s.getDate(), s.getMTime())
));
std::sort(Albums.beginV(), Albums.endV(), SortAlbumEntries());
Albums.refresh();
MoveToAlbum(Albums, primary_tag, s);
}
Songs.clear();
update();
if (!Songs.empty())
{
if (s != Songs.current()->value())
{
auto begin = Songs.beginV(), end = Songs.endV();
auto it = std::find(begin, end, s);
if (it != end)
Songs.highlight(it-begin);
}
nextColumn();
nextColumn();
}
else // invalid album was added, clear the list
Albums.clear();
}
else // invalid tag was added, clear the list
Tags.clear();
refresh();
//.........这里部分代码省略.........