Esempio n. 1
0
        /// <summary>
        /// Handles a given message
        /// </summary>
        /// <param name="client">
        /// The client.
        /// </param>
        /// <param name="collectionManager">
        /// The collection manager.
        /// </param>
        /// <param name="resultHandler">
        /// The result handler.
        /// </param>
        /// <param name="messageText">
        /// The message text.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task HandleMessage(
            IDdpConnectionSender client, 
            ICollectionManager collectionManager, 
            IResultHandler resultHandler, 
            string messageText)
        {
            JObject message = JObject.Parse(messageText);

            if (message["msg"] != null)
            {
                var msg = message["msg"];

                if (msg != null)
                {
                    var messageType = (string)msg;
                    foreach (var handler in this.handlers)
                    {
                        if (handler.CanHandle(messageType))
                        {
                            await handler.HandleMessage(client, collectionManager, resultHandler, messageText);
                        }
                    }
                }
            }
        }
        public ImportTracksDiscEditor(ICollectionManager collectionManager)
        {
            this.collectionManager = collectionManager;
            this.DataContext = this;

            InitializeComponent();
        }
 public DiscogsReleaseMerger(Window window, ICollectionManager collectionManager, Release release, ReleaseImagesEditor imagesEditor)
 {
     this.window = window;
     this.collectionManager = collectionManager;
     this.release = release;
     this.imagesEditor = imagesEditor;
     this.discs = new List<IEnumerable<Tuple<Track, string>>>();
 }
            public ExportTester(ICollectionManager collectionManager)
                : base(collectionManager)
            {
                this.factory = new MemorySessionFactory();
                this.memoryCollection = this.factory.CreateCollectionManager();

                this.releaseComparer = new ReleaseEqualityComparer(true);
                this.importTester = new ImportTester(this.memoryCollection);
            }
        public ViewReleaseImagesWindow(ICollectionManager collectionManager, Release release)
        {
            this.release = release;
            this.CollectionManager = collectionManager;

            InitializeComponent();

            this.releaseImagesEditor.CollectionManager = this.CollectionManager;
            this.releaseImagesEditor.Release = release;
        }
        public LocalCollectionMatcher(ICollectionManager collectionManager)
        {
            this.collectionScanner = new LocalCollectionScanner(collectionManager);
            this.collectionScanner.ProgressChanged += (sender, e) =>
            {
                this.OnCollectionScannerProgressChanged(e);
            };

            this.collectionManager = collectionManager;
        }
Esempio n. 7
0
 public UserViewManager(ILibraryManager libraryManager, ILocalizationManager localizationManager, IUserManager userManager, IChannelManager channelManager, ILiveTvManager liveTvManager, IPlaylistManager playlists, ICollectionManager collectionManager, IServerConfigurationManager config)
 {
     _libraryManager = libraryManager;
     _localizationManager = localizationManager;
     _userManager = userManager;
     _channelManager = channelManager;
     _liveTvManager = liveTvManager;
     _playlists = playlists;
     _collectionManager = collectionManager;
     _config = config;
 }
Esempio n. 8
0
        /// <summary>
        /// Processes the changed message
        /// </summary>
        /// <param name="client">
        /// The connection to send replies to the server
        /// </param>
        /// <param name="collectionManager">
        /// The CollectionManager
        /// </param>
        /// <param name="resultHandler">
        /// The ResultHandler
        /// </param>
        /// <param name="message">
        /// The message to process
        /// </param>
        /// <returns>
        /// Task to process the message
        /// </returns>
        public override Task HandleMessage(
            IDdpConnectionSender client, 
            ICollectionManager collectionManager, 
            IResultHandler resultHandler, 
            string message)
        {
            var changedMessage = JsonConvert.DeserializeObject<Changed>(message);
            collectionManager.Changed(changedMessage);

            return Task.FromResult(true);
        }
        public LocalCollectionMerger(ICollectionManager collectionManager, LocalCollectionMatcherResult matcherResult, bool saveToFiles)
        {
            this.collectionManager = collectionManager;
            this.matcherResult = matcherResult;
            this.saveToFiles = saveToFiles;

            this.total =
                this.matcherResult.NewReleases.Count +
                this.matcherResult.ChangedReleases.Count +
                this.matcherResult.DeletedReleases.Count;
        }
Esempio n. 10
0
        /// <summary>
        /// Processes the ping message
        /// </summary>
        /// <param name="client">
        /// The connection to send replies to the server
        /// </param>
        /// <param name="collectionManager">
        /// The CollectionManager
        /// </param>
        /// <param name="resultHandler">
        /// The ResultHandler
        /// </param>
        /// <param name="message">
        /// The message to process
        /// </param>
        /// <returns>
        /// Task to process the message
        /// </returns>
        public override Task HandleMessage(
            IDdpConnectionSender client, 
            ICollectionManager collectionManager, 
            IResultHandler resultHandler, 
            string message)
        {
            var pingMessage = JsonConvert.DeserializeObject<Ping>(message);
            var pongReply = new Pong() { Id = pingMessage.Id };

            return client.SendObject(pongReply);
        }
Esempio n. 11
0
        /// <summary>
        /// Processes the reply message
        /// </summary>
        /// <param name="client">
        /// The connection to send replies to the server
        /// </param>
        /// <param name="collectionManager">
        /// The CollectionManager
        /// </param>
        /// <param name="resultHandler">
        /// The ResultHandler
        /// </param>
        /// <param name="message">
        /// The message to process
        /// </param>
        /// <returns>
        /// Task to process the message
        /// </returns>
        public Task HandleMessage(
            IDdpConnectionSender client, 
            ICollectionManager collectionManager, 
            IResultHandler resultHandler, 
            string message)
        {
            JObject parsedObject = JObject.Parse(message);
            var result = new ReturnedObject((string)parsedObject["msg"], parsedObject, message);

            resultHandler.AddResult(result);

            return Task.FromResult(true);
        }
Esempio n. 12
0
        // static constructor
        //static Configuration()
        //{
        //    var connectionString = //ConfigurationManager.ConnectionStrings["MongoRepositoryTestsConnectionString"].ConnectionString ??
        //        "mongodb://localhost/?w=1";
        //    var mongoUrl = new MongoUrl(connectionString);
        //    var clientSettings = MongoClientSettings.FromUrl(mongoUrl);
        //    if (!clientSettings.WriteConcern.Enabled)
        //    {
        //        clientSettings.WriteConcern.W = 1; // ensure WriteConcern is enabled regardless of what the URL says
        //    }
        //    __testClient = new MongoClient(clientSettings);
        //    __testServer = __testClient.GetServer();
        //    __testDatabase = __testServer.GetDatabase("csharpdriverunittests");
        //    __testCollection = new CollectionManager(__testDatabase);
        //}
        static Configuration()
        {
            var connectionString =
                ConfigurationManager.ConnectionStrings["MongoRepositoryTestsConnectionString"].ConnectionString;

            var mongoUrl = new MongoUrl(connectionString);
            var clientSettings = MongoClientSettings.FromUrl(mongoUrl);
            if (!clientSettings.WriteConcern.Enabled)
            {
                clientSettings.WriteConcern.W = 1; // ensure WriteConcern is enabled regardless of what the URL says
            }

            __testClient = new MongoClient(clientSettings);
            __testServer = __testClient.GetServer();
            __testDatabase = __testServer.GetDatabase("MongoRepositoryTests");
            __testCollection = new CollectionManager(__testDatabase);
        }
        public void CommitChanges(ICollectionManager collectionManager)
        {
            if (this.Release.Artists.Join() != this.Release.JoinedAlbumArtists)
            {
                this.Release.Artists.Clear();
                this.Release.Artists.Add(new ReleaseArtist()
                {
                    Artist = collectionManager.GetOrCreateArtist(this.Release.JoinedAlbumArtists)
                });
            }

            this.Release.ReleaseDate = ReleaseDate.Parse(this.textReleaseDate.Text);
            this.Release.OriginalReleaseDate = ReleaseDate.Parse(this.textOriginalReleaseDate.Text);

            int discogsRelease, discogsMaster;
            int.TryParse(this.textDiscogsRelease.Text, out discogsRelease);
            int.TryParse(this.textDiscogsMaster.Text, out discogsMaster);
            this.Release.DiscogsReleaseId = discogsRelease;
            this.Release.DiscogsMasterId = discogsMaster;
            this.Release.WikipediaPageName = this.textWikipediaPageName.Text;
        }
        public DiscogsMatchWindow(ICollectionManager manager, IEnumerable<Tuple<TrackEntity, string>> tracks, Release release)
        {
            this.collectionManager = manager;
            this.FixNames = true;

            this.release = release;
            this.matchItems = tracks.Select(i => new MatchItem(i.Item1, i.Item2)).ToArray();

            InitializeComponent();

            this.listReleaseTracklist.DataContext = release;
            this.listReleaseTracklist.ItemsSource = release.Tracklist;

            this.listMatching.ItemsSource = matchItems;

            for (int i = 0; i < this.listReleaseTracklist.Items.Count; ++i)
            {
                Track t = (Track)this.listReleaseTracklist.Items[i];
                if (this.IsValidTrack(t))
                {
                    this.listReleaseTracklist.SelectedItems.Add(t);
                }
            }
        }
 public CollectionImporterBase(ICollectionManager collectionManager)
 {
     this.collectionManager = collectionManager;
     this.readBuffer = new byte[128 * 1024];
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemsService" /> class.
 /// </summary>
 /// <param name="userManager">The user manager.</param>
 /// <param name="libraryManager">The library manager.</param>
 /// <param name="userDataRepository">The user data repository.</param>
 /// <param name="localization">The localization.</param>
 /// <param name="dtoService">The dto service.</param>
 /// <param name="collectionManager">The collection manager.</param>
 public ItemsService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, ILocalizationManager localization, IDtoService dtoService, ICollectionManager collectionManager)
 {
     _userManager        = userManager;
     _libraryManager     = libraryManager;
     _userDataRepository = userDataRepository;
     _localization       = localization;
     _dtoService         = dtoService;
     _collectionManager  = collectionManager;
 }
Esempio n. 17
0
 /// <summary>
 /// Handles a given message
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <param name="collectionManager">
 /// The collection manager.
 /// </param>
 /// <param name="resultHandler">
 /// The result handler.
 /// </param>
 /// <param name="message">
 /// The message.
 /// </param>
 /// <returns>
 /// The <see cref="Task"/>.  The task should be used to execute any long running operation (for instance, needing to send a message to the server as part of handling the message).
 /// </returns>
 public abstract Task HandleMessage(
     IDdpConnectionSender client, 
     ICollectionManager collectionManager, 
     IResultHandler resultHandler, 
     string message);
Esempio n. 18
0
 public CollectionManagerOperations(ICollectionManager collectionManager)
 {
     this.collectionManager = collectionManager;
 }
Esempio n. 19
0
 public XmlReleaseImporter(string path, ICollectionManager collectionManager)
     : base(collectionManager)
 {
     this.path = path;
 }
 public ArchivedCollectionExporter(string outputPath, ICollectionManager collectionManager)
     : base(collectionManager)
 {
     this.zipOutputStream = new ZipOutputStream(File.Create(outputPath));
     this.zipOutputStream.SetLevel(9);
 }
Esempio n. 21
0
 public static Task DropScopeAsync(this ICollectionManager manager, string scopeName)
 {
     return(manager.DropScopeAsync(scopeName, DropScopeOptions.Default));
 }
Esempio n. 22
0
 public CollectionService(ICollectionManager collectionManager, IDtoService dtoService)
 {
     _collectionManager = collectionManager;
     _dtoService        = dtoService;
 }
Esempio n. 23
0
 public static Task CreateCollectionAsync(this ICollectionManager manager, CollectionSpec spec)
 {
     return(manager.CreateCollectionAsync(spec, CreateCollectionOptions.Default));
 }
Esempio n. 24
0
 public static Task DropCollectionAsync(this ICollectionManager manager, CollectionSpec spec)
 {
     return(manager.DropCollectionAsync(spec, DropCollectionOptions.Default));
 }
Esempio n. 25
0
 public static Task <IEnumerable <ScopeSpec> > GetAllScopesAsync(this ICollectionManager manager)
 {
     return(manager.GetAllScopesAsync(GetAllScopesOptions.Default));
 }
Esempio n. 26
0
 public static Task <ScopeSpec> GetScopeAsync(this ICollectionManager manager, string scopeName)
 {
     return(manager.GetScopeAsync(scopeName, GetScopeOptions.Default));
 }
Esempio n. 27
0
 public static Task CreateScopeAsync(this ICollectionManager manager, ScopeSpec scopeSpec)
 {
     return(manager.CreateScopeAsync(scopeSpec, CreateScopeOptions.Default));
 }
Esempio n. 28
0
 public UserViewManager(ILibraryManager libraryManager, ILocalizationManager localizationManager, IUserManager userManager, IChannelManager channelManager, ILiveTvManager liveTvManager, IPlaylistManager playlists, ICollectionManager collectionManager, IServerConfigurationManager config)
 {
     _libraryManager      = libraryManager;
     _localizationManager = localizationManager;
     _userManager         = userManager;
     _channelManager      = channelManager;
     _liveTvManager       = liveTvManager;
     _playlists           = playlists;
     _collectionManager   = collectionManager;
     _config = config;
 }
Esempio n. 29
0
 public EncodingTargetScanner(ICollectionManager collectionManager, EncodingTarget encodingTarget)
 {
     this.collectionManager = collectionManager;
     this.encodingTarget    = encodingTarget;
 }
Esempio n. 30
0
 public CollectionService(ICollectionManager collectionManager, IDtoService dtoService, IAuthorizationContext authContext)
 {
     _collectionManager = collectionManager;
     _dtoService        = dtoService;
     _authContext       = authContext;
 }
 public ArchivedCollectionImporter(string inputPath, ICollectionManager collectionManager)
     : base(collectionManager)
 {
     this.zipFile = new ZipFile(inputPath);
 }
Esempio n. 32
0
 public ArchivedCollectionExporter(string outputPath, ICollectionManager collectionManager)
     : base(collectionManager)
 {
     this.zipOutputStream = new ZipOutputStream(File.Create(outputPath));
     this.zipOutputStream.SetLevel(9);
 }
Esempio n. 33
0
 public void Dispose()
 {
     this.CollectionManager.Dispose();
     this.CollectionManager = null;
 }
Esempio n. 34
0
 public TrailersService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IDtoService dtoService, ICollectionManager collectionManager, ILocalizationManager localizationManager, IJsonSerializer json)
 {
     _userManager         = userManager;
     _userDataRepository  = userDataRepository;
     _libraryManager      = libraryManager;
     _dtoService          = dtoService;
     _collectionManager   = collectionManager;
     _localizationManager = localizationManager;
     _json = json;
 }
Esempio n. 35
0
 public string GetAbsoluteFilename(ICollectionManager collectionManager)
 {
     return Path.Combine(collectionManager.Settings.MusicDirectory, this.RelativeFilename);
 }
 public TMDbCollectionsService(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger <TMDbCollectionsService> logger, ILogger <TMDbBoxSetManager> boxset_logger)
 {
     _tmDbBoxSetManager = new TMDbBoxSetManager(libraryManager, collectionManager, boxset_logger);
     _logger            = logger;
 }
 public DirectoryCollectionImporter(string path, ICollectionManager collectionManager)
     : base(collectionManager)
 {
     this.path = path;
 }
 public ImportTester(ICollectionManager collectionManager)
     : base(collectionManager)
 {
 }
Esempio n. 39
0
 public AddCollection(ILibraryManager libraryManager, ICollectionManager collectionManager)
 {
     this.libraryManager    = libraryManager;
     this.collectionManager = collectionManager;
 }
Esempio n. 40
0
 public HelperBase(MusicDatabaseWindow parentWindow, ICollectionSessionFactory collectionSessionFactory)
 {
     this.ParentWindow      = parentWindow;
     this.CollectionManager = collectionSessionFactory.CreateCollectionManager();
 }
 public DirectoryCollectionExporter(string outputPath, ICollectionManager collectionManager)
     : base(collectionManager)
 {
     this.outputPath = outputPath;
 }
Esempio n. 42
0
 public CollectionImporterBase(ICollectionManager collectionManager)
 {
     this.collectionManager = collectionManager;
     this.readBuffer        = new byte[128 * 1024];
 }
Esempio n. 43
0
 public string GetDirectory(ICollectionManager collectionManager)
 {
     return Path.GetDirectoryName(this.Tracklist[0].GetAbsoluteFilename(collectionManager));
 }
 public EncodingTargetScanner(ICollectionManager collectionManager, EncodingTarget encodingTarget)
 {
     this.collectionManager = collectionManager;
     this.encodingTarget = encodingTarget;
 }
Esempio n. 45
0
 public CollectionController()
 {
     _collectionManager = DIContainer.Instance.Resolve <ICollectionManager>();
 }
 public void CommitChanges(ICollectionManager collectionManager)
 {
     bool hasTrackArtists = this.Release.Tracklist.Any(t => !string.IsNullOrEmpty(t.JoinedArtists));
     foreach (ImportTrackItem track in this.Tracks)
     {
         if (hasTrackArtists)
         {
             if (track.Track.Artists.Join() != track.Track.JoinedArtists)
             {
                 if (string.IsNullOrEmpty(track.Track.JoinedArtists))
                 {
                     track.Track.Artists.Clear();
                     track.Track.Artists.AddRange(this.Release.Artists.Select(releaseArtist => new TrackArtist()
                     {
                         Artist = releaseArtist.Artist,
                         JoinString = releaseArtist.JoinString
                     }));
                     track.Track.JoinedArtists = Release.JoinedAlbumArtists;
                 }
                 else
                 {
                     track.Track.Artists.Clear();
                     track.Track.Artists.Add(new TrackArtist()
                     {
                         Artist = collectionManager.GetOrCreateArtist(track.Track.JoinedArtists)
                     });
                 }
             }
         }
         else
         {
             track.Track.Artists.Clear();
         }
     }
 }
Esempio n. 47
0
 public string GetDirectory(ICollectionManager collectionManager)
 {
     return(Path.GetDirectoryName(this.Tracklist[0].GetAbsoluteFilename(collectionManager)));
 }
 public LocalCollectionScanner(ICollectionManager collectionManager)
 {
     this.collectionManager = collectionManager;
     this.LocalCollection   = new LocalCollection();
 }
 public LocalCollectionScanner(ICollectionManager collectionManager)
 {
     this.collectionManager = collectionManager;
     this.LocalCollection = new LocalCollection();
 }
 public CollectionStatisticsGenerator(ICollectionManager collectionManager)
 {
     this.collectionManager = collectionManager;
 }
Esempio n. 51
0
 public CollectionManagerEntryPoint(ICollectionManager collectionManager, IServerConfigurationManager config, ILogger logger)
 {
     _collectionManager = (CollectionManager)collectionManager;
     _config            = config;
     _logger            = logger;
 }
 public XmlReleaseImporter(string path, ICollectionManager collectionManager)
     : base(collectionManager)
 {
     this.path = path;
 }
 public CollectionExporterBase(ICollectionManager collectionManager)
 {
     this.collectionManager = collectionManager;
 }
        private void MusicDatabaseWindow_Closed(object sender, EventArgs e)
        {
            if (this.collectionManager != null)
            {
                if (this.shouldDisposeCollectionManager)
                {
                    this.collectionManager.Dispose();
                }
                this.collectionManager = null;
            }

            this.SettingsManager.Dispose();

            CollectionManagerGlobal.CollectionChanged -= this.CollectionManager_CollectionChanged;
        }
Esempio n. 55
0
 public ImportTester(ICollectionManager collectionManager)
     : base(collectionManager)
 {
 }