예제 #1
0
 public static OSDotNetSession LogIn(string username, string password, string language, string useragent)
 {
     OSDotNetSession oss = new OSDotNetSession();
     XmlRpcStruct ResponseStruct = oss.proxy.LogIn(username, password, language, useragent);
     oss.LastResponseCode = (string)ResponseStruct["status"];
     oss.LastResponseTime = Convert.ToDouble(ResponseStruct["seconds"]);
     if ((!String.IsNullOrEmpty(oss.LastResponseCode)) && oss.LastResponseCode.Equals("200 OK"))
     {
         oss.Token = (string)ResponseStruct["token"];
         return oss;
     }
     else
     {
         return null;
     }
 }
예제 #2
0
        public static OSDotNetSession LogIn(string username, string password, string language, string useragent)
        {
            OSDotNetSession oss            = new OSDotNetSession();
            XmlRpcStruct    ResponseStruct = oss.proxy.LogIn(username, password, language, useragent);

            oss.LastResponseCode = (string)ResponseStruct["status"];
            oss.LastResponseTime = Convert.ToDouble(ResponseStruct["seconds"]);
            if ((!String.IsNullOrEmpty(oss.LastResponseCode)) && oss.LastResponseCode.Equals("200 OK"))
            {
                oss.Token = (string)ResponseStruct["token"];
                return(oss);
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        public movie FindMovie(string movie, out string state)
        {
            movie result = new movie();
            state = "ok";
            SResults = null;
            try
            {
                session = OSDotNetSession.LogIn("", "", "tr", "indiraganzi");
                SResults = session.SearchByImdbId(movie, lan);
                var qT = (from s in SResults
                          where s.LanguageName == "Turkish" && s.SubFileName.ToLower().EndsWith(".srt") 
                          select s.SubFileName.ToLower()).ToList();
                
                var qE = (from s in SResults
                          where s.LanguageName == "English" && s.SubFileName.ToLower().EndsWith(".srt")
                          select s.SubFileName.ToLower()).ToList();

                var query = (from c in qT
                             join o in qE on c equals o
                             select new { c }).Distinct().ToList();
                Console.WriteLine(movie + " Subtitles: tr("+qT.Count+") en("+qE.Count+ ") = intersection("+query.Count+")");
                if (query.Count > 0)
                {
                    string SubtitleFileName = query[0].c;
                    bool tur = true;
                    bool eng = true;
                    string contenttr = "";
                    string contenten = "";
                    foreach (var item in SResults)
                    {
                        if (item.SubFileName.ToLower() == SubtitleFileName)
                        {
                            if (tur)
                                if ((item.LanguageName == "Turkish"))
                                {
                                    contenttr = getSubtitleText(item, out state);
                                    tur = false;

                                }
                            if (eng)
                                if ((item.LanguageName == "English"))
                                {
                                    contenten = getSubtitleText(item, out state);
                                    eng = false;
                                }
                        }
                    }
                    if ((contenttr.Length > 0) && (contenten.Length > 0))
                    {
                        result.imdbid = SResults[0].IDMovieImdb;
                        result.name = SResults[0].MovieName;
                        result.subtitleFile = SubtitleFileName;
                        result.turkishSubtitle = contenttr;
                        result.englishSubtitle = contenten;
                        return result;
                    }
                }
                else
                    state = "No Intersection";
                return null;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                state = "Error";
                return null;
            }
        }
예제 #4
0
 OSLanguage lan = null;// OSLanguageHelper.GetOSLanguageById("tur");
 public subdownload()
 {
     session = OSDotNetSession.LogIn("", "", "tr", "indiraganzi");// "OSTestUserAgent");
 }