Example #1
0
        public async Task <IActionResult> Edit(Guid id, PlaylistEntry updatedEntry)
        {
            if (updatedEntry == null)
            {
                return(NotFound());
            }

            if (id != updatedEntry.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var entry = await _playlistContext.PlaylistEntries.FindAsync(id);

                if (entry == null)
                {
                    return(NotFound());
                }

                entry.Position            = updatedEntry.Position;
                entry.ChannelNumberExport = updatedEntry.ChannelNumberExport;
                entry.EpgMatchName        = updatedEntry.EpgMatchName;
                entry.IsEnabled           = updatedEntry.IsEnabled;
                entry.LogoUrl             = updatedEntry.LogoUrl;
                entry.Modified            = DateTime.Now;

                await _playlistContext.SaveChangesAsync();

                return(RedirectToAction("Index", "Home"));
            }

            return(View(updatedEntry));
        }
Example #2
0
 public PlaylistEntryHandler(ILogger logger, PlaylistEntry entry, CancellationToken token)
     : base()
 {
     this.logger = logger ?? throw new ArgumentException("The logger must not be null.");
     this.Entry  = entry ?? throw new ArgumentException("The playlist entry must not be null.");
     this.token  = token;
 }
        private static async Task WriteExtInfoLineAsync(TextWriter outWriter, PlaylistEntry entry)
        {
            // telly default tags from 1.1 dev code:
            // - NameKey # Parsed from the end of the exif by default
            // - ChannelNumberKey = "tvg-chno"
            // - LogoKey = "tvg-logo"
            // - EPGMatchKey = "tvg-id"
            //#EXTINF:-1 tvg-chno="34" tvg-id="SRF1HD" tvg-logo="http://<url to image file with logo>",test
            var exInfoBuilder = new StringBuilder();

            exInfoBuilder.Append(M3UConstants.ExtInfStartTag);

            const int duration = -1;

            exInfoBuilder.Append(duration);

            AddTag(exInfoBuilder, "tvg-chno", entry.ChannelNumberExport.ToString());
            AddTag(exInfoBuilder, "tvg-id", entry.EpgMatchName);

            if (!string.IsNullOrWhiteSpace(entry.LogoUrl))
            {
                AddTag(exInfoBuilder, "tvg-logo", entry.LogoUrl);
            }

            exInfoBuilder.Append(",");
            exInfoBuilder.Append(entry.Name);

            await outWriter.WriteLineAsync(exInfoBuilder.ToString());
        }
        public void PlaylistEntryConstructorTest()
        {
            PlaylistEntry target = new PlaylistEntry();

            Assert.IsNotNull(target);
            Assert.AreEqual(target.Position, 0);
        }
Example #5
0
        private Task <ResponseInfo> MovePlaylistSongUp(JToken parameters)
        {
            Guid songGuid;
            bool valid = Guid.TryParse(parameters["entryGuid"].ToString(), out songGuid);

            if (!valid)
            {
                return(Task.FromResult(CreateResponse(ResponseStatus.MalformedRequest, "Malformed GUID")));
            }

            PlaylistEntry entry = this.library.CurrentPlaylist.FirstOrDefault(x => x.Guid == songGuid);

            if (entry == null)
            {
                return(Task.FromResult(CreateResponse(ResponseStatus.NotFound)));
            }

            try
            {
                this.library.MovePlaylistSong(entry.Index, entry.Index - 1, this.accessToken);
            }

            catch (AccessException)
            {
                return(Task.FromResult(CreateResponse(ResponseStatus.Unauthorized)));
            }

            return(Task.FromResult(CreateResponse(ResponseStatus.Success)));
        }
        private void AddOrUpdateEntries(IReadOnlyDictionary <int, PlaylistEntry> existingEntries, IEnumerable <ParsedTrack> tracks)
        {
            foreach (var track in tracks)
            {
                if (!existingEntries.TryGetValue(track.Id, out var entry))
                {
                    _logger.LogInformation(LoggingEvents.Synchronize, $"Adding playlist entry {track.Id} - {track.Name}");
                    entry = new PlaylistEntry
                    {
                        Id                  = Guid.NewGuid(),
                        Position            = track.Id,
                        ChannelNumberImport = track.Id,
                        ChannelNumberExport = track.Id,
                        EpgMatchName        = track.Name?.Replace(" ", string.Empty),
                        IsEnabled           = false,
                        Created             = DateTime.Now
                    };
                    _playlistContext.PlaylistEntries.Add(entry);
                }
                else
                {
                    _logger.LogInformation(LoggingEvents.Synchronize, $"Updating playlist entry {track.Id} - {track.Name}");
                }

                entry.IsAvailable = true;
                entry.Name        = track.Name;
                entry.UrlOriginal = track.Url;
                entry.UrlProxy    = BuildProxiedUrl(entry);
                entry.Modified    = DateTime.Now;
            }
        }
Example #7
0
        private async Task <ResponseInfo> PlayPlaylistSong(JToken parameters)
        {
            Guid songGuid;
            bool valid = Guid.TryParse(parameters["entryGuid"].ToString(), out songGuid);

            if (!valid)
            {
                return(CreateResponse(ResponseStatus.MalformedRequest, "Malformed GUID"));
            }

            PlaylistEntry entry = this.library.CurrentPlaylist.FirstOrDefault(x => x.Guid == songGuid);

            if (entry == null)
            {
                return(CreateResponse(ResponseStatus.NotFound, "Playlist entry not found"));
            }

            try
            {
                await this.library.PlaySongAsync(entry.Index, this.accessToken);
            }

            catch (AccessException)
            {
                return(CreateResponse(ResponseStatus.Unauthorized));
            }

            return(CreateResponse(ResponseStatus.Success));
        }
Example #8
0
        private static PlaylistEntry SetupVotedEntry()
        {
            var entry = new PlaylistEntry(0, Helpers.SetupSongMock());

            entry.Vote();

            return(entry);
        }
Example #9
0
 // This could delete multiple selections at once, but it doesn't
 private async void deleteSong_Click(object sender, EventArgs e)
 {
     Track         selectedSong     = (Track)playlistSongsBox.SelectedItem;
     Playlist      selectedPlaylist = (Playlist)playlistListBox.SelectedItem;
     PlaylistEntry songEntry        = selectedPlaylist.Songs.First(s => s.TrackID == selectedSong.Id);
     await gpmClient.RemoveFromPlaylistAsync(new List <PlaylistEntry> {
         songEntry
     });
 }
Example #10
0
        public void CreateFeedEntryTest()
        {
            Uri           uriBase  = null;                                // TODO: Initialize to an appropriate value
            IService      iService = null;                                // TODO: Initialize to an appropriate value
            PlaylistFeed  target   = new PlaylistFeed(uriBase, iService); // TODO: Initialize to an appropriate value
            PlaylistEntry entry    = target.CreateFeedEntry() as PlaylistEntry;

            Assert.IsNotNull(entry);
        }
Example #11
0
            public void EntryMustBeShadowVoted()
            {
                var  accessControl = SetupVotableAccessControl();
                Guid token         = accessControl.RegisterRemoteAccessToken(new Guid());

                var entry = new PlaylistEntry(0, Helpers.SetupSongMock());

                Assert.Throws <ArgumentException>(() => accessControl.RegisterShadowVote(token, entry));
            }
        public void PositionTest()
        {
            PlaylistEntry target   = new PlaylistEntry(); // TODO: Initialize to an appropriate value
            int           expected = 4;                   // TODO: Initialize to an appropriate value
            int           actual;

            target.Position = expected;
            actual          = target.Position;
            Assert.AreEqual(expected, actual);
        }
 private static async Task WriteUrlAsync(TextWriter outWriter, PlaylistEntry entry, bool useProxy)
 {
     if (useProxy)
     {
         await outWriter.WriteLineAsync(entry.UrlProxy);
     }
     else
     {
         await outWriter.WriteLineAsync(entry.UrlOriginal);
     }
 }
Example #14
0
            public void CanVoteOnShadowVotedEntry()
            {
                var accessControl = SetupVotableAccessControl();

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                PlaylistEntry entry = SetupShadowVotedEntry();

                accessControl.RegisterShadowVote(token, entry);
                accessControl.RegisterVote(token, entry);
            }
Example #15
0
        private void PlaylistEntry_DoubleClicked(object sender, MouseButtonEventArgs e)
        {
            ListBoxItem   item  = sender as ListBoxItem;
            PlaylistEntry entry = item?.DataContext as PlaylistEntry;

            if (entry == null)
            {
                return;
            }

            ViewModel.RequestPlayEntry(entry);
        }
Example #16
0
        public void TestSimilarity()
        {
            Instantiate();
            PlaylistEntry testPle = new PlaylistEntry()
            {
                Id               = id,
                PlayListId       = playListId,
                OrdinalPosition  = ordinalPosition,
                Title            = title,
                CountIn          = countIn,
                BeatsPerMeasure  = beatsPerMeasure,
                Tempo            = tempo,
                SongFileURL      = songFileURL,
                BackingTracksURL = backingTracksURL,
                ChartURL         = chartURL,
                Notes            = notes
            };

            Assert.IsTrue(testPle.PropertiesMatch(playlistEntry));
            testPle.Id = 10;
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.Id         = id;
            testPle.PlayListId = 10;
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.PlayListId      = playListId;
            testPle.OrdinalPosition = 10;
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.OrdinalPosition = ordinalPosition;
            testPle.Title           = "delta title";
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.Title   = title;
            testPle.CountIn = 10;
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.CountIn         = countIn;
            testPle.BeatsPerMeasure = 10;
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.BeatsPerMeasure = beatsPerMeasure;
            testPle.Tempo           = 10;
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.Tempo       = tempo;
            testPle.SongFileURL = "delta song url";
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.SongFileURL      = songFileURL;
            testPle.BackingTracksURL = "delta backing url";
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.BackingTracksURL = backingTracksURL;
            testPle.ChartURL         = "delta chart url";
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.ChartURL = chartURL;
            testPle.Notes    = "delta notes";
            Assert.IsFalse(testPle.PropertiesMatch(playlistEntry));
            testPle.Notes = notes;
        }
Example #17
0
        public void TestEquals()
        {
            Instantiate();
            PlaylistEntry testPle = new PlaylistEntry()
            {
                Id = 1
            };

            Assert.IsTrue(testPle.Equals(playlistEntry));
            testPle.Id = 2;
            Assert.IsFalse(testPle.Equals(playlistEntry));
        }
Example #18
0
        private async Task <ResponseInfo> VoteForSong(JToken parameters)
        {
            int?remainingVotes = await this.library.RemoteAccessControl.ObserveRemainingVotes(this.accessToken).FirstAsync();

            if (remainingVotes == null)
            {
                return(CreateResponse(ResponseStatus.NotSupported, "Voting isn't supported"));
            }

            if (remainingVotes == 0)
            {
                return(CreateResponse(ResponseStatus.Rejected, "Not enough votes left"));
            }

            Guid songGuid;
            bool valid = Guid.TryParse(parameters["entryGuid"].ToString(), out songGuid);

            if (!valid)
            {
                return(CreateResponse(ResponseStatus.MalformedRequest, "Malformed GUID"));
            }

            Playlist      playlist = this.library.CurrentPlaylist;
            PlaylistEntry entry    = playlist.FirstOrDefault(x => x.Guid == songGuid);

            if (entry == null)
            {
                return(CreateResponse(ResponseStatus.NotFound, "Playlist entry not found"));
            }

            if (this.library.RemoteAccessControl.IsVoteRegistered(this.accessToken, entry))
            {
                return(CreateResponse(ResponseStatus.Rejected, "Vote already registered"));
            }

            if (playlist.CurrentSongIndex.HasValue && entry.Index <= playlist.CurrentSongIndex.Value)
            {
                return(CreateResponse(ResponseStatus.Rejected, "Vote rejected"));
            }

            try
            {
                this.library.VoteForPlaylistEntry(entry.Index, this.accessToken);
            }

            catch (AccessException)
            {
                return(CreateResponse(ResponseStatus.Unauthorized, "Unauthorized"));
            }

            return(CreateResponse(ResponseStatus.Success));
        }
Example #19
0
        public void RegisteredShadowVoteUnregistersAutomaticallyWhenEntryVoteCountIsReset()
        {
            var  accessControl = SetupVotableAccessControl();
            Guid token         = accessControl.RegisterRemoteAccessToken(new Guid());

            PlaylistEntry entry = SetupShadowVotedEntry();

            accessControl.RegisterShadowVote(token, entry);

            entry.ResetVotes();

            Assert.False(entry.IsShadowVoted);
        }
Example #20
0
        public async Task <AddToPlaylistResult> AddTracksToPlaylistAsync(IList <TrackInfo> tracks, string playlistName)
        {
            var result = new AddToPlaylistResult {
                IsSuccess = true
            };
            int numberTracksAdded = 0;

            await Task.Run(() =>
            {
                try
                {
                    using (var conn = this.factory.GetConnection())
                    {
                        try
                        {
                            // Get the PlaylistID of the Playlist with PlaylistName = iPlaylistName
                            var playlistID = conn.Table <Playlist>().Select((p) => p).Where((p) => p.PlaylistName.Equals(playlistName)).ToList().Select((p) => p.PlaylistID).FirstOrDefault();

                            // Loop over the Tracks in iTracks and add an entry to PlaylistEntries for each of the Tracks
                            foreach (TrackInfo ti in tracks)
                            {
                                var possiblePlaylistEntry = new PlaylistEntry
                                {
                                    PlaylistID = playlistID,
                                    TrackID    = ti.TrackID
                                };

                                if (!conn.Table <PlaylistEntry>().ToList().Contains(possiblePlaylistEntry))
                                {
                                    conn.Insert(possiblePlaylistEntry);
                                    numberTracksAdded += 1;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            LogClient.Instance.Logger.Error("A problem occured while adding Tracks to Playlist with name '{0}'. Exception: {1}", playlistName, ex.Message);
                            result.IsSuccess = false;
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogClient.Instance.Logger.Error("Could not connect to the database. Exception: {0}", ex.Message);
                }
            });

            result.NumberTracksAdded = numberTracksAdded;

            return(result);
        }
        public void RegisteredVoteUnregistersAutomaticallyWhenEntryVoteCountIsReset()
        {
            var accessControl = SetupVotableAccessControl(2);
            Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

            var entry = new PlaylistEntry(0, Helpers.SetupSongMock());
            entry.Vote();

            var votes = accessControl.ObserveRemainingVotes(token).CreateCollection();
            accessControl.RegisterVote(token, entry);

            entry.ResetVotes();

            Assert.Equal(new int?[] { 2, 1, 2 }, votes);
        }
Example #22
0
        public PlaylistEntryViewModel(PlaylistEntry entry)
            : base(entry.Song)
        {
            this.entry = entry;

            this.disposable = new CompositeDisposable();

            this.isCorrupted = this.Model.WhenAnyValue(x => x.IsCorrupted)
                .ToProperty(this, x => x.IsCorrupted)
                .DisposeWith(disposable);

            this.votes = this.entry.WhenAnyValue(x => x.Votes)
                .ToProperty(this, x => x.Votes)
                .DisposeWith(disposable);
        }
Example #23
0
        public PlaylistEntryViewModel(PlaylistEntry entry)
            : base(entry.Song)
        {
            this.entry = entry;

            this.disposable = new CompositeDisposable();

            this.isCorrupted = this.Model.WhenAnyValue(x => x.IsCorrupted)
                               .ToProperty(this, x => x.IsCorrupted)
                               .DisposeWith(disposable);

            this.votes = this.entry.WhenAnyValue(x => x.Votes)
                         .ToProperty(this, x => x.Votes)
                         .DisposeWith(disposable);
        }
Example #24
0
        private Task <ResponseInfo> PostRemovePlaylistSong(JToken parameters)
        {
            Guid songGuid = Guid.Parse(parameters["entryGuid"].ToString());

            PlaylistEntry entry = this.library.CurrentPlaylist.FirstOrDefault(x => x.Guid == songGuid);

            if (entry == null)
            {
                return(Task.FromResult(CreateResponse(ResponseStatus.NotFound, "Guid not found")));
            }

            this.library.RemoveFromPlaylist(new[] { entry.Index }, this.accessToken);

            return(Task.FromResult(CreateResponse(ResponseStatus.Success)));
        }
Example #25
0
        public static bool AddSongToPlaylist(Int64 p_PlaylistID, Int64 p_SongID)
        {
            using (var s_Db = Database.GetConnection())
            {
                var s_Playlist = s_Db.SingleById <Playlist>(p_PlaylistID);

                if (s_Playlist == null)
                {
                    return(false);
                }

                var s_Entry = s_Db.Single <PlaylistEntry>(p_Entry => p_Entry.PlaylistID == p_PlaylistID &&
                                                          p_Entry.SongID == p_SongID);

                if (s_Entry != null)
                {
                    return(true);
                }

                var s_Song = s_Db.SingleById <SongEntry>(p_SongID);

                if (s_Song == null)
                {
                    return(false);
                }

                var s_LastSong = s_Db.SelectFmt <PlaylistEntry>("PlaylistID = {0} ORDER BY Index DESC LIMIT 1",
                                                                p_PlaylistID);

                s_Entry = new PlaylistEntry
                {
                    PlaylistID = p_PlaylistID,
                    SongID     = p_SongID,
                    Index      = s_LastSong.Count == 0 ? 0 : s_LastSong[0].Index + 1
                };

                s_Db.Insert(s_Entry);

                if (ActivePlaylist == null || ActivePlaylist.ID != p_PlaylistID)
                {
                    return(true);
                }

                m_Entries.Enqueue(s_Entry);

                return(true);
            }
        }
Example #26
0
 private void Instantiate()
 {
     playlistEntry = new PlaylistEntry()
     {
         Id               = id,
         PlayListId       = playListId,
         OrdinalPosition  = ordinalPosition,
         Title            = title,
         CountIn          = countIn,
         BeatsPerMeasure  = beatsPerMeasure,
         Tempo            = tempo,
         SongFileURL      = songFileURL,
         BackingTracksURL = backingTracksURL,
         ChartURL         = chartURL,
         Notes            = notes
     };
 }
Example #27
0
        public void RegisteredVoteUnregistersAutomaticallyWhenEntryVoteCountIsReset()
        {
            var  accessControl = SetupVotableAccessControl(2);
            Guid token         = accessControl.RegisterRemoteAccessToken(new Guid());

            var entry = new PlaylistEntry(0, Helpers.SetupSongMock());

            entry.Vote();

            var votes = accessControl.ObserveRemainingVotes(token).CreateCollection();

            accessControl.RegisterVote(token, entry);

            entry.ResetVotes();

            Assert.Equal(new int?[] { 2, 1, 2 }, votes);
        }
Example #28
0
        public void TestAdd()
        {
            PlaylistEntry playlistEntry = Instantiate();
            PlayList      playlist      = new PlayList();

            // Make playlist with 2 songs
            title           = "Song 1";
            id              = 10;
            ordinalPosition = 1;

            playlist.Songs.Add(Instantiate());

            title           = "Song 2";
            id              = 3;
            ordinalPosition = 2;
            playlist.Songs.Add(Instantiate());

            Assert.Pass();
        }
Example #29
0
        public void PlayFile(int playlistIndex)
        {
            PlaylistEntry selectedSong = Playlist.ElementAt(playlistIndex);

            if (selectedSong == null)
            {
                return;
            }

            string fileLocation = selectedSong.SongData.FileName;

            if (!System.IO.File.Exists(fileLocation))
            {
                return;
            }

            if (audioPlayer != null)
            {
                Dispose();
            }

            Playlist.Files.Where(w => w.IsPlaying == true).ToList().ForEach(s => s.IsPlaying = false);

            PlayingSongPlaylistIndex = playlistIndex;

            UpdateSongInformationDisplay(selectedSong);

            audioPlayer = new AudioPlayer(@fileLocation);
            audioPlayer.Play();

            PlayButtonIcon = "M14,19H18V5H14M6,19H10V5H6V19Z";

            audioPlayer.OutputDevice.Stopped += PlaybackDevicePlaybackStopped;

            PlayingSongLength = TotalTime.TotalSeconds;

            audioPlayer.OutputDevice.Volume = Volume;

            selectedSong.IsPlaying = true;

            _timer.Start();
        }
Example #30
0
            public void IsFirstInFirstOut()
            {
                var playlist = new Playlist("Playlist");

                playlist.AddSongs(Helpers.SetupSongMocks(5));

                playlist.VoteFor(4);

                PlaylistEntry entry1 = playlist[4];

                playlist.VoteFor(4);

                Assert.Equal(1, entry1.Index);

                PlaylistEntry entry2 = playlist[4];

                playlist.VoteFor(4);

                Assert.Equal(2, entry2.Index);
            }
Example #31
0
 public void TestCompares()
 {
     try
     {
         Instantiate();
         PlaylistEntry testPle = new PlaylistEntry()
         {
             OrdinalPosition = 2
         };
         Assert.IsTrue(playlistEntry.CompareTo(testPle) == -1);
         testPle.OrdinalPosition = 1;
         Assert.IsTrue(playlistEntry.CompareTo(testPle) == 0);
         playlistEntry.OrdinalPosition = 2;
         Assert.IsTrue(playlistEntry.CompareTo(testPle) == 1);
     }
     finally
     {
         playlistEntry.OrdinalPosition = 1;
     }
 }
Example #32
0
 public static Dictionary <String, Object> ToJsonDictionary(this PlaylistEntry obj)
 {
     return(new Dictionary <String, Object>
     {
         {
             "UniqueId", obj.UniqueId
         }
         ,
         {
             "Title", obj.Title
         }
         ,
         {
             "CreateUser", obj.CreateUser?.ToJsonDictionary()
         }
         ,
         {
             "Track", obj.Track?.ToJsonDictionary()
         }
     });
 }
        /// <summary>
        ///     Gets a list of all files in an M3U playlist
        /// </summary>
        /// <param name="playlistFile">The playlist file.</param>
        /// <returns>A list of file names contained in the playlist</returns>
        public static List<PlaylistEntry> GetPlaylistEntries(string playlistFile)
        {
            var playlistEntries = new List<PlaylistEntry>();
            using (var reader = new StreamReader(playlistFile, Encoding.UTF7))
            {
                string currentLine;
                while ((currentLine = reader.ReadLine()) != null)
                {
                    if (currentLine.Length <= 0 || currentLine == "#EXTM3U") continue;

                    var playlistEntry = new PlaylistEntry();
                    if (currentLine.StartsWith("#"))
                    {
                        var elements = currentLine.Split(',').ToList();
                        if (elements.Count > 0)
                        {
                            elements = currentLine.Substring(currentLine.IndexOf(',') + 1).Split('-').ToList();
                            if (elements.Count == 2)
                            {
                                playlistEntry.Artist = elements[0].Trim();
                                playlistEntry.Title = elements[1].Trim();
                            }
                            else
                            {
                                playlistEntry.Title = string.Join("-", elements.ToArray());
                                playlistEntry.Artist = "";
                            }
                        }
                        currentLine = reader.ReadLine();
                    }

                    if(currentLine == null) continue;
                    
                    string path;
                    if (currentLine.StartsWith(@"\"))
                    {
                        path = Path.GetPathRoot(playlistFile) + currentLine;
                        playlistEntry.Path = path;
                        playlistEntry.Path = playlistEntry.Path.Replace(@"\\", @"\");
                    }
                    else if (currentLine.Contains(":"))
                    {
                        path = currentLine;
                    }
                    else
                    {
                        path = Path.Combine(Path.GetDirectoryName(playlistFile) + "", currentLine);
                    }

                    var trackDetails = TrackHelper.GuessTrackDetailsFromFilename(path.Trim());
                    if (playlistEntry.Title == "") playlistEntry.Title = trackDetails.Title;
                    if (playlistEntry.Artist == "") playlistEntry.Artist = trackDetails.Artist;
                    playlistEntry.Description = trackDetails.Description;

                    playlistEntry.Path = path.Trim();

                    if (playlistEntry.Path != "")
                    {
                        playlistEntries.Add(playlistEntry);
                    }
                }
                reader.Close();
            }
            return playlistEntries;
        }
            public void EntryMustBeShadowVoted()
            {
                var accessControl = SetupVotableAccessControl();
                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                var entry = new PlaylistEntry(0, Helpers.SetupSongMock());

                Assert.Throws<ArgumentException>(() => accessControl.RegisterShadowVote(token, entry));
            }
Example #35
0
        private static PlaylistEntry SetupVotedEntry()
        {
            var entry = new PlaylistEntry(0, Helpers.SetupSongMock());
            entry.Vote();

            return entry;
        }