public void DialogInfo(string title, string msg) { AnimePluginSettings settings = new AnimePluginSettings(); if (!settings.FfdshowNotificationsShow) { return; } GUIDialogNotify dlgInfo = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null == dlgInfo) { return; } dlgInfo.Reset(); //dlgInfo.Focusable = false; if (settings.FfdshowNotificationsAutoClose) { dlgInfo.TimeOut = (settings.FfdshowNotificationsAutoCloseTime / 1000); } dlgInfo.SetHeading(title); dlgInfo.SetText(msg); dlgInfo.DoModal(GUIWindowManager.ActiveWindow); }
public void SetupImageClient() { //ServerOnline = false; _imageClient = null; if (!SettingsAreValid()) { return; } try { AnimePluginSettings settings = new AnimePluginSettings(); string url = string.Format(@"http://{0}:{1}/JMMServerImage", settings.JMMServer_Address, settings.JMMServer_Port); BasicHttpBinding binding = new BasicHttpBinding(); binding.MessageEncoding = WSMessageEncoding.Mtom; binding.MaxReceivedMessageSize = 2147483647; binding.ReaderQuotas.MaxArrayLength = 2147483647; EndpointAddress endpoint = new EndpointAddress(new Uri(url)); _imageClient = new JMMImageServer.JMMServerImageClient(binding, endpoint); } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
public static bool SettingsAreValid() { AnimePluginSettings settings = AnimePluginSettings.Instance; if (string.IsNullOrEmpty(settings.JMMServer_Address) || string.IsNullOrEmpty(settings.JMMServer_Port)) { return(false); } return(true); }
public static string GetBaseImagesPath() { //string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); AnimePluginSettings settings = AnimePluginSettings.Instance; string filePath = Path.Combine(settings.ThumbsFolder, "Anime3"); // If user has custom thumbs folder do not add additional folder to path to allows for shared server thumb path if (settings.HasCustomThumbsFolder) { filePath = settings.ThumbsFolder; } if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } return(filePath); }
public void Delete() { try { string result = JMMServerVM.Instance.clientBinaryHTTP.DeleteImportFolder(ImportFolderID.Value); if (!string.IsNullOrEmpty(result)) { BaseConfig.MyAnimeLog.Write(result); } else { AnimePluginSettings settings = new AnimePluginSettings(); settings.RemoveImportFolderMapping(ImportFolderID.Value); } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
public void SetupImageClient() { //ServerOnline = false; _imageClient = null; if (!SettingsAreValid()) { return; } try { AnimePluginSettings settings = AnimePluginSettings.Instance; _imageClient = ClientFactory.Create <IShokoServerImage>($"http://{settings.JMMServer_Address}:{settings.JMMServer_Port}/"); } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
public bool Save() { try { JMMServerBinary.Contract_ImportFolder_SaveResponse response = JMMServerVM.Instance.clientBinaryHTTP.SaveImportFolder(this.ToContract()); if (!string.IsNullOrEmpty(response.ErrorMessage)) { BaseConfig.MyAnimeLog.Write(response.ErrorMessage); return(false); } AnimePluginSettings settings = new AnimePluginSettings(); settings.SetImportFolderMapping(response.ImportFolder.ImportFolderID.Value, LocalPathTemp); return(true); } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } return(false); }
public void loadPlayingPreset(AnimeEpisodeVM curEpisode, string fileName) { debug("Loading preset for episode: " + curEpisode.EpisodeName); List <VideoDetailedVM> fileLocals = curEpisode.FilesForEpisode; FileFfdshowPresetVM fileFfdshowPreset = null; foreach (VideoDetailedVM fileLocal in fileLocals) { if (fileLocal.FullPath.ToUpper() == fileName.ToUpper()) { fileFfdshowPreset = fileLocal.FileFfdshowPreset; break; } } if (fileFfdshowPreset != null && fileFfdshowPreset.Preset != null && fileFfdshowPreset.Preset != "") { debug("Found preset for episode \"" + curEpisode.EpisodeName + "\", preset name is: \"" + fileFfdshowPreset.Preset + "\""); debug("Episode file name is: " + fileName); AnimePluginSettings settings = new AnimePluginSettings(); if (settings.FfdshowNotificationsLock) { Thread.Sleep(settings.FfdshowNotificationsLockTime); //make sure ffdshow has time to load } // Retrieve the ffdshow instance corresponding to the file name // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(fileName, FFDShowAPI.FFDShowAPI.FileNameMode.FileName); <- currently doesn't work // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); <- retrieve only the first ffdshow instance FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); List <FFDShowAPI.FFDShowAPI.FFDShowInstance> ffdshowInstances = FFDShowAPI.FFDShowAPI.getFFDShowInstances(); if (ffdshowInstances == null || ffdshowInstances.Count == 0) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } debug("FFDShow number of instance found: " + ffdshowInstances.Count); for (int i = 0; i < ffdshowInstances.Count; i++) { if (ffdshowInstances[i].fileName == null || ffdshowInstances[i].fileName.Trim() == "") // ffdshow raw doesn't have filename { debug("FFDShow instance without file name found (raw ffdshow)"); ffdshowAPI = new FFDShowAPI.FFDShowAPI(ffdshowInstances[i].handle); if (ffdshowAPI == null) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } break; } } bool isFFDShowActive = ffdshowAPI.checkFFDShowActive(); if (isFFDShowActive) { debug("FFDShow has been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); debug("FFDShow file played: " + ffdshowAPI.getFileName()); try { ffdshowAPI.ActivePreset = fileFfdshowPreset.Preset; DialogInfo("Set ffdshow raw preset:", "\n\"" + fileFfdshowPreset.Preset + "\""); debug("ffdshow raw preset set: " + fileFfdshowPreset.Preset); } catch (Exception ex) { debug("Error while setting ffdshow preset : " + ex.Message + "\n" + ex.StackTrace.ToString()); } } else { debug("FFDShow has not been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); return; } } else { debug("Preset not found for episode \"" + curEpisode.EpisodeName + "\""); } }
public void loadPlayingPreset(AnimeEpisodeVM curEpisode, string fileName) { debug("Loading preset for episode: " + curEpisode.EpisodeName); List<VideoDetailedVM> fileLocals = curEpisode.FilesForEpisode; FileFfdshowPresetVM fileFfdshowPreset = null; foreach (VideoDetailedVM fileLocal in fileLocals) { if (fileLocal.Uri.ToUpper() == fileName.ToUpper()) { fileFfdshowPreset = fileLocal.FileFfdshowPreset; break; } } if (fileFfdshowPreset != null && fileFfdshowPreset.Preset != null && fileFfdshowPreset.Preset != "") { debug("Found preset for episode \"" + curEpisode.EpisodeName + "\", preset name is: \"" + fileFfdshowPreset.Preset + "\""); debug("Episode file name is: " + fileName); AnimePluginSettings settings = new AnimePluginSettings(); if (settings.FfdshowNotificationsLock) { Thread.Sleep(settings.FfdshowNotificationsLockTime); //make sure ffdshow has time to load } // Retrieve the ffdshow instance corresponding to the file name // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(fileName, FFDShowAPI.FFDShowAPI.FileNameMode.FileName); <- currently doesn't work // FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); <- retrieve only the first ffdshow instance FFDShowAPI.FFDShowAPI ffdshowAPI = new FFDShowAPI.FFDShowAPI(); List<FFDShowAPI.FFDShowAPI.FFDShowInstance> ffdshowInstances = FFDShowAPI.FFDShowAPI.getFFDShowInstances(); if (ffdshowInstances == null || ffdshowInstances.Count == 0) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } debug("FFDShow number of instance found: " + ffdshowInstances.Count); for (int i = 0; i < ffdshowInstances.Count; i++) { if (ffdshowInstances[i].fileName == null || ffdshowInstances[i].fileName.Trim() == "") // ffdshow raw doesn't have filename { debug("FFDShow instance without file name found (raw ffdshow)"); ffdshowAPI = new FFDShowAPI.FFDShowAPI(ffdshowInstances[i].handle); if (ffdshowAPI == null) { BaseConfig.MyAnimeLog.Write("FFDShow Error: be sure you have \"ffdshow raw video filter\" added and check in [MediaPortal Configuration -> Videos -> Video Post Processing] and you have in your ffdshow raw configuration: - checked keyboard shortcuts - checked remote API - choosen Custom 32786"); return; } break; } } bool isFFDShowActive = ffdshowAPI.checkFFDShowActive(); if (isFFDShowActive) { debug("FFDShow has been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); debug("FFDShow file played: " + ffdshowAPI.getFileName()); try { ffdshowAPI.ActivePreset = fileFfdshowPreset.Preset; DialogInfo("Set ffdshow raw preset:", "\n\"" + fileFfdshowPreset.Preset + "\""); debug("ffdshow raw preset set: " + fileFfdshowPreset.Preset); } catch (Exception ex) { debug("Error while setting ffdshow preset : " + ex.Message + "\n" + ex.StackTrace.ToString()); } } else { debug("FFDShow has not been found (" + ffdshowAPI.FFDShowAPIRemote + " handle used)"); return; } } else { debug("Preset not found for episode \"" + curEpisode.EpisodeName + "\""); } }
public void DialogInfo(string title, string msg) { AnimePluginSettings settings = new AnimePluginSettings(); if (!settings.FfdshowNotificationsShow) return; GUIDialogNotify dlgInfo = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (null == dlgInfo) return; dlgInfo.Reset(); //dlgInfo.Focusable = false; if (settings.FfdshowNotificationsAutoClose) { dlgInfo.TimeOut = (settings.FfdshowNotificationsAutoCloseTime / 1000); } dlgInfo.SetHeading(title); dlgInfo.SetText(msg); dlgInfo.DoModal(GUIWindowManager.ActiveWindow); }
public void SetupImageClient() { //ServerOnline = false; _imageClient = null; if (!SettingsAreValid()) return; try { AnimePluginSettings settings = new AnimePluginSettings(); string url = string.Format(@"http://{0}:{1}/JMMServerImage", settings.JMMServer_Address, settings.JMMServer_Port); BasicHttpBinding binding = new BasicHttpBinding(); binding.MessageEncoding = WSMessageEncoding.Mtom; binding.MaxReceivedMessageSize = 2147483647; binding.ReaderQuotas.MaxArrayLength = 2147483647; EndpointAddress endpoint = new EndpointAddress(new Uri(url)); _imageClient = new JMMImageServer.JMMServerImageClient(binding, endpoint); } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
public bool SetupBinaryClient() { ServerOnline = false; _clientBinaryHTTP = null; ImportFolders.Clear(); if (!SettingsAreValid()) { return(false); } try { AnimePluginSettings settings = new AnimePluginSettings(); string url = string.Format(@"http://{0}:{1}/JMMServerBinary", settings.JMMServer_Address, settings.JMMServer_Port); BaseConfig.MyAnimeLog.Write("JMM Server URL: " + url); BinaryMessageEncodingBindingElement encoding = new BinaryMessageEncodingBindingElement(); encoding.ReaderQuotas.MaxArrayLength = int.MaxValue; encoding.ReaderQuotas.MaxBytesPerRead = int.MaxValue; encoding.ReaderQuotas.MaxDepth = int.MaxValue; encoding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue; encoding.ReaderQuotas.MaxStringContentLength = int.MaxValue; HttpTransportBindingElement transport = new HttpTransportBindingElement(); transport.MaxReceivedMessageSize = int.MaxValue; transport.MaxBufferPoolSize = int.MaxValue; transport.MaxBufferSize = int.MaxValue; transport.MaxReceivedMessageSize = int.MaxValue; Binding binding = new CustomBinding(encoding, transport); binding.SendTimeout = new TimeSpan(30, 0, 30); binding.ReceiveTimeout = new TimeSpan(30, 0, 30); binding.OpenTimeout = new TimeSpan(30, 0, 30); binding.CloseTimeout = new TimeSpan(30, 0, 30); EndpointAddress endpoint = new EndpointAddress(new Uri(url)); var factory = new ChannelFactory <JMMServerBinary.IJMMServerChannel>(binding, endpoint); foreach (OperationDescription op in factory.Endpoint.Contract.Operations) { var dataContractBehavior = op.Behaviors.Find <DataContractSerializerOperationBehavior>(); if (dataContractBehavior != null) { dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue; } } _clientBinaryHTTP = factory.CreateChannel(); // try connecting to see if the server is responding JMMServerBinary.Contract_ServerStatus status = JMMServerVM.Instance.clientBinaryHTTP.GetServerStatus(); ServerOnline = true; GetServerSettings(); RefreshImportFolders(); BaseConfig.MyAnimeLog.Write("JMM Server Status: " + status.GeneralQueueState); return(true); } catch (Exception ex) { //Utils.ShowErrorMessage(ex); BaseConfig.MyAnimeLog.Write(ex.ToString()); return(false); } }
public static bool SettingsAreValid() { AnimePluginSettings settings = new AnimePluginSettings(); if (string.IsNullOrEmpty(settings.JMMServer_Address) || string.IsNullOrEmpty(settings.JMMServer_Port)) return false; return true; }
public bool Save() { try { JMMServerBinary.Contract_ImportFolder_SaveResponse response = JMMServerVM.Instance.clientBinaryHTTP.SaveImportFolder(this.ToContract()); if (!string.IsNullOrEmpty(response.ErrorMessage)) { BaseConfig.MyAnimeLog.Write(response.ErrorMessage); return false; } AnimePluginSettings settings = new AnimePluginSettings(); settings.SetImportFolderMapping(response.ImportFolder.ImportFolderID.Value, LocalPathTemp); return true; } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } return false; }
public void Delete() { try { string result = JMMServerVM.Instance.clientBinaryHTTP.DeleteImportFolder(ImportFolderID.Value); if (!string.IsNullOrEmpty(result)) BaseConfig.MyAnimeLog.Write(result); else { AnimePluginSettings settings = new AnimePluginSettings(); settings.RemoveImportFolderMapping(ImportFolderID.Value); } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
public bool SetupClient() { ServerOnline = false; _shokoservices = null; ImportFolders.Clear(); if (!SettingsAreValid()) { return(false); } try { AnimePluginSettings settings = AnimePluginSettings.Instance; string url = string.Format(@"http://{0}:{1}/", settings.JMMServer_Address, settings.JMMServer_Port); BaseConfig.MyAnimeLog.Write("JMM Server URL: " + url); Dictionary <Type, Type> mappings = new Dictionary <Type, Type>(); //Mappings area. mappings.Add(typeof(CL_AniDB_Anime), typeof(VM_AniDB_Anime)); mappings.Add(typeof(CL_AniDB_Anime_DefaultImage), typeof(VM_AniDB_Anime_DefaultImage)); mappings.Add(typeof(CL_AniDB_AnimeCrossRefs), typeof(VM_AniDB_AnimeCrossRefs)); mappings.Add(typeof(CL_AnimeEpisode_User), typeof(VM_AnimeEpisode_User)); mappings.Add(typeof(CL_AnimeGroup_User), typeof(VM_AnimeGroup_User)); mappings.Add(typeof(CL_AnimeSeries_User), typeof(VM_AnimeSeries_User)); mappings.Add(typeof(CL_BookmarkedAnime), typeof(VM_BookmarkedAnime)); mappings.Add(typeof(CL_GroupFilter), typeof(VM_GroupFilter)); mappings.Add(typeof(MovieDB_Fanart), typeof(VM_MovieDB_Fanart)); mappings.Add(typeof(MovieDB_Poster), typeof(VM_MovieDB_Poster)); mappings.Add(typeof(CL_Recommendation), typeof(VM_Recommendation)); mappings.Add(typeof(Trakt_ImageFanart), typeof(VM_Trakt_ImageFanart)); mappings.Add(typeof(Trakt_ImagePoster), typeof(VM_Trakt_ImagePoster)); mappings.Add(typeof(TvDB_ImageFanart), typeof(VM_TvDB_ImageFanart)); mappings.Add(typeof(TvDB_ImagePoster), typeof(VM_TvDB_ImagePoster)); mappings.Add(typeof(TvDB_ImageWideBanner), typeof(VM_TvDB_ImageWideBanner)); mappings.Add(typeof(CL_VideoDetailed), typeof(VM_VideoDetailed)); mappings.Add(typeof(CL_VideoLocal), typeof(VM_VideoLocal)); _shokoservices = ClientFactory.Create <IShokoServer>( $"http://{settings.JMMServer_Address}:{settings.JMMServer_Port}/", mappings); // try connecting to see if the server is responding CL_ServerStatus status = Instance.ShokoServices.GetServerStatus(); ServerOnline = true; GetServerSettings(); RefreshImportFolders(); BaseConfig.MyAnimeLog.Write("JMM Server Status: " + status.GeneralQueueState); return(true); } catch (Exception ex) { //Utils.ShowErrorMessage(ex); BaseConfig.MyAnimeLog.Write(ex.ToString()); return(false); } }
public bool SetupBinaryClient() { ServerOnline = false; _clientBinaryHTTP = null; ImportFolders.Clear(); if (!SettingsAreValid()) return false; try { AnimePluginSettings settings = new AnimePluginSettings(); string url = string.Format(@"http://{0}:{1}/JMMServerBinary", settings.JMMServer_Address, settings.JMMServer_Port); BaseConfig.MyAnimeLog.Write("JMM Server URL: " + url); BinaryMessageEncodingBindingElement encoding = new BinaryMessageEncodingBindingElement(); encoding.ReaderQuotas.MaxArrayLength = int.MaxValue; encoding.ReaderQuotas.MaxBytesPerRead = int.MaxValue; encoding.ReaderQuotas.MaxDepth = int.MaxValue; encoding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue; encoding.ReaderQuotas.MaxStringContentLength = int.MaxValue; HttpTransportBindingElement transport = new HttpTransportBindingElement(); transport.MaxReceivedMessageSize = int.MaxValue; transport.MaxBufferPoolSize = int.MaxValue; transport.MaxBufferSize = int.MaxValue; transport.MaxReceivedMessageSize = int.MaxValue; Binding binding = new CustomBinding(encoding, transport); binding.SendTimeout = new TimeSpan(30, 0, 30); binding.ReceiveTimeout = new TimeSpan(30, 0, 30); binding.OpenTimeout = new TimeSpan(30, 0, 30); binding.CloseTimeout = new TimeSpan(30, 0, 30); EndpointAddress endpoint = new EndpointAddress(new Uri(url)); var factory = new ChannelFactory<JMMServerBinary.IJMMServerChannel>(binding, endpoint); foreach (OperationDescription op in factory.Endpoint.Contract.Operations) { var dataContractBehavior = op.Behaviors.Find<DataContractSerializerOperationBehavior>(); if (dataContractBehavior != null) { dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue; } } _clientBinaryHTTP = factory.CreateChannel(); // try connecting to see if the server is responding JMMServerBinary.Contract_ServerStatus status = JMMServerVM.Instance.clientBinaryHTTP.GetServerStatus(); ServerOnline = true; GetServerSettings(); RefreshImportFolders(); BaseConfig.MyAnimeLog.Write("JMM Server Status: " + status.GeneralQueueState); return true; } catch (Exception ex) { //Utils.ShowErrorMessage(ex); BaseConfig.MyAnimeLog.Write(ex.ToString()); return false; } }