Example #1
0
        public static Azure_UserInfo GetUserInfoData(string vidPlayer = "")
        {
            try
            {
                if (string.IsNullOrEmpty(ServerSettings.Instance.AniDb.Username))
                {
                    return(null);
                }

                Azure_UserInfo uinfo = new Azure_UserInfo
                {
                    DateTimeUpdated    = DateTime.Now,
                    DateTimeUpdatedUTC = 0,

                    // Optional JMM Desktop data
                    DashboardType = null,
                    VideoPlayer   = vidPlayer
                };
                System.Reflection.Assembly a = System.Reflection.Assembly.GetEntryAssembly();
                try
                {
                    if (a != null)
                    {
                        uinfo.JMMServerVersion = Utils.GetApplicationVersion(a);
                    }
                }
                catch
                {
                    // ignored
                }

                uinfo.UsernameHash   = Utils.GetMd5Hash(ServerSettings.Instance.AniDb.Username);
                uinfo.DatabaseType   = ServerSettings.Instance.Database.Type.ToString();
                uinfo.WindowsVersion = Utils.GetOSInfo();
                uinfo.TraktEnabled   = ServerSettings.Instance.TraktTv.Enabled ? 1 : 0;

                uinfo.CountryLocation = string.Empty;

                // this field is not actually used
                uinfo.LastEpisodeWatchedAsDate = DateTime.Now.AddDays(-5);

                uinfo.LocalUserCount = (int)Repo.Instance.JMMUser.GetTotalRecordCount();

                uinfo.FileCount = Repo.Instance.VideoLocal.GetTotalRecordCount();

                SVR_AnimeEpisode_User rec = Repo.Instance.AnimeEpisode_User.GetLastWatchedEpisode();
                uinfo.LastEpisodeWatched = 0;
                if (rec != null)
                {
                    uinfo.LastEpisodeWatched = Commons.Utils.AniDB.GetAniDBDateAsSeconds(rec.WatchedDate);
                }

                return(uinfo);
            }
            catch (Exception ex)
            {
                logger.Error(ex, ex.ToString());
                return(null);
            }
        }
Example #2
0
        public static void Send_UserInfo()
        {
            //if (!ServerSettings.Instance.WebCache.XRefFileEpisode_Send) return;

            Azure_UserInfo uinfo = GetUserInfoData();

            if (uinfo == null)
            {
                return;
            }

            string uri  = $@"http://{azureHostBaseAddress}/api/userinfo";
            string json = JSONHelper.Serialize(uinfo);

            SendData(uri, json, "POST");
        }
Example #3
0
        public static void Send_UserInfo()
        {
            //if (!ServerSettings.WebCache_XRefFileEpisode_Send) return;

            Azure_UserInfo uinfo = GetUserInfoData();

            if (uinfo == null)
            {
                return;
            }

            string uri  = string.Format(@"http://{0}/api/userinfo", azureHostBaseAddress);
            string json = JSONHelper.Serialize <Azure_UserInfo>(uinfo);

            SendData(uri, json, "POST");
        }