internal static void SendImportMessage(MessageType messageType, ResourcePath path, ImportJobType importJobType)
 {
   SystemMessage msg = new SystemMessage(messageType);
   msg.MessageData[RESOURCE_PATH] = path;
   msg.MessageData[IMPORT_JOB_TYPE] = importJobType;
   ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);
 }
 public ImportJobInformation(ImportJobInformation other)
 {
     _jobType               = other.JobType;
     _basePath              = other.BasePath;
     _metadataExtractorIds  = new HashSet <Guid>(other.MetadataExtractorIds);
     _includeSubDirectories = other.IncludeSubDirectories;
     _state = other.State;
 }
 public ImportJobInformation(ImportJobType jobType, ResourcePath basePath, IEnumerable <Guid> metadataExtractorIds, bool includeSubDirectories)
 {
     _jobType               = jobType;
     _basePath              = basePath;
     _metadataExtractorIds  = new HashSet <Guid>(metadataExtractorIds);
     _includeSubDirectories = includeSubDirectories;
     _state = ImportJobState.None;
 }
 public ImportJobInformation(ImportJobInformation other)
 {
   _jobType = other.JobType;
   _basePath = other.BasePath;
   _metadataExtractorIds = new HashSet<Guid>(other.MetadataExtractorIds);
   _includeSubDirectories = other.IncludeSubDirectories;
   _state = other.State;
 }
 public ImportJobInformation(ImportJobType jobType, ResourcePath basePath, IEnumerable<Guid> metadataExtractorIds, bool includeSubDirectories)
 {
   _jobType = jobType;
   _basePath = basePath;
   _metadataExtractorIds = new HashSet<Guid>(metadataExtractorIds);
   _includeSubDirectories = includeSubDirectories;
   _state = ImportJobState.None;
 }
        public void ScheduleImports(IEnumerable <Guid> shareIds, ImportJobType importJobType)
        {
            CpAction       action   = GetAction("ScheduleImports");
            IList <object> inParams = new List <object> {
                MarshallingHelper.SerializeGuidEnumerationToCsv(shareIds), importJobType == ImportJobType.Refresh ? "Refresh" : "Import"
            };

            action.InvokeAction(inParams);
        }
 public void ImportLocation(ResourcePath path, IEnumerable<string> mediaCategories, ImportJobType importJobType)
 {
   CpAction action = GetAction("ImportLocation");
   string importJobTypeStr;
   switch (importJobType)
   {
     case ImportJobType.Import:
       importJobTypeStr = "Import";
       break;
     case ImportJobType.Refresh:
       importJobTypeStr = "Refresh";
       break;
     default:
       throw new NotImplementedException(string.Format("Import job type '{0}' is not implemented", importJobType));
   }
   IList<object> inParameters = new List<object>
       {
         path.Serialize(),
         StringUtils.Join(", ", mediaCategories),
         importJobTypeStr
       };
   action.InvokeAction(inParameters);
 }
        static UPnPError ParseImportJobType(string argumentName, string importModeStr, out ImportJobType importJobType)
        {
            switch (importModeStr)
            {
            case "Import":
                importJobType = ImportJobType.Import;
                break;

            case "Refresh":
                importJobType = ImportJobType.Refresh;
                break;

            default:
                importJobType = ImportJobType.Import;
                return(new UPnPError(600, string.Format("Argument '{0}' must be of value 'Import' or 'Refresh'", argumentName)));
            }
            return(null);
        }
        internal static void SendImportMessage(MessageType messageType, ResourcePath path, ImportJobType importJobType)
        {
            SystemMessage msg = new SystemMessage(messageType);

            msg.MessageData[RESOURCE_PATH]   = path;
            msg.MessageData[IMPORT_JOB_TYPE] = importJobType;
            ServiceRegistration.Get <IMessageBroker>().Send(CHANNEL, msg);
        }
        public void ImportLocation(ResourcePath path, IEnumerable <string> mediaCategories, ImportJobType importJobType)
        {
            CpAction action = GetAction("ImportLocation");
            string   importJobTypeStr;

            switch (importJobType)
            {
            case ImportJobType.Import:
                importJobTypeStr = "Import";
                break;

            case ImportJobType.Refresh:
                importJobTypeStr = "Refresh";
                break;

            default:
                throw new NotImplementedException(string.Format("Import job type '{0}' is not implemented", importJobType));
            }
            IList <object> inParameters = new List <object>
            {
                path.Serialize(),
                           StringUtils.Join(", ", mediaCategories),
                importJobTypeStr
            };

            action.InvokeAction(inParameters);
        }
示例#11
0
        static void ScheduleClientImports(IDictionary <string, ICollection <Share> > importRequests, ImportJobType importJobType)
        {
            // Client imports
            ICollection <ClientConnection> connectedClients = ServiceRegistration.Get <IClientManager>().ConnectedClients;

            foreach (ClientConnection clientConnection in connectedClients)
            {
                try
                {
                    ICollection <Share> systemShares;
                    if (importRequests.TryGetValue(clientConnection.Descriptor.MPFrontendServerUUID, out systemShares))
                    {
                        foreach (Share share in systemShares)
                        {
                            clientConnection.ClientController.ImportLocation(share.BaseResourcePath, share.MediaCategories, importJobType);
                        }
                    }
                }
                catch (Exception)
                {
                    ServiceRegistration.Get <ILogger>().Info("UPnPServerControllerServiceImpl: Could not import shares of system '{0}'", clientConnection.Descriptor.MPFrontendServerUUID);
                }
            }
        }
示例#12
0
 public ImportJob(ImportJobType jobType, ResourcePath basePath, IEnumerable<Guid> metadataExtractorIds,
     bool includeSubDirectories)
 {
   _jobInfo = new ImportJobInformation(jobType, basePath, new List<Guid>(metadataExtractorIds), includeSubDirectories);
 }
 static UPnPError ParseImportJobType(string argumentName, string importModeStr, out ImportJobType importJobType)
 {
   switch (importModeStr)
   {
     case "Import":
       importJobType = ImportJobType.Import;
       break;
     case "Refresh":
       importJobType = ImportJobType.Refresh;
       break;
     default:
       importJobType = ImportJobType.Import;
       return new UPnPError(600, string.Format("Argument '{0}' must be of value 'Import' or 'Refresh'", argumentName));
   }
   return null;
 }
示例#14
0
 public ImportJob(ImportJobType jobType, ResourcePath basePath, IEnumerable <Guid> metadataExtractorIds,
                  bool includeSubDirectories)
 {
     _jobInfo = new ImportJobInformation(jobType, basePath, new List <Guid>(metadataExtractorIds), includeSubDirectories);
 }
 static void ScheduleClientImports(IDictionary<string, ICollection<Share>> importRequests, ImportJobType importJobType)
 {
   // Client imports
   ICollection<ClientConnection> connectedClients = ServiceRegistration.Get<IClientManager>().ConnectedClients;
   foreach (ClientConnection clientConnection in connectedClients)
     try
     {
       ICollection<Share> systemShares;
       if (importRequests.TryGetValue(clientConnection.Descriptor.MPFrontendServerUUID, out systemShares))
         foreach (Share share in systemShares)
           clientConnection.ClientController.ImportLocation(share.BaseResourcePath, share.MediaCategories, importJobType);
     }
     catch (Exception)
     {
       ServiceRegistration.Get<ILogger>().Info("UPnPServerControllerServiceImpl: Could not import shares of system '{0}'", clientConnection.Descriptor.MPFrontendServerUUID);
     }
 }
 public void ScheduleImports(IEnumerable<Guid> shareIds, ImportJobType importJobType)
 {
   CpAction action = GetAction("ScheduleImports");
   IList<object> inParams = new List<object> {MarshallingHelper.SerializeGuidEnumerationToCsv(shareIds), importJobType == ImportJobType.Refresh ? "Refresh" : "Import"};
   action.InvokeAction(inParams);
 }