Exemplo n.º 1
0
        public Hashtable GetProgramInfo(String _sProgramID)
        {
            pdamxXMLReader    mxXMLReader = null;
            XPathNodeIterator xpathINode;
            Hashtable         hResultSet;
            String            sSearchCriteria = "";

            if (TivoXMLDB == null)
            {
                return(null);
            }

            hResultSet  = new Hashtable();
            mxXMLReader = new pdamxXMLReader();
            mxXMLReader.Open(TivoXMLDB);
            mxXMLReader.AddNamespace("tivo", "http://www.pdamediax.com/tivonowplaying");

            sSearchCriteria = "/tivo:TivoNowPlaying/tivo:ShowList/tivo:Show[tivo:ProgramID =\"" + _sProgramID + "\"]";
            xpathINode      = mxXMLReader.GetNodePath(sSearchCriteria);
            if (!xpathINode.MoveNext())
            {
                return(hResultSet);
            }

            xpathINode.Current.MoveToFirstChild();
            do
            {
                hResultSet.Add(xpathINode.Current.Name, xpathINode.Current.Value);
            }while (xpathINode.Current.MoveToNext());

            return(hResultSet);
        }
Exemplo n.º 2
0
        private void LoadMailSettings(String sDirectory)
        {
            try
            {
                mxXMLConfigReader.Open(sDirectory + sMailProfileFileName);

                if (mxXMLConfigReader.isOpen())
                {
                    Host             = mxXMLConfigReader.GetNodeValue("/SMTP/MailServer/Host");
                    Port             = Convert.ToInt32(mxXMLConfigReader.GetNodeValue("/SMTP/MailServer/Port"));
                    MailQueDirectory = mxXMLConfigReader.GetNodeValue("/SMTP/MailServer/PickupDirectoryLocation");
                    SMTPLog          = mxXMLConfigReader.GetNodeValue("/SMTP/MailServer/SMTPLog");
                    //SMTPLog = mxXMLConfigReader.GetNodeValue("/SMTP/MailServer/Crendentails"); //edf file.
                    bSettingsProfileLoaded = true;
                }
            }
            catch (Exception) {}
        }
Exemplo n.º 3
0
        private Hashtable SearchTivoXMLDB(String [] _sSearchValues)
        {
            pdamxXMLReader    mxXMLReader = null;
            XPathNodeIterator xpathINode;
            Hashtable         hResultSet = new Hashtable();
            Hashtable         hRecord;
            String            sSearchCriteria = "";
            String            sSearchValue;
            int nRecordCnt = 0;

            mxXMLReader = new pdamxXMLReader();
            mxXMLReader.Open(TivoXMLDB);
            mxXMLReader.AddNamespace("tivo", "http://www.pdamediax.com/tivonowplaying");

            for (int nSearches = 0; nSearches < _sSearchValues.Length; nSearches++)
            {
                sSearchValue = pdamxUtility.FilterSpecialChar(_sSearchValues[nSearches]).ToLower();
                if (sSearchValue.Equals("all"))
                {
                    sSearchCriteria = "/tivo:TivoNowPlaying/tivo:ShowList/tivo:Show[starts-with(tivo:SearchAll,\"All\")]";
                }
                else
                {
                    sSearchCriteria = "/tivo:TivoNowPlaying/tivo:ShowList/tivo:Show[starts-with(tivo:TitleStrongSearchKey,\"" + sSearchValue + "\")]"
                                      + " | /tivo:TivoNowPlaying/tivo:ShowList/tivo:Show[starts-with(tivo:EpisodeStrongSearchKey,\"" + sSearchValue + "\")]";
                }

                xpathINode = mxXMLReader.GetNodePath(sSearchCriteria);
                while (xpathINode.MoveNext())
                {
                    hRecord = new Hashtable();
                    xpathINode.Current.MoveToFirstChild();
                    do
                    {
                        hRecord.Add(xpathINode.Current.Name, xpathINode.Current.Value);
                    }while (xpathINode.Current.MoveToNext());
                    hResultSet.Add(Convert.ToString(++nRecordCnt), hRecord);
                }
            }
            return(hResultSet);
        }
Exemplo n.º 4
0
        public Hashtable GetTivoNowPlayingList(String _sSettopUrl, String _sCredentials, String _sTempDataFile)
        {
            String[] sAdvisoryList        = { "AL", "Language", "MV", "Mild Violence", "V", "Violence", "BN", "Brief Nudity", "N", "Nudity", "SC", "Strong Sexual Content", "GV", "Graphic Violence", "AC", "Adult Situations" };
            String[] sStarRatingList      = { "ONE", "*", "ONE POINT FIVE", "*½", "TWO", "**", "TWO POINT FIVE", "**½", "THREE", "***", "THREE POINT FIVE", "***½", "FOUR", "****", "FOUR POINT FIVE", "****½", "FIVE", "*****" };
            String[] sNetworAffiliateList = { "2", "CBS Affiliate", "4", "NBC Affiliate", "5", "Fox Affiliate", "7", "ABC Affiliate", "9", "MyNetworkTV Affiliate", "11", "CW Affiliate" };
            String   sNetworkAffiliate    = "";
            bool     bSeries5             = true;

            DateTimeFormatInfo timeFormat = new CultureInfo("en-US", false).DateTimeFormat;
            XPathNodeIterator  xpathINode;
            XPathNodeIterator  xpathINodeDetails;
            pdamxUrlReader     mxUrlReader;
            pdamxCrypter       mxCrypter;
            pdamxXMLReader     mxXMLReader;
            pdamxSearchKeyGen  mxSearchKeyGen;
            FileInfo           fiTempFileInfo;
            Hashtable          hResultSet = null;
            Hashtable          hRecord    = new Hashtable();
            String             sTempDataFile;

            String[] sCredentials;
            int      nRowCnt              = 0;
            int      nTotalChildren       = 0;
            int      nTivoItemCount       = 0;
            int      nEntriesRead         = 0;
            int      nSeries5StartPos     = 0;
            int      nSeries5NewStartPos  = 0;
            int      nScheduledRecordings = 0;
            long     lTotalRecordingTimeOfScheduledRecordings = 0;
            long     lTotalRecordingTimeOfTivoSuggestions     = 0;
            long     lTotalSStorageUsedByScheduledRecordings  = 0;
            long     lTotalStoragedUsedByTivoSuggestions      = 0;
            bool     bFirstPast = true;

            if (_sSettopUrl == null)
            {
                return(null);
            }

            if (_sCredentials == null)
            {
                return(null);
            }

            if (_sTempDataFile == null)
            {
                return(null);
            }

            if (_sSettopUrl.Length == 0)
            {
                return(null);
            }

            if (_sCredentials.Length == 0)
            {
                return(null);
            }

            if (_sTempDataFile.Length == 0)
            {
                return(null);
            }

            mxCrypter = new pdamxCrypter();
            if (_sCredentials.Contains(".edf"))
            {
                sCredentials = mxCrypter.DecryptFile(_sCredentials).Split('/');
            }
            else
            {
                sCredentials = _sCredentials.Split('/');
            }

            hResultSet    = new Hashtable();
            sTempDataFile = DateTime.Now.Millisecond + "-" + _sTempDataFile;
            while (bSeries5)
            {
                if (!_sSettopUrl.Contains("AnchorOffset") || _sSettopUrl.Contains("Container1"))
                {
                    bSeries5 = false;
                }
                if (bSeries5)
                {
                    _sSettopUrl         = _sSettopUrl.Replace("AnchorOffset=" + Convert.ToString(nSeries5StartPos), "AnchorOffset=" + Convert.ToString(nSeries5NewStartPos));
                    nSeries5NewStartPos = nSeries5NewStartPos + 50;
                }
                mxUrlReader = new pdamxUrlReader();
                mxUrlReader.AcceptInvalidSSLCertificate = true;
                mxUrlReader.UseCredentials = true;
                mxUrlReader.XMLFiltering   = true;
                mxUrlReader.UserCredentals = sCredentials;
                mxUrlReader.Url            = _sSettopUrl;
                mxUrlReader.WriteToFile    = sTempDataFile;

                if (mxUrlReader.OpenUrl() != null) // Temp file created successfully...
                {
                    mxXMLReader    = new pdamxXMLReader();
                    mxSearchKeyGen = new pdamxSearchKeyGen();
                    mxXMLReader.Open(sTempDataFile);
                    mxXMLReader.AddNamespace("tivo", "http://www.tivo.com/developer/calypso-protocol-1.6/");
                    if (mxXMLReader.GetNodeValue("/tivo:TiVoContainer/tivo:ItemCount") != null)
                    {
                        nTivoItemCount = Convert.ToInt32(mxXMLReader.GetNodeValue("/tivo:TiVoContainer/tivo:ItemCount"));
                    }

                    if (bSeries5)
                    {
                        nSeries5StartPos = Convert.ToInt32(mxXMLReader.GetNodeValue("/tivo:TiVoContainer/tivo:ItemStart"));
                    }
                    if (nTivoItemCount == 0)
                    {
                        break;
                    }
                    if (bFirstPast)
                    {
                        hResultSet.Add("Title", mxXMLReader.GetNodeValue("/tivo:TiVoContainer/tivo:Details/tivo:Title"));
                        if (Convert.ToInt32(mxXMLReader.GetNodeValue("/tivo:TiVoContainer/tivo:Details/tivo:TotalItems")) == 1)
                        {
                            fiTempFileInfo = new FileInfo(sTempDataFile);
                            fiTempFileInfo.Delete();
                            return(hResultSet);
                        }
                        hResultSet.Add("SortOrder", mxXMLReader.GetNodeValue("/tivo:TiVoContainer/tivo:SortOrder"));
                        hResultSet.Add("GlobalSort", mxXMLReader.GetNodeValue("/tivo:TiVoContainer/tivo:GlobalSort"));
                        hResultSet.Add("MediaKey", sCredentials[1]);
                        int nStartIdx = _sSettopUrl.IndexOf("//") + 2;
                        hResultSet.Add("SettopIP", _sSettopUrl.Substring(nStartIdx, _sSettopUrl.IndexOf(":", nStartIdx) - nStartIdx));
                        hResultSet.Add("SettopUrl", _sSettopUrl.Replace("&", "&amp;"));
                        bFirstPast = false;
                    }
                    xpathINode = mxXMLReader.GetNodePath("/tivo:TiVoContainer/tivo:Item/*");
                    while (xpathINode.MoveNext())
                    {
                        if (xpathINode.Current.Name.Equals("Details"))
                        {
                            hRecord           = new Hashtable();
                            nTotalChildren    = 0;
                            sNetworkAffiliate = "";
                            xpathINode.Current.MoveToFirstChild();
                            nEntriesRead++;

                            hRecord.Add("TivoSuggestion", "No");
                            do
                            {
                                if (xpathINode.Current.Name.Equals("Title"))
                                {
                                    mxSearchKeyGen.GenerateKey(xpathINode.Current.Value);
                                    hRecord.Add("Title", xpathINode.Current.Value);
                                    hRecord.Add("TitleStrongSearchKey", mxSearchKeyGen.StrongKey);
                                }
                                if (xpathINode.Current.Name.Equals("ProgramId"))
                                {
                                    hRecord.Add("ProgramId", xpathINode.Current.Value);
                                }

                                if (xpathINode.Current.Name.Equals("EpisodeTitle"))
                                {
                                    mxSearchKeyGen.GenerateKey(xpathINode.Current.Value);
                                    hRecord.Add("EpisodeTitle", xpathINode.Current.Value);
                                    hRecord.Add("EpisodeStrongSearchKey", mxSearchKeyGen.StrongKey);
                                }
                                if (xpathINode.Current.Name.Equals("EpisodeNumber"))
                                {
                                    hRecord.Add("EpisodeNumber", xpathINode.Current.Value);
                                }

                                if (xpathINode.Current.Name.Equals("Duration"))
                                {
                                    hRecord.Add("Duration", pdamxUtility.FormatMiliseconds(xpathINode.Current.Value));
                                    hRecord.Add("UFDuration", GetTimeInSeconds(pdamxUtility.FormatMiliseconds(xpathINode.Current.Value)));
                                }
                                if (xpathINode.Current.Name.Equals("CaptureDate"))
                                {
                                    hRecord.Add("RecordDate", xpathINode.Current.Value);
                                }

                                if (xpathINode.Current.Name.Equals("Description"))
                                {
                                    hRecord.Add("Description", xpathINode.Current.Value.Replace(" Copyright Tribune Media Services, Inc.", ""));
                                }

                                if (xpathINode.Current.Name.Equals("SourceChannel"))
                                {
                                    hRecord.Add("Channel", xpathINode.Current.Value);
                                    for (int i = 0; i < sNetworAffiliateList.Length; i = i + 2)
                                    {
                                        if ((hRecord["Channel"].ToString().Equals(sNetworAffiliateList[i])) ||
                                            (hRecord["Channel"].ToString().Equals("70" + sNetworAffiliateList[i])) ||
                                            (hRecord["Channel"].ToString().Equals("7" + sNetworAffiliateList[i])))
                                        {
                                            sNetworkAffiliate = sNetworAffiliateList[i + 1];
                                            break;
                                        }
                                    }
                                    hRecord.Add("NetworkAffiliate", (sNetworkAffiliate.Length > 0 ? sNetworkAffiliate : "Satellite"));
                                }
                                if (xpathINode.Current.Name.Equals("SourceStation"))
                                {
                                    hRecord.Add("StationName", xpathINode.Current.Value);
                                }

                                if (xpathINode.Current.Name.Equals("HighDefinition"))
                                {
                                    hRecord.Add("IsHDContent", xpathINode.Current.Value);
                                }

                                if (xpathINode.Current.Name.Equals("InProgress"))
                                {
                                    hRecord.Add("IsRecording", xpathINode.Current.Value);
                                }

                                if (xpathINode.Current.Name.Equals("SourceSize"))
                                {
                                    hRecord.Add("VidoeSize", pdamxUtility.FormatStorageSize(xpathINode.Current.Value));
                                    hRecord.Add("UFVidoeSize", xpathINode.Current.Value);
                                }

                                if (xpathINode.Current.Name.Equals("TotalItems"))
                                {
                                    nTotalChildren = Convert.ToInt32(xpathINode.Current.Value);
                                }
                            }while (xpathINode.Current.MoveToNext());
                            if (hRecord["IsRecording"] == null)
                            {
                                hRecord.Add("IsRecording", "No"); // Default if not assigned...
                            }
                            xpathINode.Current.MoveToParent();
                        }
                        if (xpathINode.Current.Name.Equals("Links"))
                        {
                            xpathINode.Current.MoveToFirstChild();
                            do
                            {
                                if (xpathINode.Current.Name.Equals("Content"))
                                {
                                    xpathINode.Current.MoveToFirstChild();
                                    do
                                    {
                                        if (xpathINode.Current.Name.Equals("Url"))
                                        {
                                            // Get entries in group...
                                            if (nTotalChildren > 0)
                                            {
                                                pdamxTivo mxTivoChildEntries  = new pdamxTivo();
                                                Hashtable hTivoChildrenRecord = mxTivoChildEntries.GetTivoNowPlayingList(xpathINode.Current.Value, _sCredentials, nTotalChildren + "-" + _sTempDataFile);
                                                int       nMaxChildrenRows    = Convert.ToInt32(hTivoChildrenRecord["ProcessCount"].ToString());
                                                for (int i = 0; i < nMaxChildrenRows;)
                                                {
                                                    if (nEntriesRead == nTivoItemCount)
                                                    {
                                                        Hashtable hChildRecord = (Hashtable)hTivoChildrenRecord[Convert.ToString(++i)];
                                                        hChildRecord.Remove("TivoSuggestion");
                                                        hChildRecord.Add("TivoSuggestion", "Yes");
                                                        lTotalStoragedUsedByTivoSuggestions  = lTotalStoragedUsedByTivoSuggestions + Convert.ToInt64(hChildRecord["UFVidoeSize"]);
                                                        lTotalRecordingTimeOfTivoSuggestions = lTotalRecordingTimeOfTivoSuggestions + Convert.ToInt64(GetTimeInSeconds(hChildRecord["Duration"].ToString()));
                                                        hResultSet.Add(Convert.ToString(++nRowCnt), hChildRecord);
                                                        nScheduledRecordings = nRowCnt - nTotalChildren;
                                                    }
                                                    else
                                                    {
                                                        Hashtable hChildRecord = (Hashtable)hTivoChildrenRecord[Convert.ToString(++i)];
                                                        lTotalSStorageUsedByScheduledRecordings  = lTotalSStorageUsedByScheduledRecordings + Convert.ToInt64(hChildRecord["UFVidoeSize"]);
                                                        lTotalRecordingTimeOfScheduledRecordings = lTotalRecordingTimeOfScheduledRecordings + Convert.ToInt64(GetTimeInSeconds(hChildRecord["Duration"].ToString()));
                                                        hResultSet.Add(Convert.ToString(++nRowCnt), hChildRecord);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                hRecord.Add("DownloadUrl", xpathINode.Current.Value);
                                            }
                                        }
                                    }while (xpathINode.Current.MoveToNext());
                                    xpathINode.Current.MoveToParent();
                                }
                                if (xpathINode.Current.Name.Equals("TiVoVideoDetails"))
                                {
                                    xpathINode.Current.MoveToFirstChild();
                                    do
                                    {
                                        if (xpathINode.Current.Name.Equals("Url"))
                                        {
                                            mxUrlReader.Url         = xpathINode.Current.Value;
                                            mxUrlReader.WriteToFile = "temp-" + sTempDataFile;

                                            if (mxUrlReader.OpenUrl() != null)
                                            {
                                                mxXMLReader = new pdamxXMLReader();
                                                mxXMLReader.Open("temp-" + sTempDataFile);
                                                mxXMLReader.AddNamespace("TvBusMarshalledStruct", "http://tivo.com/developer/xml/idl/TvBusMarshalledStruct");

                                                // Get credits...
                                                String sActorList = "";
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/showing/program/vActor/*");
                                                while (xpathINodeDetails.MoveNext())
                                                {
                                                    String[] sActors = xpathINodeDetails.Current.Value.Split('|');
                                                    sActorList = sActorList + (sActorList.Length > 0 ? ";" : "") + sActors[1] + " " + sActors[0];
                                                }
                                                hRecord.Add("Credits", sActorList);

                                                // Get genres...
                                                String sGenreList = "";
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/showing/program/vProgramGenre/*");
                                                while (xpathINodeDetails.MoveNext())
                                                {
                                                    sGenreList = sGenreList + (sGenreList.Length > 0 ? "," : "") + xpathINodeDetails.Current.Value.Replace("_", "");
                                                }
                                                hRecord.Add("Genre", sGenreList);

                                                // Get advisory...
                                                String sAdvisory = "";
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/showing/program/vAdvisory/*");
                                                while (xpathINodeDetails.MoveNext())
                                                {
                                                    sAdvisory = sAdvisory + (sAdvisory.Length > 0 ? "," : "") + xpathINodeDetails.Current.Value.Replace("_", " ");
                                                }
                                                String[] sParentalRatingReason = sAdvisory.Split(',');
                                                String   sRatingAdvisoryAddon  = "";
                                                for (int j = 0; j < sParentalRatingReason.Length; j++)
                                                {
                                                    for (int i = 0; i < sAdvisoryList.Length; i = i + 2)
                                                    {
                                                        if (sParentalRatingReason[j].ToLower().Trim().Equals(sAdvisoryList[i + 1].ToLower()))
                                                        {
                                                            sRatingAdvisoryAddon = sRatingAdvisoryAddon + (sRatingAdvisoryAddon.Length > 0 ? ";" : "") + sAdvisoryList[i];
                                                        }
                                                    }
                                                }
                                                hRecord.Add("Advisory", sRatingAdvisoryAddon);

                                                // Get movie year...
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/showing/program/movieYear");
                                                xpathINodeDetails.MoveNext();
                                                hRecord.Add("MovieYear", (xpathINodeDetails.Current.Name.Equals("movieYear") ? xpathINodeDetails.Current.Value : ""));

                                                // Get movie rating...
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/showing/program/mpaaRating");
                                                xpathINodeDetails.MoveNext();
                                                if (xpathINodeDetails.Current.Name.Equals("mpaaRating"))
                                                {
                                                    hRecord.Add("ParentalRating", xpathINodeDetails.Current.Value.Replace("_", ""));
                                                }

                                                // Get tv rating...
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/showing/tvRating");
                                                xpathINodeDetails.MoveNext();
                                                if (xpathINodeDetails.Current.Name.Equals("tvRating"))
                                                {
                                                    if (hRecord["ParentalRating"] == null)
                                                    {
                                                        hRecord.Add("ParentalRating", "TV-" + xpathINodeDetails.Current.Value.Replace("_", ""));
                                                    }
                                                    //                                                else
                                                    //                                                {
                                                    //                                                    String sParentalRating = hRecord["ParentalRating"].ToString() + ";" + "TV-" + xpathINodeDetails.Current.Value.Replace("_", "");
                                                    //                                                    hRecord.Remove("ParentalRating");
                                                    //                                                   hRecord.Add("ParentalRating", sParentalRating);
                                                    //                                              }
                                                }

                                                // Get star rating...
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/showing/program/starRating");
                                                xpathINodeDetails.MoveNext();
                                                String sStarRating = (xpathINodeDetails.Current.Name.Equals("starRating") ? xpathINodeDetails.Current.Value.Replace("_", " ") : "");
                                                for (int i = 0; i < sStarRatingList.Length; i = i + 2)
                                                {
                                                    if (sStarRatingList[i].Equals(sStarRating))
                                                    {
                                                        hRecord.Add("StarRating", sStarRatingList[i + 1]);
                                                        break;
                                                    }
                                                }
                                                // Get start time...
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/startTime");
                                                xpathINodeDetails.MoveNext();
                                                if (xpathINodeDetails.Current.Name.Equals("startTime"))
                                                {
                                                    hRecord.Add("Recorded", GetDate(xpathINodeDetails.Current.Value));
                                                    hRecord.Add("StartTime", GetDate(xpathINodeDetails.Current.Value) + " (" + GetTime(xpathINodeDetails.Current.Value) + ")");
                                                    //hRecord.Add("StartTime", xpathINodeDetails.Current.Value.Replace("T", " (").Replace("Z", ")").Replace("-", "/"));
                                                }

                                                // Get start time...
                                                xpathINodeDetails = mxXMLReader.GetNodePath("/TvBusMarshalledStruct:TvBusEnvelope/stopTime");
                                                xpathINodeDetails.MoveNext();
                                                if (xpathINodeDetails.Current.Name.Equals("stopTime"))
                                                {
                                                    hRecord.Add("StopTime", GetDate(xpathINodeDetails.Current.Value) + " (" + GetTime(xpathINodeDetails.Current.Value) + ")");
                                                }

                                                //hRecord.Add("StopTime", xpathINodeDetails.Current.Value.Replace("T", " (").Replace("Z", ")").Replace("-","/"));
                                            }
                                            fiTempFileInfo = new FileInfo("temp-" + sTempDataFile);
                                            fiTempFileInfo.Delete();
                                        }
                                    }while (xpathINode.Current.MoveToNext());
                                    xpathINode.Current.MoveToParent();
                                }
                            }while (xpathINode.Current.MoveToNext());
                            xpathINode.Current.MoveToParent();

                            if (hRecord["Title"] == null)
                            {
                                hRecord.Add("Title", "");
                            }
                            if (hRecord["ProgramId"] == null)
                            {
                                hRecord.Add("ProgramId", "");
                            }
                            if (hRecord["EpisodeTitle"] == null)
                            {
                                hRecord.Add("EpisodeTitle", "");
                            }
                            if (hRecord["EpisodeNumber"] == null)
                            {
                                hRecord.Add("EpisodeNumber", "");
                            }
                            if (hRecord["Duration"] == null)
                            {
                                hRecord.Add("Duration", "");
                            }
                            if (hRecord["Description"] == null)
                            {
                                hRecord.Add("Description", "");
                            }
                            if (hRecord["Channel"] == null)
                            {
                                hRecord.Add("Channel", "");
                            }
                            if (hRecord["StationName"] == null)
                            {
                                hRecord.Add("StationName", "");
                            }
                            if (hRecord["NetworkAffiliate"] == null)
                            {
                                hRecord.Add("NetworkAffiliate", "");
                            }
                            if (hRecord["IsHDContent"] == null)
                            {
                                hRecord.Add("IsHDContent", "");
                            }
                            if (hRecord["IsRecording"] == null)
                            {
                                hRecord.Add("IsRecording", "");
                            }
                            if (hRecord["VidoeSize"] == null)
                            {
                                hRecord.Add("VidoeSize", "");
                            }
                            if (hRecord["DownloadUrl"] == null)
                            {
                                hRecord.Add("DownloadUrl", "");
                            }
                            if (hRecord["Credits"] == null)
                            {
                                hRecord.Add("Credits", "");
                            }
                            if (hRecord["Genre"] == null)
                            {
                                hRecord.Add("Genre", "");
                            }
                            if (hRecord["Advisory"] == null)
                            {
                                hRecord.Add("Advisory", "");
                            }
                            if (hRecord["MovieYear"] == null)
                            {
                                hRecord.Add("MovieYear", "");
                            }
                            if (hRecord["ParentalRating"] == null)
                            {
                                hRecord.Add("ParentalRating", "");
                            }
                            if (hRecord["StarRating"] == null)
                            {
                                hRecord.Add("StarRating", "");
                            }
                            if (hRecord["StartTime"] == null)
                            {
                                hRecord.Add("StartTime", "");
                            }
                            if (hRecord["StopTime"] == null)
                            {
                                hRecord.Add("StopTime", "");
                            }
                            if (hRecord["TivoSuggestion"] == null)
                            {
                                hRecord.Add("TivoSuggestion", "");
                            }
                            if (hRecord["TitleStrongSearchKey"] == null)
                            {
                                hRecord.Add("TitleStrongSearchKey", "");
                            }
                            if (hRecord["EpisodeStrongSearchKey"] == null)
                            {
                                hRecord.Add("EpisodeStrongSearchKey", "");
                            }

                            if (nTotalChildren == 0)
                            {
                                lTotalSStorageUsedByScheduledRecordings  = lTotalSStorageUsedByScheduledRecordings + Convert.ToInt64(hRecord["UFVidoeSize"]);
                                lTotalRecordingTimeOfScheduledRecordings = lTotalRecordingTimeOfScheduledRecordings + Convert.ToInt64(GetTimeInSeconds(hRecord["Duration"].ToString()));
                                hResultSet.Add(Convert.ToString(++nRowCnt), hRecord);
                            }
                        }
                    }
                }
                else
                {
                    break;
                }
                fiTempFileInfo = new FileInfo(sTempDataFile);
                fiTempFileInfo.Delete();
            }
            fiTempFileInfo = new FileInfo(sTempDataFile);
            fiTempFileInfo.Delete();
            if (nScheduledRecordings == 0) // Not set...
            {
                nScheduledRecordings = nRowCnt;
            }
            hResultSet.Add("ProcessCount", Convert.ToString(nRowCnt));
            hResultSet.Add("ScheduledRecordings", Convert.ToString(nScheduledRecordings));
            hResultSet.Add("TotalStoragedUsedByTivoSuggestions", pdamxUtility.FormatStorageSize(Convert.ToString(lTotalStoragedUsedByTivoSuggestions)));
            hResultSet.Add("TotalSStorageUsedByScheduledRecordings", pdamxUtility.FormatStorageSize(Convert.ToString(lTotalSStorageUsedByScheduledRecordings)));
            hResultSet.Add("TotalStorageUsed", pdamxUtility.FormatStorageSize(Convert.ToString(lTotalSStorageUsedByScheduledRecordings + lTotalStoragedUsedByTivoSuggestions)));
            hResultSet.Add("UFTotalStoragedUsedByTivoSuggestions", Convert.ToString(lTotalStoragedUsedByTivoSuggestions));
            hResultSet.Add("UFTotalSStorageUsedByScheduledRecordings", Convert.ToString(lTotalSStorageUsedByScheduledRecordings));
            hResultSet.Add("UFTotalStorageUsed", Convert.ToString(lTotalSStorageUsedByScheduledRecordings + lTotalStoragedUsedByTivoSuggestions));
            hResultSet.Add("TotalRecordingTimeOfTivoSuggestions", pdamxUtility.FormatSeconds(Convert.ToString(lTotalRecordingTimeOfTivoSuggestions)));
            hResultSet.Add("TotalRecordingTimeOfScheduledRecordings", pdamxUtility.FormatSeconds(Convert.ToString(lTotalRecordingTimeOfScheduledRecordings)));
            hResultSet.Add("TotalRecordingTime", pdamxUtility.FormatSeconds(Convert.ToString(lTotalRecordingTimeOfScheduledRecordings + lTotalRecordingTimeOfTivoSuggestions)));
            hResultSet.Add("UFTotalRecordingTimeOfTivoSuggestions", Convert.ToString(lTotalRecordingTimeOfTivoSuggestions));
            hResultSet.Add("UFTotalRecordingTimeOfScheduledRecordings", Convert.ToString(lTotalRecordingTimeOfScheduledRecordings));
            hResultSet.Add("UFTotalRecordingTime", Convert.ToString(lTotalRecordingTimeOfScheduledRecordings + lTotalRecordingTimeOfTivoSuggestions));
            return(hResultSet);
        }
Exemplo n.º 5
0
        public BuildExVideoXMLDB()
        {
            DateTimeFormatInfo dtFormat      = new CultureInfo("en-US", false).DateTimeFormat;
            Hashtable          hSearchResult = null;
            FileInfo           fiFileInfo;
            pdamxXMLReader     mxXMLVideoXMLDBReader;
            pdamxXMLReader     mxXMLExBackupVideoXMLDBReader = null;
            pdamxXMLWriter     mxExVidoeXMLDBWriter;
            pdamxBeyondTV      mxBeyondTV;
            XPathNodeIterator  xpathINode;
            String             sExVideoXMLDBLibraryFile = "";
            String             sVideoXMLDBLibraryFile   = "";
            String             sExVideoXMLDBBackupFile  = "";
            String             sBTVNetworkLicenseFile   = "";
            String             sBTVUserAccessFile       = "";
            String             sBTVNetworkLicense       = "";
            String             sPrevTitle = "";

            int nNumberOfMoviesRead              = 0;
            int nNumberOfMovieEntriesSkipped     = 0;
            int nNumberOfMoviesFoundInGuide      = 0;
            int nNumberOfMoviesFoundInExArchive  = 0;
            int nNumberOfMovieEntryWrittened     = 0;
            int nNumberOfMoviesNotFound          = 0;
            int nNumberOfArchiveEntriesWrittened = 0;

            bool bExVideoXMLDBBackupFound = false;

            String jobInfoXMLTemplate =
                "\n   <JobInfo>"
                + "\n      <Generated></Generated>"
                + "\n      <Generator></Generator>"
                + "\n       <Machine></Machine>"
                + "\n      <OS></OS>"
                + "\n      <OSVersion></OSVersion>"
                + "\n   </JobInfo>";

            String movieXMLTemplate =
                "\n   <Movie>"
                + "\n     <Title></Title>"
                + "\n     <Description></Description>"
                + "\n     <Credits></Credits>"
                + "\n     <MovieYear></MovieYear>"
                + "\n     <ParentalRating></ParentalRating>"
                + "\n   </Movie>";

            String summaryXMLTemplate =
                "\n   <Summary>"
                + "\n     <MoviesRead></MoviesRead>"
                + "\n     <EntriesWrittened></EntriesWrittened>"
                + "\n     <EntriesFoundInBTVGuide></EntriesFoundInBTVGuide>"
                + "\n     <EntriesFoundedInArchive></EntriesFoundedInArchive>"
                + "\n     <EntriesNotFound></EntriesNotFound>"
                + "\n     <EntriesSkipped></EntriesSkipped>"
                + "\n     <ArchiveEntriesWrittened></ArchiveEntriesWrittened>"
                + "\n   </Summary>";

            // Get file names...
            sExVideoXMLDBLibraryFile = GetSettings("/Video/Catalog/ExVideoXMLDBLibraryFile");
            sVideoXMLDBLibraryFile   = GetSettings("/Video/Catalog/VideoXMLDBLibraryFile");

            // If file created once today then don't create a second time...
            FileInfo fiVideoInfo = new FileInfo(sExVideoXMLDBLibraryFile);

            if (fiVideoInfo.Exists)
            {
                bool bBypassDateCheck = false;
                if (GetSettings("/Video/Catalog/IgnoreDateCheck") != null)
                {
                    if (GetSettings("/Video/Catalog/IgnoreDateCheck").ToLower().Equals("true"))
                    {
                        bBypassDateCheck = true;
                    }
                }
                if (!bBypassDateCheck)
                {
                    DateTime dtOfFile = fiVideoInfo.LastWriteTime;
                    if (dtOfFile.ToString("MM/dd/yyyy", dtFormat).Equals(DateTime.Now.ToString("MM/dd/yyyy", dtFormat)))
                    {
                        return;
                    }
                }
            }
            sExVideoXMLDBBackupFile = GetSettings("/Video/Catalog/BackupFile");
            sBTVNetworkLicenseFile  = GetSettings("/Video/BeyondTV/License/NetworkLicense");
            if (sBTVNetworkLicenseFile.ToLower().Contains(".edf"))
            {
                sBTVNetworkLicense = Crypter.DecryptFile(sBTVNetworkLicenseFile);
            }
            else
            {
                sBTVNetworkLicense = sBTVNetworkLicenseFile;
            }

            // Get BeyondTV user account...
            sBTVUserAccessFile = GetSettings("/Video/BeyondTV/License/User");

            // Backup Extended Video Libarary XML Data file...
            bExVideoXMLDBBackupFound = BackupExVXMLDataFile(sExVideoXMLDBLibraryFile, sExVideoXMLDBBackupFile);

            try
            {
                mxXMLVideoXMLDBReader = new pdamxXMLReader();
                mxXMLVideoXMLDBReader.Open(sVideoXMLDBLibraryFile);
                mxXMLVideoXMLDBReader.AddNamespace("vxmldb", "http://www.pdamediax.com/videoxmldb");

                mxBeyondTV = new pdamxBeyondTV(sBTVNetworkLicense, sBTVUserAccessFile);

                if (bExVideoXMLDBBackupFound)
                {
                    mxXMLExBackupVideoXMLDBReader = new pdamxXMLReader();
                    mxXMLExBackupVideoXMLDBReader.Open(sExVideoXMLDBBackupFile);
                    mxXMLExBackupVideoXMLDBReader.AddNamespace("exvxmldb", "http://www.pdamediax.com/exvideoxmldb");
                }
                mxExVidoeXMLDBWriter = new pdamxXMLWriter();
                mxExVidoeXMLDBWriter.LoadXMLTemplate("jobInfoXMLTemplate", jobInfoXMLTemplate);
                mxExVidoeXMLDBWriter.LoadXMLTemplate("movieXMLTemplate", movieXMLTemplate);
                mxExVidoeXMLDBWriter.LoadXMLTemplate("summaryXMLTemplate", summaryXMLTemplate);

                mxExVidoeXMLDBWriter.RootNode  = "VideoCatalog";
                mxExVidoeXMLDBWriter.Namespace = "http://www.pdamediax.com/exvideoxmldb";
                mxExVidoeXMLDBWriter.Open("result-" + Program + ".xml");

                // Write XML content to console stream or file...
                mxExVidoeXMLDBWriter.CopyXMLTemplate("jobInfoXMLTemplate");
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("jobInfoXMLTemplate", "Generated", StartTime);
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("jobInfoXMLTemplate", "Generator", Program);
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("jobInfoXMLTemplate", "Machine", Machine);
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("jobInfoXMLTemplate", "OS", OS);
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("jobInfoXMLTemplate", "OSVersion", OSVersion);
                mxExVidoeXMLDBWriter.Write(mxExVidoeXMLDBWriter.GetXMLTemplate("jobInfoXMLTemplate"));

                mxExVidoeXMLDBWriter.Write("\n  <MoviesCatalog>");

                // Write archive entries...
                if (bExVideoXMLDBBackupFound)
                {
                    xpathINode = mxXMLExBackupVideoXMLDBReader.GetNodePath("/exvxmldb:VideoCatalog/exvxmldb:MoviesCatalog/*");
                    xpathINode.MoveNext();
                    xpathINode.Current.MoveToParent();
                    xpathINode.Current.MoveToFirstChild();

                    do
                    {
                        if (xpathINode.Current.Name.Equals("Movie"))
                        {
                            String sTitle       = "";
                            String sMovieYear   = "";
                            String sDescription = "";
                            String sCredits     = "";
                            String sRating      = "";

                            xpathINode.Current.MoveToFirstChild();
                            do
                            {
                                if (xpathINode.Current.Name.Equals("Title"))
                                {
                                    sTitle = xpathINode.Current.Value;
                                }

                                if (xpathINode.Current.Name.Equals("MovieYear"))
                                {
                                    sMovieYear = xpathINode.Current.Value;
                                }

                                if (xpathINode.Current.Name.Equals("Description"))
                                {
                                    sDescription = xpathINode.Current.Value;
                                }

                                if (xpathINode.Current.Name.Equals("Credits"))
                                {
                                    sCredits = xpathINode.Current.Value;
                                }

                                if (xpathINode.Current.Name.Equals("ParentalRating"))
                                {
                                    sRating = xpathINode.Current.Value;
                                }
                            }while (xpathINode.Current.MoveToNext());
                            mxExVidoeXMLDBWriter.CopyXMLTemplate("movieXMLTemplate");
                            mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "Title", sTitle);
                            mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "Description", sDescription);
                            mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "Credits", sCredits);
                            mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "MovieYear", sMovieYear);
                            mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "ParentalRating", sRating);
                            if (sMovieYear != null && sRating != null)
                            {
                                if (sMovieYear != "" && sRating != "")
                                {
                                    mxExVidoeXMLDBWriter.Write(mxExVidoeXMLDBWriter.GetXMLTemplate("movieXMLTemplate"));
                                    nNumberOfArchiveEntriesWrittened++;
                                    nNumberOfMovieEntryWrittened++;
                                }
                            }
                            xpathINode.Current.MoveToParent();
                        }
                    }while (xpathINode.Current.MoveToNext());
                }
                xpathINode = mxXMLVideoXMLDBReader.GetNodePath("/vxmldb:VideoCatalog/vxmldb:MoviesCatalog/*");
                xpathINode.MoveNext();
                xpathINode.Current.MoveToParent();
                xpathINode.Current.MoveToFirstChild();

                do
                {
                    if (xpathINode.Current.Name.Equals("Movie"))
                    {
                        String sTitle       = "";
                        String sMovieYear   = "";
                        String sDescription = "";
                        String sCredits     = "";

                        xpathINode.Current.MoveToFirstChild();
                        nNumberOfMoviesRead++;
                        do
                        {
                            if (xpathINode.Current.Name.Equals("Title"))
                            {
                                sTitle = xpathINode.Current.Value;
                            }

                            if (xpathINode.Current.Name.Equals("MovieYear"))
                            {
                                sMovieYear = xpathINode.Current.Value;
                            }

                            if (xpathINode.Current.Name.Equals("Description"))
                            {
                                sDescription = xpathINode.Current.Value;
                            }

                            if (xpathINode.Current.Name.Equals("Credits"))
                            {
                                sCredits = xpathINode.Current.Value;
                            }
                        }while (xpathINode.Current.MoveToNext());

                        if ((sMovieYear.Trim().Length == 0) || (sCredits.Trim().Length == 0) ||
                            (sDescription.Trim().Length == 0))
                        {
                            hSearchResult = null;
                            if (!sTitle.Equals(sPrevTitle))
                            {
                                bool bSkipEntry = false;
                                if (bExVideoXMLDBBackupFound)
                                {
                                    if ((hSearchResult = GetArchiveProgramInfo(mxXMLExBackupVideoXMLDBReader, sTitle)) != null)
                                    {
                                        bSkipEntry = true;
                                        nNumberOfMoviesFoundInExArchive++;
                                    }
                                }
                                if (hSearchResult == null)
                                {
                                    if ((hSearchResult = GetBTVProgramInfo(mxBeyondTV.SearchGuideAll(sTitle), sTitle)) != null)
                                    {
                                        nNumberOfMoviesFoundInGuide++;
                                    }
                                }

                                if (!bSkipEntry)
                                {
                                    if (hSearchResult != null)
                                    {
                                        String sRating = (hSearchResult["Rating"] != null ? hSearchResult["Rating"].ToString() : (hSearchResult["ParentalRating"] != null ? hSearchResult["ParentalRating"].ToString() : ""));
                                        sMovieYear = (hSearchResult["MovieYear"] != null ? hSearchResult["MovieYear"].ToString() : "");

                                        mxExVidoeXMLDBWriter.CopyXMLTemplate("movieXMLTemplate");
                                        mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "Title", sTitle);
                                        mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "Description", (hSearchResult["EpisodeDescription"] != null ? hSearchResult["EpisodeDescription"].ToString() : (hSearchResult["Description"] != null ? hSearchResult["Description"].ToString() : "")));
                                        mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "Credits", (hSearchResult["Actors"] != null ? hSearchResult["Actors"].ToString() : (hSearchResult["Credits"] != null ? hSearchResult["Credits"].ToString() : "")));
                                        mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "MovieYear", (hSearchResult["MovieYear"] != null ? hSearchResult["MovieYear"].ToString() : ""));
                                        mxExVidoeXMLDBWriter.SetXMLTemplateElement("movieXMLTemplate", "ParentalRating", (hSearchResult["Rating"] != null ? hSearchResult["Rating"].ToString() : (hSearchResult["ParentalRating"] != null ? hSearchResult["ParentalRating"].ToString() : "")));

                                        if (sMovieYear != "" && sRating != "")
                                        {
                                            mxExVidoeXMLDBWriter.Write(mxExVidoeXMLDBWriter.GetXMLTemplate("movieXMLTemplate"));
                                            nNumberOfMovieEntryWrittened++;
                                        }
                                    }
                                    else
                                    {
                                        nNumberOfMoviesNotFound++;
                                    }
                                }
                                sPrevTitle = sTitle;
                            }
                            else
                            {
                                nNumberOfMovieEntriesSkipped++;
                            }
                        }
                        else
                        {
                            nNumberOfMovieEntriesSkipped++;
                        }
                        xpathINode.Current.MoveToParent();
                    }
                }while (xpathINode.Current.MoveToNext());

                mxExVidoeXMLDBWriter.Write("\n  </MoviesCatalog>");
                mxExVidoeXMLDBWriter.CopyXMLTemplate("summaryXMLTemplate");
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("summaryXMLTemplate", "MoviesRead", Convert.ToString(nNumberOfMoviesRead));
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("summaryXMLTemplate", "EntriesWrittened", Convert.ToString(nNumberOfMovieEntryWrittened));
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("summaryXMLTemplate", "EntriesFoundInBTVGuide", Convert.ToString(nNumberOfMoviesFoundInGuide));
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("summaryXMLTemplate", "EntriesFoundedInArchive", Convert.ToString(nNumberOfMoviesFoundInExArchive));
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("summaryXMLTemplate", "EntriesNotFound", Convert.ToString(nNumberOfMoviesNotFound));
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("summaryXMLTemplate", "EntriesSkipped", Convert.ToString(nNumberOfMovieEntriesSkipped));
                mxExVidoeXMLDBWriter.SetXMLTemplateElement("summaryXMLTemplate", "ArchiveEntriesWrittened", Convert.ToString(nNumberOfArchiveEntriesWrittened));
                mxExVidoeXMLDBWriter.Write(mxExVidoeXMLDBWriter.GetXMLTemplate("summaryXMLTemplate"));
                mxExVidoeXMLDBWriter.Close();
                File.Copy("result-" + Program + ".xml", sExVideoXMLDBLibraryFile, true);
                fiFileInfo = new FileInfo("result-" + Program + ".xml");
                fiFileInfo.Delete();

                // Job Summary...
                WriteEndofJobSummaryToFile = true;
                AddSummaryExtra("");
                AddSummaryExtra("Extended Video Library Processing Summary");
                AddSummaryExtra("");
                AddSummaryExtra("  Movie Video Entries:                " + pdamxUtility.FormatNumber(nNumberOfMoviesRead));
                AddSummaryExtra("  --- Movie Video Entries Not Found:  " + pdamxUtility.FormatNumber(nNumberOfMoviesNotFound));
                AddSummaryExtra("  --- Movie Video Entries Skipped  :  " + pdamxUtility.FormatNumber(nNumberOfMovieEntriesSkipped));
                AddSummaryExtra("");
                AddSummaryExtra("  Movie Video Entrie's Info Writtened:  " + pdamxUtility.FormatNumber(nNumberOfMovieEntryWrittened));
                AddSummaryExtra("  --- BTV Guide Search Hits:            " + pdamxUtility.FormatNumber(nNumberOfMoviesFoundInGuide));
                AddSummaryExtra("  --- Archive Search Hits:              " + pdamxUtility.FormatNumber(nNumberOfMoviesFoundInExArchive));
                AddSummaryExtra("  --- Archive Entries Writtened:        " + pdamxUtility.FormatNumber(nNumberOfArchiveEntriesWrittened));
                PrintEndofJobSummary();
            }
            catch (Exception e)
            {
                Console.WriteLine("BuildExVideoXMLDB Error: " + e.Message);
                Console.ReadKey();
                return;
            }
        }
Exemplo n.º 6
0
        public Hashtable SearchSchedule(String _sSearchValue, int _nSearchCatagory)
        {
            pdamxXMLReader    mxXMLReader = null;
            pdamxSearchKeyGen mxSearchKeyGen;;
            Hashtable         hResultSet;
            Hashtable         hRecord;
            XPathNodeIterator xpathINode = null;
            String            sSearchCriteria;

            String[] sMultiSearch;
            int      nCnt = 0;

            if (_nSearchCatagory != CATAGORY_BEYONDTV && _nSearchCatagory != CATAGORY_MCE && _nSearchCatagory != CATAGORY_ALL)
            {
                return(null);
            }

            if (_nSearchCatagory == CATAGORY_BEYONDTV && sBeyondTVchedule == "")
            {
                return(null);
            }

            if (_nSearchCatagory == CATAGORY_MCE && sMCESchedule == "")
            {
                return(null);
            }

            if (_nSearchCatagory == CATAGORY_BEYONDTV && sBeyondTVchedule == "")
            {
                return(null);
            }

            if (_nSearchCatagory == CATAGORY_ALL && (sMCESchedule == "" && sBeyondTVchedule == ""))
            {
                return(null);
            }

            sMultiSearch = _sSearchValue.Split(';');
            if (sMultiSearch.Length == 0)
            {
                sMultiSearch    = new String[1];
                sMultiSearch[0] = _sSearchValue;
            }
            mxXMLReader = new pdamxXMLReader();
            hResultSet  = new Hashtable();
            if (_nSearchCatagory == CATAGORY_BEYONDTV || _nSearchCatagory == CATAGORY_ALL)
            {
                mxSearchKeyGen = new pdamxSearchKeyGen();
                mxXMLReader.Open(sBeyondTVchedule);
                mxXMLReader.AddNamespace("sch", "http://www.pdamediax.com/btv");

                for (int i = 0; i < sMultiSearch.Length; i++)
                {
                    mxSearchKeyGen.GenerateKey(sMultiSearch[i].Replace("\"", "").Replace(":", " - "));
                    sSearchCriteria = "/sch:BeyondTV/sch:UpcomingRecordings/sch:Show[starts-with(sch:TitleStrongSearchKey,\"" + mxSearchKeyGen.StrongKey + "\")]"
                                      + " | /sch:BeyondTV/sch:UpcomingRecordings/sch:Show[starts-with(sch:EpisodeStrongSearchKey,\"" + mxSearchKeyGen.StrongKey + "\")]";

                    xpathINode = mxXMLReader.GetNodePath(sSearchCriteria);
                    while (xpathINode.MoveNext())
                    {
                        hRecord = new Hashtable();
                        xpathINode.Current.MoveToFirstChild();
                        if (xpathINode.Current.Name.Equals("Title"))
                        {
                            do
                            {
                                hRecord.Add(xpathINode.Current.Name, xpathINode.Current.Value);
                            }while (xpathINode.Current.MoveToNext());
                        }
                        hRecord.Add("Catagory", "BeyondTV");
                        hResultSet.Add(Convert.ToString(++nCnt), hRecord);
                    }
                }
            }
            if (_nSearchCatagory == CATAGORY_MCE || _nSearchCatagory == CATAGORY_ALL)
            {
                mxSearchKeyGen = new pdamxSearchKeyGen();
                mxXMLReader.Open(sMCESchedule);
                mxXMLReader.AddNamespace("sch", "http://www.pdamediax.com/mce");

                for (int i = 0; i < sMultiSearch.Length; i++)
                {
                    mxSearchKeyGen.GenerateKey(sMultiSearch[i].Replace("\"", "").Replace(":", " - "));
                    sSearchCriteria = "/sch:MCETV/sch:UpcomingRecordings/sch:Show[starts-with(sch:TitleStrongSearchKey,\"" + mxSearchKeyGen.StrongKey + "\")]"
                                      + " | /sch:MCETV/sch:UpcomingRecordings/sch:Show[starts-with(sch:EpisodeStrongSearchKey,\"" + mxSearchKeyGen.StrongKey + "\")]";

                    xpathINode = mxXMLReader.GetNodePath(sSearchCriteria);
                    while (xpathINode.MoveNext())
                    {
                        hRecord = new Hashtable();
                        xpathINode.Current.MoveToFirstChild();
                        if (xpathINode.Current.Name.Equals("Title"))
                        {
                            do
                            {
                                hRecord.Add(xpathINode.Current.Name, xpathINode.Current.Value);
                            }while (xpathINode.Current.MoveToNext());
                        }
                        hRecord.Add("Catagory", "MCE");
                        hResultSet.Add(Convert.ToString(++nCnt), hRecord);
                    }
                }
            }
            return(hResultSet);
        }
Exemplo n.º 7
0
        public Hashtable GetUpcomingRecordings(int _nCatagory)
        {
            pdamxXMLReader    mxXMLReader = null;
            Hashtable         hResultSet;
            Hashtable         hRecord;
            XPathNodeIterator xpathINode = null;
            int nCnt = 0;

            if (_nCatagory != CATAGORY_BEYONDTV && _nCatagory != CATAGORY_MCE && _nCatagory != CATAGORY_ALL)
            {
                return(null);
            }

            if (_nCatagory == CATAGORY_BEYONDTV && sBeyondTVchedule == "")
            {
                return(null);
            }

            if (_nCatagory == CATAGORY_MCE && sMCESchedule == "")
            {
                return(null);
            }

            if (_nCatagory == CATAGORY_ALL && (_nCatagory == CATAGORY_MCE && sMCESchedule == ""))
            {
                return(null);
            }

            mxXMLReader = new pdamxXMLReader();
            hResultSet  = new Hashtable();
            if (_nCatagory == CATAGORY_BEYONDTV || _nCatagory == CATAGORY_ALL)
            {
                mxXMLReader.Open(sBeyondTVchedule);
                mxXMLReader.AddNamespace("sch", "http://www.pdamediax.com/btv");
                xpathINode = mxXMLReader.GetNodePath("/sch:BeyondTV/sch:UpcomingRecordings/*");

                while (xpathINode.MoveNext())
                {
                    if (xpathINode.Current.Name.Equals("Show"))
                    {
                        hRecord = new Hashtable();
                        xpathINode.Current.MoveToFirstChild();
                        do
                        {
                            hRecord.Add(xpathINode.Current.Name, xpathINode.Current.Value);
                        }while (xpathINode.Current.MoveToNext());
                        hRecord.Add("Catagory", "BeyondTV");
                        hResultSet.Add(Convert.ToString(++nCnt), hRecord);
                        xpathINode.Current.MoveToParent();
                    }
                }
            }
            if (_nCatagory == CATAGORY_MCE || _nCatagory == CATAGORY_ALL)
            {
                mxXMLReader.Open(sMCESchedule);
                mxXMLReader.AddNamespace("sch", "http://www.pdamediax.com/mce");
                xpathINode = mxXMLReader.GetNodePath("/sch:MCETV/sch:UpcomingRecordings/*");

                while (xpathINode.MoveNext())
                {
                    if (xpathINode.Current.Name.Equals("Show"))
                    {
                        hRecord = new Hashtable();
                        xpathINode.Current.MoveToFirstChild();
                        do
                        {
                            hRecord.Add(xpathINode.Current.Name, xpathINode.Current.Value);
                        }while (xpathINode.Current.MoveToNext());
                        hRecord.Add("Catagory", "MCE");
                        hResultSet.Add(Convert.ToString(++nCnt), hRecord);
                        xpathINode.Current.MoveToParent();
                    }
                }
            }
            return(hResultSet);
        }