Add Milkshake-style stream title notifications
parent
72229a6609
commit
9900e4efa8
|
|
@ -417,15 +417,14 @@
|
|||
<key>ShowStreamMetadata</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Shows stream metadata (artist, title) in local chat.</string>
|
||||
<string>Shows stream metadata (artist, title) notifications. (0 = Off, 1 = Notification Toast, 2 = Nearby Chat)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</map>
|
||||
|
||||
<key>StreamMetadataAnnounceToChat</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -11099,6 +11099,24 @@ Error in the regular expression:
|
|||
Successfully imported stream list from XML.
|
||||
</notification>
|
||||
|
||||
<notification
|
||||
icon="notifytip.tga"
|
||||
name="StreamMetadata"
|
||||
type="notifytip">
|
||||
<tag>StreamMetadata</tag>
|
||||
♫ Now Playing:
|
||||
[TITLE]
|
||||
[ARTIST]♫
|
||||
</notification>
|
||||
<notification
|
||||
icon="notifytip.tga"
|
||||
name="StreamMetadataNoArtist"
|
||||
type="notifytip">
|
||||
<tag>StreamMetadata</tag>
|
||||
♫ Now Playing:
|
||||
[TITLE]♫
|
||||
</notification>
|
||||
|
||||
<!-- <FS:Zi> Backup Settings -->
|
||||
<notification
|
||||
icon="alertmodal.tga"
|
||||
|
|
|
|||
|
|
@ -405,16 +405,51 @@
|
|||
parameter="media_lists" />
|
||||
</button>
|
||||
|
||||
<check_box
|
||||
control_name="ShowStreamMetadata"
|
||||
name="ShowStreamMetadata"
|
||||
label="Show stream title in nearby chat"
|
||||
follows="left|top"
|
||||
layout="topleft"
|
||||
top_pad="-2"
|
||||
left="25"
|
||||
height="18"
|
||||
width="200" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="20"
|
||||
layout="topleft"
|
||||
left="26"
|
||||
name="show_stream_metadata_text"
|
||||
top_pad="2"
|
||||
width="200">
|
||||
Show stream title notifications:
|
||||
</text>
|
||||
<radio_group
|
||||
control_name="ShowStreamMetadata"
|
||||
height="20"
|
||||
width="300"
|
||||
layout="topleft"
|
||||
left_pad="0"
|
||||
name="show_stream_metadata">
|
||||
<radio_item
|
||||
label="Off"
|
||||
name="radio_off"
|
||||
top="0"
|
||||
layout="topleft"
|
||||
height="16"
|
||||
left="0"
|
||||
value="0"
|
||||
width="90" />
|
||||
<radio_item
|
||||
label="Toasts"
|
||||
left_pad="1"
|
||||
layout="topleft"
|
||||
height="16"
|
||||
name="radio_toasts"
|
||||
value="1"
|
||||
width="90" />
|
||||
<radio_item
|
||||
label="Nearby Chat"
|
||||
left_pad="1"
|
||||
layout="topleft"
|
||||
height="16"
|
||||
name="radio_chat"
|
||||
value="2"
|
||||
width="90" />
|
||||
</radio_group>
|
||||
<check_box
|
||||
top_pad="1"
|
||||
left="45"
|
||||
|
|
|
|||
|
|
@ -28,16 +28,16 @@
|
|||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "streamtitledisplay.h"
|
||||
#include "llagent.h"
|
||||
#include "llchat.h"
|
||||
//#include "llfloaterchat.h"
|
||||
#include "llnotificationmanager.h"
|
||||
#include "llaudioengine.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llstreamingaudio.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "lltrans.h"
|
||||
#include "streamtitledisplay.h"
|
||||
#include "fscommon.h"
|
||||
#include "message.h"
|
||||
|
||||
StreamTitleDisplay::StreamTitleDisplay() : LLEventTimer(2) { };
|
||||
|
||||
|
|
@ -49,44 +49,55 @@ BOOL StreamTitleDisplay::tick()
|
|||
|
||||
void StreamTitleDisplay::checkMetadata()
|
||||
{
|
||||
LLCachedControl<bool> ShowStreamMetadata(gSavedSettings, "ShowStreamMetadata");
|
||||
LLCachedControl<U32> ShowStreamMetadata(gSavedSettings, "ShowStreamMetadata");
|
||||
LLCachedControl<bool> StreamMetadataAnnounceToChat(gSavedSettings, "StreamMetadataAnnounceToChat");
|
||||
|
||||
if(!gAudiop)
|
||||
return;
|
||||
if(gAudiop->getStreamingAudioImpl()->hasNewMetadata() && (ShowStreamMetadata || StreamMetadataAnnounceToChat))
|
||||
if(gAudiop->getStreamingAudioImpl()->hasNewMetadata() && (ShowStreamMetadata > 0 || StreamMetadataAnnounceToChat))
|
||||
{
|
||||
LLChat chat;
|
||||
std::string chat = "";
|
||||
std::string title = gAudiop->getStreamingAudioImpl()->getCurrentTitle();
|
||||
std::string artist = gAudiop->getStreamingAudioImpl()->getCurrentArtist();
|
||||
// Sometimes we get blanks...
|
||||
chat.mText = "";
|
||||
|
||||
if(artist.length() > 0)
|
||||
{
|
||||
chat.mText = artist;
|
||||
chat = artist;
|
||||
}
|
||||
if(title.length() > 0)
|
||||
{
|
||||
if (chat.mText.length() > 0)
|
||||
if (chat.length() > 0)
|
||||
{
|
||||
chat.mText += " - ";
|
||||
chat += " - ";
|
||||
}
|
||||
chat.mText += title;
|
||||
chat += title;
|
||||
}
|
||||
if (chat.mText.length() > 0)
|
||||
if (chat.length() > 0)
|
||||
{
|
||||
if (StreamMetadataAnnounceToChat)
|
||||
{
|
||||
sendStreamTitleToChat(chat.mText);
|
||||
sendStreamTitleToChat(chat);
|
||||
}
|
||||
|
||||
if (ShowStreamMetadata)
|
||||
if (ShowStreamMetadata > 1)
|
||||
{
|
||||
chat = LLTrans::getString("StreamtitleNowPlaying") + " " + chat;
|
||||
reportToNearbyChat(chat);
|
||||
}
|
||||
else if (ShowStreamMetadata == 1)
|
||||
{
|
||||
chat.mText = LLTrans::getString("StreamtitleNowPlaying") + " " + chat.mText;
|
||||
chat.mSourceType = CHAT_SOURCE_SYSTEM;
|
||||
LLSD args;
|
||||
args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
|
||||
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
|
||||
args["TITLE"] = title;
|
||||
if(artist.length() > 0)
|
||||
{
|
||||
args["ARTIST"] = artist;
|
||||
LLNotificationsUtil::add("StreamMetadata", args);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotificationsUtil::add("StreamMetadataNoArtist", args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue