Exemple #1
0
        public override void ProcessCommand()
        {
            try
            {
                bool process =
                    ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
                    ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase);

                if (!process)
                {
                    return;
                }

                SVR_AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    return;
                }

                string filePath = ServerSettings.AnimeXmlDirectory;

                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                string fileName         = string.Format("AnimeDoc_{0}.xml", AnimeID);
                string fileNameWithPath = Path.Combine(filePath, fileName);

                string rawXML = "";
                if (File.Exists(fileNameWithPath))
                {
                    StreamReader re = File.OpenText(fileNameWithPath);
                    rawXML = re.ReadToEnd();
                    re.Close();
                }

                Azure_AnimeXML xml = new Azure_AnimeXML();
                xml.AnimeID        = AnimeID;
                xml.AnimeName      = anime.MainTitle;
                xml.DateDownloaded = 0;
                xml.Username       = ServerSettings.AniDB_Username;
                xml.XMLContent     = rawXML;

                AzureWebAPI.Send_AnimeXML(xml);
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex.ToString());
                return;
            }
        }
        public override void ProcessCommand()
        {
            try
            {
                bool process = false;

                if (!process)
                {
                    return;
                }

                SVR_AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    return;
                }

                string filePath = ServerSettings.Instance.AnimeXmlDirectory;

                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }

                string fileName         = $"AnimeDoc_{AnimeID}.xml";
                string fileNameWithPath = Path.Combine(filePath, fileName);

                string rawXML = string.Empty;
                if (File.Exists(fileNameWithPath))
                {
                    StreamReader re = File.OpenText(fileNameWithPath);
                    rawXML = re.ReadToEnd();
                    re.Close();
                }

                Azure_AnimeXML xml = new Azure_AnimeXML
                {
                    AnimeID        = AnimeID,
                    AnimeName      = anime.MainTitle,
                    DateDownloaded = 0,
                    Username       = ServerSettings.Instance.AniDb.Username,
                    XMLContent     = rawXML
                };
                AzureWebAPI.Send_AnimeXML(xml);
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex);
            }
        }