public static SubtitleServerSession Create(SubtitleServerType serverType, string serverUrl, string userName, string password, CultureInfo culture = null) { SubtitleServerSession session = null; try { switch (serverType) { case SubtitleServerType.BSP_V1: session = new BspV1Session(serverUrl, userName, password, culture); break; case SubtitleServerType.NuSoap: session = new NuSoapSession(serverUrl, userName, password, culture); break; case SubtitleServerType.Osdb: default: session = new OsdbSession(serverUrl, userName, password, culture); break; } } catch (Exception ex) { Logger.LogException(ex); } return(session); }
public void Dispose() { if (_session != null) { _session.Dispose(); _session = null; } }
public List<SubtitleInfo> GetSubtitles(string fileName) { try { NativeFileInfo nfi = new NativeFileInfo(fileName, true); if (nfi.IsValid) { if (_session == null) { _session = SubtitleServerSession.Create(_serverType, _serverUrl, _userName, _password); } if (_session != null) { return _session.GetSubtitles(fileName); } } } catch (Exception ex) { Logger.LogException(ex); } return null; }
public string DownloadCompressedSubtitle(string fileName, SubtitleInfo subtitle) { try { if (_session == null) { _session = SubtitleServerSession.Create(_serverType, _serverUrl, _userName, _password); } if (_session != null) { return _session.DownloadSubtitle(fileName, subtitle); } } catch (Exception ex) { Logger.LogException(ex); } return string.Empty; }