Ejemplo n.º 1
0
        public void TestRadioTrackEmpty()
        {
            var station = new TrackInfo();

            var track = new Banshee.Streaming.RadioTrackInfo(station);

            TestFirstLine(track, TrackInfo.UnknownTitle);
            TestSecondLine(track,
                           "<span color=\"#000000\">{0}</span>",
                           Banshee.Streaming.RadioTrackInfo.UnknownStream);
        }
Ejemplo n.º 2
0
        public void TestRadioTrackStationOnly()
        {
            var station = new TrackInfo();

            station.TrackTitle = "Station Title";
            station.AlbumTitle = "Station Album Title";
            station.ArtistName = "Station Artist";

            var track = new Banshee.Streaming.RadioTrackInfo(station);

            TestFirstLine(track, station.TrackTitle);
            TestSecondLine(track,
                           "<span color=\"#000000\">{0}</span>",
                           track.ParentTrack.ArtistName);
        }
Ejemplo n.º 3
0
        protected virtual string GetSecondLineText(TrackInfo track)
        {
            string markup = null;

            Banshee.Streaming.RadioTrackInfo radio_track = track as Banshee.Streaming.RadioTrackInfo;

            if ((track.MediaAttributes & TrackMediaAttributes.Podcast) != 0)
            {
                // Translators: {0} and {1} are for markup so ignore them, {2} and {3}
                // are Podcast Name and Published Date, respectively;
                // e.g. 'from BBtv published 7/26/2007'
                markup = MarkupFormat(Catalog.GetString("{0}from{1} {2} {0}published{1} {3}"),
                                      track.DisplayAlbumTitle, track.ReleaseDate.ToShortDateString());
            }
            else if (radio_track != null && radio_track.ParentTrack != null)
            {
                // This is complicated because some radio streams send tags when the song changes, and we
                // want to display them if they do.  But if they don't, we want it to look good too, so we just
                // display the station name for the second line.
                string by_from = GetByFrom(
                    track.ArtistName == radio_track.ParentTrack.ArtistName ? null : track.ArtistName, track.DisplayArtistName,
                    track.AlbumTitle == radio_track.ParentTrack.AlbumTitle ? null : track.AlbumTitle, track.DisplayAlbumTitle, false
                    );

                if (String.IsNullOrEmpty(by_from))
                {
                    // simply: "Chicago Public Radio" or whatever the artist name is
                    markup = GLib.Markup.EscapeText(radio_track.ParentTrack.ArtistName ?? Catalog.GetString("Unknown Stream"));
                }
                else
                {
                    // Translators: {0} and {1} are markup so ignore them, {2} is the name of the radio station
                    string on = MarkupFormat(Catalog.GetString("{0}on{1} {2}"), radio_track.ParentTrack.TrackTitle);

                    // Translators: {0} is the "from {album} by {artist}" type string, and {1} is the "on {radio station name}" string
                    markup = String.Format(Catalog.GetString("{0} {1}"), by_from, on);
                }
            }
            else
            {
                markup = GetByFrom(track.ArtistName, track.DisplayArtistName, track.AlbumTitle, track.DisplayAlbumTitle, true);
            }

            return(String.Format("<span color=\"{0}\">{1}</span>",
                                 CairoExtensions.ColorGetHex(TextColor, false),
                                 markup));
        }
Ejemplo n.º 4
0
        public void TestRadioTrackPartial()
        {
            var station = new TrackInfo();

            station.TrackTitle = "Station Title";

            var track = new Banshee.Streaming.RadioTrackInfo(station);

            track.TrackTitle = "The Title";
            track.ArtistName = "The Artist";

            TestFirstLine(track, track.TrackTitle);
            TestSecondLine(track,
                           "<span color=\"#000000\"><span color=\"#000000\" size=\"small\">by</span> {0} " +
                           "<span color=\"#000000\" size=\"small\">on</span> {1}</span>",
                           track.ArtistName, track.ParentTrack.TrackTitle);
        }
Ejemplo n.º 5
0
        public void TestRadioTrackStationOnly()
        {
            var station = new TrackInfo ();
            station.TrackTitle = "Station Title";
            station.AlbumTitle = "Station Album Title";
            station.ArtistName = "Station Artist";

            var track = new Banshee.Streaming.RadioTrackInfo (station);

            TestFirstLine (track, station.TrackTitle);
            TestSecondLine (track,
                            "<span color=\"#000000\">{0}</span>",
                            track.ParentTrack.ArtistName);
        }
Ejemplo n.º 6
0
        public void TestRadioTrackPartial()
        {
            var station = new TrackInfo ();
            station.TrackTitle = "Station Title";

            var track = new Banshee.Streaming.RadioTrackInfo (station);
            track.TrackTitle = "The Title";
            track.ArtistName = "The Artist";

            TestFirstLine (track, track.TrackTitle);
            TestSecondLine (track,
                            "<span color=\"#000000\"><span color=\"#000000\" size=\"small\">by</span> {0} " +
                            "<span color=\"#000000\" size=\"small\">on</span> {1}</span>",
                            track.ArtistName, track.ParentTrack.TrackTitle);
        }
Ejemplo n.º 7
0
        public void TestRadioTrackEmpty()
        {
            var station = new TrackInfo ();

            var track = new Banshee.Streaming.RadioTrackInfo (station);

            TestFirstLine (track, TrackInfo.UnknownTitle);
            TestSecondLine (track,
                            "<span color=\"#000000\">{0}</span>",
                            Banshee.Streaming.RadioTrackInfo.UnknownStream);
        }