public static bool RegisterNewBRB(string filename) { // Failsafe so BRB episodes do not get into the system twice, but this should never trigger foreach (BRBEpisode ep in BRBEpisodes) { if (ep.Filename == filename) { return(false); } } try { BRBEpisode newEpisode = new BRBEpisode(filename); if (newEpisode.Duration.Ticks > 0) { BRBEpisodes.Add(new BRBEpisode(filename)); BRBEpisodes.Sort(); RefreshAvailableList(); return(true); } else { return(false); } } catch (IOException) { return(false); } catch (VLCException) { return(false); } }
// Update the filename of a BRB episode, without considering anything else (for instance, when user updates a BRB to its new filename) public static bool TransferToNewFilename(BRBEpisode episode, string newFilename, bool removeOldEpisode) { BRBEpisode newEpisodeVersion = new BRBEpisode(newFilename, episode.Duration, episode.Favourite, episode.Title, episode.Description, episode.Credits, episode.IsNew, episode.PlaybackChapters, episode.GuaranteedPlays, episode.PriorityPlays, episode.AutoMutes, episode.AutoMuteEnabled); newEpisodeVersion.RefreshDuration(); // Make sure the episode's video file is understood by the application if (newEpisodeVersion.Duration.Ticks == 0) { return(false); } if (removeOldEpisode) { BRBEpisodes.Remove(episode); } BRBEpisodes.Add(newEpisodeVersion); BRBEpisodes.Sort(); return(true); }