示例#1
0
 public int GetIndex(TvWish mywish)
 {
     int index = -1;
     for (int i = 0; i < TvWishes.Count; i++)
     {               
         if (mywish.tvwishid == TvWishes[i].tvwishid)
         {
             return i;
         }
     }
     return index;
 }
示例#2
0
        public string SaveToString(ref TvWish mywish)
        {
            //DebugTvWish(mywish);
            string row = "";


            //language translations for mediaportal plugin - must come first
            //Log.Debug(" SaveToString mywish.matchtype=" + mywish.matchtype);

            ReverseTvWishLanguageTranslation(ref mywish);

            //Log.Debug(" SaveToString mywish.matchtype=" + mywish.matchtype);

            row += mywish.active + TvWishItemSeparator.ToString();
            row += mywish.searchfor + TvWishItemSeparator.ToString();
            row += mywish.matchtype + TvWishItemSeparator.ToString();
            row += mywish.group + TvWishItemSeparator.ToString();
            row += mywish.recordtype + TvWishItemSeparator.ToString();
            row += mywish.action + TvWishItemSeparator.ToString();
            row += mywish.exclude + TvWishItemSeparator.ToString();
            row += mywish.viewed + TvWishItemSeparator.ToString();
            row += mywish.prerecord + TvWishItemSeparator.ToString();
            row += mywish.postrecord + TvWishItemSeparator.ToString();
            row += mywish.episodename + TvWishItemSeparator.ToString();
            row += mywish.episodepart + TvWishItemSeparator.ToString();
            row += mywish.episodenumber + TvWishItemSeparator.ToString();
            row += mywish.seriesnumber + TvWishItemSeparator.ToString();
            row += mywish.keepepisodes + TvWishItemSeparator.ToString();
            row += mywish.keepuntil + TvWishItemSeparator.ToString();
            row += mywish.recommendedcard + TvWishItemSeparator.ToString();
            row += mywish.priority + TvWishItemSeparator.ToString();
            row += mywish.aftertime + TvWishItemSeparator.ToString();
            row += mywish.beforetime + TvWishItemSeparator.ToString();
            row += mywish.afterdays + TvWishItemSeparator.ToString();
            row += mywish.beforedays + TvWishItemSeparator.ToString();
            row += mywish.channel + TvWishItemSeparator.ToString();
            row += mywish.skip + TvWishItemSeparator.ToString();
            if (mywish.name != "")
                row += mywish.name + TvWishItemSeparator.ToString();
            else
                row += mywish.searchfor + TvWishItemSeparator.ToString();

            row += mywish.useFolderName + TvWishItemSeparator.ToString();
            row += mywish.withinNextHours + TvWishItemSeparator.ToString();
            row += mywish.scheduled + TvWishItemSeparator.ToString();
            row += mywish.tvwishid + TvWishItemSeparator.ToString();
            row += mywish.recorded + TvWishItemSeparator.ToString();
            row += mywish.deleted + TvWishItemSeparator.ToString();
            row += mywish.emailed + TvWishItemSeparator.ToString();
            row += mywish.conflicts + TvWishItemSeparator.ToString();
            row += mywish.episodecriteria + TvWishItemSeparator.ToString();
            row += mywish.preferredgroup + TvWishItemSeparator.ToString();
            row += mywish.includeRecordings + TvWishItemSeparator.ToString();

            //translate back for later usage!
            TvWishLanguageTranslation(ref mywish);
            return row;
        }
示例#3
0
        public void TvWishLanguageTranslation( ref TvWish mywish)
        {
            //language translations for MediaPortal plugin
                mywish.active = mywish.active.Replace("True", PluginGuiLocalizeStrings.Get(4000));
                mywish.active = mywish.active.Replace("False", PluginGuiLocalizeStrings.Get(4001));
                mywish.matchtype = mywish.matchtype.Replace("Partial Title", PluginGuiLocalizeStrings.Get(2600));
                mywish.matchtype = mywish.matchtype.Replace("Exact Title", PluginGuiLocalizeStrings.Get(2601));
                mywish.matchtype = mywish.matchtype.Replace("Partial Text", PluginGuiLocalizeStrings.Get(2602));
                mywish.matchtype = mywish.matchtype.Replace("Word in Text/Title", PluginGuiLocalizeStrings.Get(2605));//must go first
                mywish.matchtype = mywish.matchtype.Replace("Word in Title", PluginGuiLocalizeStrings.Get(2603));
                mywish.matchtype = mywish.matchtype.Replace("Word in Text", PluginGuiLocalizeStrings.Get(2604));               
                mywish.matchtype = mywish.matchtype.Replace("Expression", PluginGuiLocalizeStrings.Get(2606));
                mywish.group = mywish.group.Replace("All Channels", PluginGuiLocalizeStrings.Get(4104));

                string org = mywish.recordtype;
                mywish.recordtype = mywish.recordtype.Replace("Only Once", PluginGuiLocalizeStrings.Get(2650)); //Order is important due to same name ALL
                if (mywish.recordtype==org)
                    mywish.recordtype = mywish.recordtype.Replace("All Same Channel Day Time", PluginGuiLocalizeStrings.Get(2655));
                if (mywish.recordtype == org)
                    mywish.recordtype = mywish.recordtype.Replace("All Same Channel Time", PluginGuiLocalizeStrings.Get(2654));
                if (mywish.recordtype == org)
                    mywish.recordtype = mywish.recordtype.Replace("All Same Channel Day", PluginGuiLocalizeStrings.Get(2653));
                if (mywish.recordtype == org)
                    mywish.recordtype = mywish.recordtype.Replace("All Same Channel", PluginGuiLocalizeStrings.Get(2652));
                if (mywish.recordtype == org)
                    mywish.recordtype = mywish.recordtype.Replace("All", PluginGuiLocalizeStrings.Get(2651));
                
                mywish.action = mywish.action.Replace("Both", PluginGuiLocalizeStrings.Get(2702)); //must be first
                mywish.action = mywish.action.Replace("Record", PluginGuiLocalizeStrings.Get(2700));
                mywish.action = mywish.action.Replace("Email", PluginGuiLocalizeStrings.Get(2701));
                mywish.action = mywish.action.Replace("View", PluginGuiLocalizeStrings.Get(2703));
                mywish.keepepisodes = mywish.keepepisodes.Replace("All", PluginGuiLocalizeStrings.Get(4105));
                mywish.keepuntil = mywish.keepuntil.Replace("Always", PluginGuiLocalizeStrings.Get(2900));
                mywish.keepuntil = mywish.keepuntil.Replace("Days", PluginGuiLocalizeStrings.Get(2901));
                mywish.keepuntil = mywish.keepuntil.Replace("days", PluginGuiLocalizeStrings.Get(2901));
                mywish.keepuntil = mywish.keepuntil.Replace("Weeks", PluginGuiLocalizeStrings.Get(2902));
                mywish.keepuntil = mywish.keepuntil.Replace("weeks", PluginGuiLocalizeStrings.Get(2902));
                mywish.keepuntil = mywish.keepuntil.Replace("Months", PluginGuiLocalizeStrings.Get(2903));
                mywish.keepuntil = mywish.keepuntil.Replace("months", PluginGuiLocalizeStrings.Get(2903));
                mywish.keepuntil = mywish.keepuntil.Replace("Date", PluginGuiLocalizeStrings.Get(2904)); 
                mywish.keepuntil = mywish.keepuntil.Replace("Watched", PluginGuiLocalizeStrings.Get(2905));
                mywish.keepuntil = mywish.keepuntil.Replace("Space", PluginGuiLocalizeStrings.Get(2906));
                mywish.recommendedcard = mywish.recommendedcard.Replace("Any", PluginGuiLocalizeStrings.Get(4100));
                mywish.aftertime = mywish.aftertime.Replace("Any", PluginGuiLocalizeStrings.Get(4100));
                Log.Debug("mywish.beforetime=" + mywish.beforetime);
                mywish.beforetime = mywish.beforetime.Replace("Any", PluginGuiLocalizeStrings.Get(4100));               
                mywish.afterdays = mywish.afterdays.Replace("Any", PluginGuiLocalizeStrings.Get(4100));
                mywish.afterdays = mywish.afterdays.Replace("Monday", PluginGuiLocalizeStrings.Get(2750));
                mywish.afterdays = mywish.afterdays.Replace("Tuesday", PluginGuiLocalizeStrings.Get(2751));
                mywish.afterdays = mywish.afterdays.Replace("Wednesday", PluginGuiLocalizeStrings.Get(2752));
                mywish.afterdays = mywish.afterdays.Replace("Thursday", PluginGuiLocalizeStrings.Get(2753));
                mywish.afterdays = mywish.afterdays.Replace("Friday", PluginGuiLocalizeStrings.Get(2754));
                mywish.afterdays = mywish.afterdays.Replace("Saturday", PluginGuiLocalizeStrings.Get(2755));
                mywish.afterdays = mywish.afterdays.Replace("Sunday", PluginGuiLocalizeStrings.Get(2756));
                mywish.beforedays = mywish.beforedays.Replace("Any", PluginGuiLocalizeStrings.Get(4100));
                mywish.beforedays = mywish.beforedays.Replace("Monday", PluginGuiLocalizeStrings.Get(2750));
                mywish.beforedays = mywish.beforedays.Replace("Tuesday", PluginGuiLocalizeStrings.Get(2751));
                mywish.beforedays = mywish.beforedays.Replace("Wednesday", PluginGuiLocalizeStrings.Get(2752));
                mywish.beforedays = mywish.beforedays.Replace("Thursday", PluginGuiLocalizeStrings.Get(2753));
                mywish.beforedays = mywish.beforedays.Replace("Friday", PluginGuiLocalizeStrings.Get(2754));
                mywish.beforedays = mywish.beforedays.Replace("Saturday", PluginGuiLocalizeStrings.Get(2755));
                mywish.beforedays = mywish.beforedays.Replace("Sunday", PluginGuiLocalizeStrings.Get(2756));
                mywish.channel = mywish.channel.Replace("Any", PluginGuiLocalizeStrings.Get(4100));
                mywish.skip = mywish.skip.Replace("True", PluginGuiLocalizeStrings.Get(4000));
                mywish.skip = mywish.skip.Replace("False", PluginGuiLocalizeStrings.Get(4001));
                mywish.useFolderName = mywish.useFolderName.Replace("Episode", PluginGuiLocalizeStrings.Get(2850));
                mywish.useFolderName = mywish.useFolderName.Replace("Name", PluginGuiLocalizeStrings.Get(2851));
                mywish.useFolderName = mywish.useFolderName.Replace("None", PluginGuiLocalizeStrings.Get(2852));
                mywish.useFolderName = mywish.useFolderName.Replace("Automatic", PluginGuiLocalizeStrings.Get(2853));
                mywish.withinNextHours = mywish.withinNextHours.Replace("Any", PluginGuiLocalizeStrings.Get(4100));
                mywish.episodecriteria = mywish.episodecriteria.Replace("None", PluginGuiLocalizeStrings.Get(3264));
                mywish.episodecriteria = mywish.episodecriteria.Replace("Descr.", PluginGuiLocalizeStrings.Get(2960));
                mywish.episodecriteria = mywish.episodecriteria.Replace("Name", PluginGuiLocalizeStrings.Get(2961));
                mywish.episodecriteria = mywish.episodecriteria.Replace("Number", PluginGuiLocalizeStrings.Get(2962));
                mywish.preferredgroup = mywish.preferredgroup.Replace("All Channels", PluginGuiLocalizeStrings.Get(4104));
                mywish.includeRecordings = mywish.includeRecordings.Replace("True",PluginGuiLocalizeStrings.Get(4000));
                mywish.includeRecordings = mywish.includeRecordings.Replace("False",PluginGuiLocalizeStrings.Get(4001)); 
        }
示例#4
0
        public void LoadTvWishToDataGridRow(int newrow, TvWish mywish)
        {
            try //add new default row to enable automated upgrades for new formats with more items
            {
                DataGridViewRow mydatagridviewrow = new DataGridViewRow();
                dataGridView1.Rows.Insert(newrow, mydatagridviewrow);
                if (mywish.b_active)
                {
                    dataGridView1[(int)TvWishEntries.active, newrow].Value = true;
                }
                else
                {
                    dataGridView1[(int)TvWishEntries.active, newrow].Value = false;
                }

                if (mywish.b_skip)
                {
                    dataGridView1[(int)TvWishEntries.skip, newrow].Value = true;
                }
                else
                {
                    dataGridView1[(int)TvWishEntries.skip, newrow].Value = false;
                }

                if (mywish.b_includeRecordings)
                {
                    dataGridView1[(int)TvWishEntries.includerecordings, newrow].Value = true;
                }
                else
                {
                    dataGridView1[(int)TvWishEntries.includerecordings, newrow].Value = false;
                }
                dataGridView1[(int)TvWishEntries.searchfor, newrow].Value = mywish.searchfor;
                dataGridView1[(int)TvWishEntries.matchtype, newrow].Value = mywish.matchtype;
                dataGridView1[(int)TvWishEntries.group, newrow].Value = mywish.group;
                dataGridView1[(int)TvWishEntries.recordtype, newrow].Value = mywish.recordtype;
                dataGridView1[(int)TvWishEntries.action, newrow].Value = mywish.action;
                dataGridView1[(int)TvWishEntries.exclude, newrow].Value = mywish.exclude;
                dataGridView1[(int)TvWishEntries.prerecord, newrow].Value = mywish.prerecord;
                dataGridView1[(int)TvWishEntries.postrecord, newrow].Value = mywish.postrecord;
                dataGridView1[(int)TvWishEntries.episodename, newrow].Value = mywish.episodename;
                dataGridView1[(int)TvWishEntries.episodepart, newrow].Value = mywish.episodepart;
                dataGridView1[(int)TvWishEntries.episodenumber, newrow].Value = mywish.episodenumber;
                dataGridView1[(int)TvWishEntries.seriesnumber, newrow].Value = mywish.seriesnumber;
                dataGridView1[(int)TvWishEntries.keepepisodes, newrow].Value = mywish.keepepisodes;
                dataGridView1[(int)TvWishEntries.keepuntil, newrow].Value = mywish.keepuntil;
                dataGridView1[(int)TvWishEntries.recommendedcard, newrow].Value = mywish.recommendedcard;
                dataGridView1[(int)TvWishEntries.priority, newrow].Value = mywish.priority;
                dataGridView1[(int)TvWishEntries.aftertime, newrow].Value = mywish.aftertime;
                dataGridView1[(int)TvWishEntries.beforetime, newrow].Value = mywish.beforetime;
                dataGridView1[(int)TvWishEntries.afterdays, newrow].Value = mywish.afterdays;
                dataGridView1[(int)TvWishEntries.beforedays, newrow].Value = mywish.beforedays;


                dataGridView1[(int)TvWishEntries.channel, newrow].Value = mywish.channel;
                dataGridView1[(int)TvWishEntries.name, newrow].Value = mywish.name;
                dataGridView1[(int)TvWishEntries.useFolderName, newrow].Value = mywish.useFolderName;
                dataGridView1[(int)TvWishEntries.withinNextHours, newrow].Value = mywish.withinNextHours;
                dataGridView1[(int)TvWishEntries.episodecriteria, newrow].Value = mywish.episodecriteria;
                dataGridView1[(int)TvWishEntries.preferredgroup, newrow].Value = mywish.preferredgroup;
                if ((string)dataGridView1[(int)TvWishEntries.name, newrow].Value == "") //avoid empty names
                {
                    dataGridView1[(int)TvWishEntries.name, newrow].Value = dataGridView1[(int)TvWishEntries.searchfor, newrow].Value;
                }

                //add tvwishid
                dataGridView1[(int)TvWishEntries.tvwishid, newrow].Value = mywish.tvwishid;



            }
            catch (Exception exc)
            {
                LogDebug("Adding row failed with message \n" + exc.Message, (int)LogSetting.ERROR);
            }
            LogDebug("Tvwish finished", (int)LogSetting.DEBUG);
                    
        }
示例#5
0
        public string SaveToStringNoTranslation(ref TvWish mywish)
        {
            //DebugTvWish(mywish);
            string row = "";

            row += mywish.active + TvWishItemSeparator.ToString();
            row += mywish.searchfor + TvWishItemSeparator.ToString();
            row += mywish.matchtype + TvWishItemSeparator.ToString();
            row += mywish.group + TvWishItemSeparator.ToString();
            row += mywish.recordtype + TvWishItemSeparator.ToString();
            row += mywish.action + TvWishItemSeparator.ToString();
            row += mywish.exclude + TvWishItemSeparator.ToString();
            row += mywish.viewed + TvWishItemSeparator.ToString();
            row += mywish.prerecord + TvWishItemSeparator.ToString();
            row += mywish.postrecord + TvWishItemSeparator.ToString();
            row += mywish.episodename + TvWishItemSeparator.ToString();
            row += mywish.episodepart + TvWishItemSeparator.ToString();
            row += mywish.episodenumber + TvWishItemSeparator.ToString();
            row += mywish.seriesnumber + TvWishItemSeparator.ToString();
            row += mywish.keepepisodes + TvWishItemSeparator.ToString();
            row += mywish.keepuntil + TvWishItemSeparator.ToString();
            row += mywish.recommendedcard + TvWishItemSeparator.ToString();
            row += mywish.priority + TvWishItemSeparator.ToString();
            row += mywish.aftertime + TvWishItemSeparator.ToString();
            row += mywish.beforetime + TvWishItemSeparator.ToString();
            row += mywish.afterdays + TvWishItemSeparator.ToString();
            row += mywish.beforedays + TvWishItemSeparator.ToString();
            row += mywish.channel + TvWishItemSeparator.ToString();
            row += mywish.skip + TvWishItemSeparator.ToString();
            if (mywish.name != "")
                row += mywish.name + TvWishItemSeparator.ToString();
            else
                row += mywish.searchfor + TvWishItemSeparator.ToString();

            row += mywish.useFolderName + TvWishItemSeparator.ToString();
            row += mywish.withinNextHours + TvWishItemSeparator.ToString();
            row += mywish.scheduled + TvWishItemSeparator.ToString();
            row += mywish.tvwishid + TvWishItemSeparator.ToString();
            row += mywish.recorded + TvWishItemSeparator.ToString();
            row += mywish.deleted + TvWishItemSeparator.ToString();
            row += mywish.emailed + TvWishItemSeparator.ToString();
            row += mywish.conflicts + TvWishItemSeparator.ToString();
            row += mywish.episodecriteria + TvWishItemSeparator.ToString();
            row += mywish.preferredgroup + TvWishItemSeparator.ToString();
            row += mywish.includeRecordings + TvWishItemSeparator.ToString();

            return row;
        }
示例#6
0
 public bool ReplaceAtTvWishId(string tvwishid, TvWish newWish)
 {
     for (int i = 0; i < TvWishes.Count; i++)
     {
         if (TvWishes[i].tvwishid == tvwishid)
         {
             TvWishes[i] = newWish;
             return true;
         }
     }
     return false;
 }
示例#7
0
        private void LoadDefaultFormatsFromString(string defaultformatstring)
        {
            string[] defaultformats = defaultformatstring.Split(TvWishItemSeparator);
            if (defaultformats[(int)TvWishEntries.prerecord] == "-1")
            {
                defaultformats[(int)TvWishEntries.prerecord] = prerecord;    //replace -1 from hardcoded vector
            }
            if (defaultformats[(int)TvWishEntries.postrecord] == "-1")
            {
                defaultformats[(int)TvWishEntries.postrecord] = postrecord;  //replace -1 from hardcoded vector
            }
            if (defaultformats[(int)TvWishEntries.tvwishid] == "-1")
            {
                defaultformats[(int)TvWishEntries.tvwishid] = "1";           //replace -1 from hardcoded vector
            }
            defaultformatstring = SaveToStringNoLngTranslation(defaultformats);
            Log.Debug("LoadSettings(): defaultformatstring=" + defaultformatstring);
            string checkedrow = myTvWishes.CheckRowEntries(defaultformatstring, TvWishItemSeparator); //complete user default in English and checked
            Log.Debug("LoadSettings(): checked defaultformatstring=" + checkedrow);
            TvWish userCountryhwish = new TvWish();
            userCountryhwish = myTvWishes.CreateTvWish(true, checkedrow.Split(TvWishItemSeparator));  //user default tvwish in Country language complete and checked
            Log.Debug("userEnglishwish including translation");
            myTvWishes.DebugTvWish(userCountryhwish);
            //myTvWishes.TvWishLanguageTranslation(ref userEnglishwish); //user default Tvwish in in country language
            string userCountryDefaultsCompleteString = myTvWishes.SaveToStringNoTranslation(ref userCountryhwish);  //complete user default country string
            Log.Debug("LoadSettings(): userCountryDefaultsCompleteString=" + userCountryDefaultsCompleteString);
            Array_Defaultformats = Defaults2TvWishArray(userCountryDefaultsCompleteString.Split(TvWishItemSeparator));  //partial user default country array
            Log.Debug("Array_Defaultformats.Length=" + Array_Defaultformats.Length.ToString());

            //preselect first element
            textBoxDefaultFormats.Text = Array_Defaultformats[0];
            Defaultformat_select = 0;//must be before comboBoxDefaultFormats.Text = ;
            comboBoxDefaultFormats.Text = comboBoxDefaultFormats.Items[0].ToString();

            if (Array_Defaultformats.Length != (int)TvWishEntries.end - 7)
            {
                MessageBox.Show("Invalid Default Format Array", "Error");
                Log.Error("Invalid Default Format Array");
                Log.Error("Array_Defaultformats.Length=" + Array_Defaultformats.Length.ToString());
                Log.Error("(int)TvWishEntries.skip=" + ((int)TvWishEntries.skip).ToString());
            }
        }
示例#8
0
 public void DebugTvWish(TvWish mywish)
 {
     Log.Debug("***************TVWISH********************");
     Log.Debug("mywish.active=" + mywish.active);
     Log.Debug("   mywish.b_active=" + mywish.b_active.ToString());
     Log.Debug("mywish.searchfor=" + mywish.searchfor);
     Log.Debug("mywish.matchtype=" + mywish.matchtype);
     Log.Debug("   mywish.b_partialname=" + mywish.b_partialname.ToString());
     Log.Debug("   mywish.b_wordmatch=" + mywish.b_wordmatch.ToString());
     Log.Debug("   mywish.s_SearchIn=" + mywish.s_SearchIn);
     Log.Debug("mywish.group=" + mywish.group);
     Log.Debug("mywish.recordtype=" + mywish.recordtype);
     Log.Debug("mywish.action=" + mywish.action);
     Log.Debug("   mywish.t_action=" + mywish.t_action.ToString());
     Log.Debug("mywish.exclude=" + mywish.exclude);
     Log.Debug("mywish.viewed=" + mywish.viewed);
     Log.Debug("   mywish.i_hits=" + mywish.i_viewed.ToString());
     Log.Debug("mywish.prerecord=" + mywish.prerecord);
     Log.Debug("   mywish.i_prerecord=" + mywish.i_prerecord.ToString());
     Log.Debug("mywish.postrecord=" + mywish.postrecord);
     Log.Debug("   mywish.i_postrecord=" + mywish.i_postrecord.ToString());
     Log.Debug("mywish.episodename=" + mywish.episodename);
     Log.Debug("mywish.episodepart=" + mywish.episodepart);
     Log.Debug("mywish.episodenumber=" + mywish.episodenumber);
     Log.Debug("   mywish.i_episodenumber=" + mywish.i_episodenumber.ToString());
     Log.Debug("mywish.seriesnumber=" + mywish.seriesnumber);
     Log.Debug("   mywish.i_seriesnumber=" + mywish.i_seriesnumber.ToString());
     Log.Debug("mywish.keepepisodes=" + mywish.keepepisodes);
     Log.Debug("   mywish.i_keepepisodes=" + mywish.i_keepepisodes.ToString());
     Log.Debug("mywish.keepuntil=" + mywish.keepuntil);
     Log.Debug("   mywish.i_keepuntil=" + mywish.i_keepuntil.ToString());
     Log.Debug("   mywish.i_keepmethod=" + mywish.i_keepmethod.ToString());
     Log.Debug("   mywish.D_keepuntil=" + mywish.D_keepuntil.ToString());
     Log.Debug("mywish.recommendedcard=" + mywish.recommendedcard);
     Log.Debug("   mywish.i_recommendedcard=" + mywish.i_recommendedcard.ToString());
     Log.Debug("mywish.priority=" + mywish.priority);
     Log.Debug("   mywish.i_priority=" + mywish.i_priority.ToString());
     Log.Debug("mywish.aftertime=" + mywish.aftertime);
     Log.Debug(   "mywish.i_aftertime=" + mywish.i_aftertime.ToString());
     Log.Debug("mywish.beforetime=" + mywish.beforetime);
     Log.Debug("   mywish.i_beforetime=" + mywish.i_beforetime.ToString());
     Log.Debug("mywish.afterdays=" + mywish.afterdays);
     Log.Debug("   mywish.i_afterdays=" + mywish.i_afterdays.ToString());
     Log.Debug("mywish.beforedays=" + mywish.beforedays);
     Log.Debug("   mywish.i_beforedays=" + mywish.i_beforedays.ToString());
     Log.Debug("mywish.channel=" + mywish.channel);
     Log.Debug("mywish.skip=" + mywish.skip);
     Log.Debug("   mywish.b_skip=" + mywish.b_skip.ToString());
     Log.Debug("mywish.name=" + mywish.name);
     Log.Debug("mywish.useFolderName=" + mywish.useFolderName);
     Log.Debug("   mywish.b_useFoldername=" + mywish.b_useFoldername.ToString());
     Log.Debug("   mywish.b_series=" + mywish.b_series.ToString());
     Log.Debug("mywish.withinNextHours=" + mywish.withinNextHours);           
     Log.Debug("mywish.scheduled=" + mywish.scheduled);
     Log.Debug("   mywish.i_scheduled=" + mywish.i_scheduled.ToString());
     Log.Debug("mywish.tvwishid=" + mywish.tvwishid);
     Log.Debug("mywish.recorded=" + mywish.recorded);
     Log.Debug("   mywish.i_recorded=" + mywish.i_recorded.ToString());
     Log.Debug("mywish.deleted=" + mywish.deleted);
     Log.Debug("   mywish.i_deleted=" + mywish.i_deleted.ToString());
     Log.Debug("mywish.emailed=" + mywish.emailed);
     Log.Debug("   mywish.i_emailed=" + mywish.i_emailed.ToString());
     Log.Debug("mywish.conflicts=" + mywish.conflicts);
     Log.Debug("   mywish.i_conflicts=" + mywish.i_conflicts.ToString());
     Log.Debug("mywish.episodecriteria=" + mywish.episodecriteria);
     //Log.Debug("   mywish.b_episodecriteria_a=" + mywish.b_episodecriteria_a.ToString());
     Log.Debug("   mywish.b_episodecriteria_d=" + mywish.b_episodecriteria_d.ToString());
     //Log.Debug("   mywish.b_episodecriteria_p=" + mywish.b_episodecriteria_p.ToString());
     Log.Debug("   mywish.b_episodecriteria_n=" + mywish.b_episodecriteria_n.ToString());
     Log.Debug("   mywish.b_episodecriteria_c=" + mywish.b_episodecriteria_c.ToString());
     Log.Debug("mywish.preferredgroup=" + mywish.preferredgroup);
     Log.Debug("mywish.includeRecordings=" + mywish.includeRecordings);
     Log.Debug("   mywish.b_includeRecordings=" + mywish.b_includeRecordings.ToString());
     Log.Debug("***************END TVWISH********************");
     Log.Debug("");
 }//modify for listview table changes
示例#9
0
        }//modify for listview table changes


        
        public TvWish DefaultData()
        {
            //Log.Debug("DefaultData");
            //add a new Tvwish filled with defaultdata

            string[] columndata = (string[])_DefaultValues.Clone();
            //Log.Debug("columndata.Length=" + columndata.Length.ToString());
            TvWish mywish = new TvWish();

            try
            {

                mywish = CreateTvWish(true, columndata);
                
                if (mywish.prerecord == "-1")
                    mywish.prerecord = PreRecord;

                if (mywish.postrecord == "-1")
                    mywish.postrecord = PostRecord;

                //do not use columndata[28] as the id must be unique for deafult data, will be overwritten later
                MaxTvWishId++;
                mywish.tvwishid=MaxTvWishId.ToString();  //do not use columndata[28] as the id must be unique for deafult data
                //modify for listview table changes


                //reset to 0 to avoid overflow for very large numbers  MaxTvWishId must be a unique number id for each wish 
                if (MaxTvWishId > 10000000)
                {
                    int ctr = 0;
                    foreach (TvWish tempwish in ListAll())
                    {
                        ctr++;
                        tempwish.tvwishid = ctr.ToString();
                    }
                    MaxTvWishId = ctr + 1;
                    Log.Error("Too many tv wishes resetting all tvwish IDs and recounting");
                }//end reset


                if (_ViewOnlyMode == true)
                {
                    mywish.skip = mywish.skip.Replace("False", PluginGuiLocalizeStrings.Get(4001));
                }

                //DebugTvWish(mywish);
                
            }
            catch (Exception exc)
            {
                Log.Error("[TVWishListMP]:TvserverdatabaseLoadSettings: ****** Exception " + exc.Message);
                Log.Error("[TVWishListMP]:TvserverdatabaseLoadSettings:row=" + DefaultFormatString);
            }

            return mywish;
        }
示例#10
0
      //-------------------------------------------------------------------------------------------------------------        
      // Search epg data and find all matching programs 
      //-------------------------------------------------------------------------------------------------------------  
      // matching programs are searched based on available information for program name, start time, endtime, displayname or groupname
      // if dispalyname is defined, groupnames will be ignored
      // partial name = true will handle partial name matches from program name
      // the routine will return an IList<Program> matchingprograms which contains all EPG programs of Type Program
      // the routine will not do any checking for conflicts of the list
      //-------------------------------------------------------------------------------------------------------------                              
      public bool SqlQueryRecordings(TvWish mywish, int counter)
      {

          LogDebug("TvWishList: Autocomplete search for matching recordings", (int)LogSetting.DEBUG);
          
          if (mywish.b_active == false)
          {
              Log.Debug("Tvwish is inactive - returning");
              return true;
          }


          string SearchIn = mywish.s_SearchIn.ToLower();
          String Expression = String.Empty;
          IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
          IList<Recording> myRecordingList = null;

          /*  search names are case invariant (title SOKO equal to title soko)
                   * 
                   * LIKE
                   * NOT LIKE
                   % 	A substitute for zero or more characters
                   _ 	A substitute for exactly one character
                   [charlist] 	Any single character in charlist
                   [^charlist] or [!charlist] Any single character not in charlist
                   * 
                   * 
                   * 
                   * SELECT column_name(s)
                     FROM table_name
                     WHERE column_name operator value
                   
                   Operators Allowed in the WHERE Clause

                    With the WHERE clause, the following operators can be used:
                    Operator 	Description
                    = 	Equal
                    <> 	Not equal
                    > 	Greater than
                    < 	Less than
                    >= 	Greater than or equal
                    <= 	Less than or equal
                    BETWEEN 	Between an inclusive range
                    LIKE 	Search for a pattern
                    IN 	If you know the exact value you want to return for at least one of the columns
                   * 
                   * 
                   * Combine with brackets ()
                   * and with AND or OR

                    Note: In some versions of SQL the <> operator may be written as !=
           * 
           * 
           *       Recording columns(use lower case in sql quesry):
        public string Description { get; set; }
        public DateTime EndTime { get; set; }
        public string EpisodeName { get; set; }
        public string EpisodeNum { get; set; }
        public string EpisodeNumber { get; }
        public string EpisodePart { get; set; }
        public string FileName { get; set; }
        public string Genre { get; set; }
        public int IdChannel { get; set; }
        public int IdRecording { get; }
        public int Idschedule { get; set; }
        public int IdServer { get; set; }
        public bool IsChanged { get; }
        public bool IsManual { get; }
        public bool IsRecording { get; set; }
        public int KeepUntil { get; set; }
        public DateTime KeepUntilDate { get; set; }
        public string SeriesNum { get; set; }
        public bool ShouldBeDeleted { get; }
        public DateTime StartTime { get; set; }
        public int StopTime { get; set; }
        public int TimesWatched { get; set; }
        public string Title { get; set; }
         
          
          
        
        */
          string EscapeName = EscapeSQLString(mywish.searchfor);
          if (SearchIn == "title") //no translation needed due to separation of original string
          {
              //Expression += String.Format("(EndTime >= '{0}') AND ", DateTime.Now.ToString(GetDateTimeString(), mmddFormat));  //only programs after now
              if (mywish.b_partialname == true)  //partial title
              {
                  Expression += String.Format("( title like '%{0}%' ) ", EscapeName);
              }
              else                      //exact title
              {
                  Expression += String.Format("( title = '{0}' ) ", EscapeName);
              }
          }//end title
          else if (SearchIn == "text")  //search in description  //no translation needed due to separation of original string
          {
              //Expression += String.Format("(EndTime >= '{0}') AND ", DateTime.Now.ToString(GetDateTimeString(), mmddFormat));  //only programs after now
              Expression += String.Format("( description like '%{0}%' ) ", EscapeName);
          }//end description
          else if (SearchIn == "both") //no translation needed due to separation of original string
          {
              //Expression += String.Format("(EndTime >= '{0}') AND (", DateTime.Now.ToString(GetDateTimeString(), mmddFormat));  //only programs after now

              if (mywish.b_partialname == true)  //partial title
              {
                  Expression += String.Format("( title like '%{0}%' ) OR ", EscapeName);
              }
              else                      //exact title
              {
                  Expression += String.Format("( title = '{0}' ) OR ", EscapeName);
              }

              Expression += String.Format("( description like '%{0}%' )", EscapeName);

          }//end both

          if (SearchIn == "expression")  //no translation needed due to separation of original string
          {
              Expression = mywish.searchfor;

              //split in schedule and recording expression
              Expression = Expression.Replace("<BR>", "\n");
              Expression = Expression.Replace("<br>", "\n");
              Expression = Expression.Replace(@"\n", "\n");
              Expression = Expression.Replace(@"\'", "'");  //needed for expressions
              string[] expArray = Expression.Split('\n');
              if (expArray.Length != 2)
              {
                  Log.Debug("No expression defined for searching recordings on tvwish "+mywish.name);
                  return true;
              }
              else
              {                
                  Expression = expArray[1];
                  
              }
             
              Log.Debug("Expression=" + Expression);
          }

          //SQL Query
          LogDebug("SQL query for: " + Expression, (int)LogSetting.DEBUG);
          try
          {
#if (MPTV2)
              string command = "select * from recordings where " + Expression;
              Log.Debug("command=" + command);
              myRecordingList = Recording.GeneralSqlQuery(command);

#else
              StringBuilder SqlSelectCommand = new StringBuilder();
              SqlSelectCommand.Append("select * from Recording ");
              SqlSelectCommand.AppendFormat(string.Format("where {0}", Expression));  
              SqlStatement stmt = new SqlBuilder(StatementType.Select, typeof(Recording)).GetStatement(true);
              SqlStatement ManualJoinSQL = new SqlStatement(StatementType.Select, stmt.Command, SqlSelectCommand.ToString(), typeof(Recording));
              myRecordingList = ObjectFactory.GetCollection<Recording>(ManualJoinSQL.Execute());
#endif
              Log.Debug("SQL Result:myRecordingList.Count" + myRecordingList.Count.ToString());
          }
          catch (Exception exc)
          {
              LogDebug("Error in SQL query for searching " + Expression, (int)LogSetting.ERROR);
              LogDebug("Exception message was " + exc.Message, (int)LogSetting.ERROR);

              string languagetext = lng.TranslateString("Error in SQL query - check the expression {0}", 25, Expression);
              labelmessage(languagetext, PipeCommands.StartEpg); //do not mark as an error as other commands are still coming - just delay message
              Thread.Sleep(ErrorWaitTime);
              return false;
          }
          // End of SQL Query
          Log.Debug(myRecordingList.Count.ToString() + " recordings found after SQL query");

          foreach (Recording myrecording in myRecordingList)
          {
              
              LogDebug("****Next program in autocompletion:", (int)LogSetting.DEBUG);
              //outputrecordingresponse(myrecording, (int)LogSetting.DEBUG); //Debug only

              /*   // process groupname  BUG: not needed in recordings
              if (mywish.group != lng.TranslateString("All Channels", 4104))
              {
                  if ((IsChannelInGroup(myrecording.IdChannel, mywish.group) == false) && (IsRadioChannelInGroup(myrecording.IdChannel, mywish.group) == false))
                  {
                      LogDebug("!!!!!!!Groupname " + mywish.group + " not matching for title " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                      continue;

                  }
              }*/

              //process exclude
              if (mywish.exclude != string.Empty)
              {
                  string Exclude = mywish.exclude.ToUpper();
                  String Exclude1 = "";
                  String Exclude2 = "";
                  Exclude = Exclude.Replace("||", "\n");//bug fix: was && before
                  String[] Tokens = Exclude.Split('\n');
                  if (Tokens.Length >= 2)
                  {
                      Exclude2 = Tokens[1];
                  }

                  if (Tokens.Length >= 1)
                  {
                      Exclude1 = Tokens[0];
                  }
                  LogDebug("TvWishList: Exclude1=" + Exclude1, (int)LogSetting.DEBUG);
                  LogDebug("TvWishList: Exclude2=" + Exclude2, (int)LogSetting.DEBUG);

                  Boolean foundflag = false;

                  if ((Exclude1.StartsWith("*") == true) && (Exclude1.StartsWith("**") == false)) //exclude in description
                  {
                      string Exclude_mod = Exclude1.Substring(1, Exclude.Length - 1);
                      //LogDebug("Exclude_mod= " + Exclude_mod, (int)LogSetting.DEBUG);
                      if ((myrecording.Description.ToUpper().Contains(Exclude_mod) == false) || (Exclude_mod == ""))
                      {
                          if ((myrecording.Description.ToUpper().Contains(Exclude2) == false) || (Exclude2 == ""))
                          {
                              foundflag = true;
                              LogDebug("No Exclude of program for " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                          }
                      }
                  }
                  else if (Exclude1.StartsWith("**") == true) //exclude in title or description
                  {
                      string Exclude_mod = Exclude1.Substring(2, Exclude.Length - 2);
                      //LogDebug("Exclude_mod= " + Exclude_mod, (int)LogSetting.DEBUG);
                      if (((myrecording.Title.ToUpper().Contains(Exclude_mod) == false) && (myrecording.Description.ToUpper().Contains(Exclude_mod) == false)) || (Exclude_mod == ""))
                      {
                          if (((myrecording.Title.ToUpper().Contains(Exclude2) == false) && (myrecording.Description.ToUpper().Contains(Exclude2) == false)) || (Exclude2 == ""))
                          {
                              foundflag = true;
                              LogDebug("No Exclude of program for title " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                          }
                      }
                  }
                  else if ((myrecording.Title.ToUpper().Contains(Exclude1) == false) || (Exclude1 == "")) //exclude only in title
                  {
                      if ((myrecording.Title.ToUpper().Contains(Exclude2) == false) || (Exclude2 == ""))
                      {
                          foundflag = true;
                          LogDebug("No Exclude of program for title " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                      }
                  }

                  if (foundflag == false)
                  {
                      LogDebug("!!!!!!!exclude condition " + Exclude + " found for for title " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                      continue;
                  }

              }//end exclude

              // process valid word check
              if (mywish.b_wordmatch == true)
              {
                  if (SearchIn == "title")  //no translation needed due to separation of original string
                  {
                      if (mywish.b_partialname == true)  //partial title
                      {
                          if (validwordcheck(myrecording.Title, mywish.searchfor) == false)
                          {
                              LogDebug("!!!!!!!wordcheck on title failed for title " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                              continue;
                          }
                      }

                  }
                  else if (SearchIn == "text")  //search in description  //no translation needed due to separation of original string
                  {
                      if (validwordcheck(myrecording.Description, mywish.searchfor) == false)
                      {
                          LogDebug("!!!!!!!wordcheck on description failed for title " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                          continue;
                      }
                  }
                  else if (SearchIn == "both")  //search in either title or description  //no translation needed due to separation of original string
                  {
                      if ((validwordcheck(myrecording.Title, mywish.searchfor) == false) && (validwordcheck(myrecording.Description, mywish.searchfor) == false))
                      {
                          LogDebug("!!!!!!!wordcheck on title and description failed for title " + myrecording.Title + " at " + myrecording.StartTime.ToString(), (int)LogSetting.DEBUG);
                          continue;
                      }
                  }

              } //end processing valid wordcheck


              
              //process episode name, part, number and series number
              
#if(TV100 || TV101)
                  if (1==1) //always true for 1.0.1
#elif(TV11 || TV12)
              if (((myrecording.EpisodeName.ToLower() == mywish.episodename.ToLower() == true) || (mywish.episodename == "")) && ((myrecording.EpisodePart.ToLower() == mywish.episodepart.ToLower() == true) || (mywish.episodepart == "")) && ((myrecording.SeriesNum.ToLower() == mywish.seriesnumber.ToLower()) || (mywish.seriesnumber == "")) && ((myrecording.EpisodeNum.ToLower() == mywish.episodenumber.ToLower()) || (mywish.episodenumber == "")))

                  //bug to fix with > number
#endif
              {
                  if ((myrecording.StartTime < myrecording.EndTime)&&(File.Exists(myrecording.FileName)))
                  {//during recording start time will be equal to end time and text all in capitol letters - in that case ignore and wait till recording is finished - schedule does exist in parallel during recording

                      //create new recording message
                      Log.Debug("myrecording.Title=" + myrecording.Title);
                      Log.Debug("myrecording.Description=" + myrecording.Description);
                      FileInfo myfileinfo = new FileInfo(myrecording.FileName);
                      
                      double filesize = Convert.ToDouble(myfileinfo.Length)/(1024*1024*1024);

                      string message =  lng.TranslateString("{0} with {1} GB",59,myrecording.FileName,filesize.ToString("F2"));
                      Log.Debug("recording message with filesize="+message);

                      //add new recorded message
                      mymessage.addmessage(myrecording, message, MessageType.Recorded, mywish.searchfor, (int)XmlMessages.MessageEvents.RECORDING_FOUND, mywish.tvwishid, myrecording.FileName);
                       


                      //remove deleted messages with same title/description/episode name/number
                      try
                      {
                          for (int i = mymessage.ListAllTvMessages().Count-1; i >=0 ; i--)
                          {
                              xmlmessage onemessage = mymessage.GetTvMessageAtIndex(i);
                              if ((onemessage.title == myrecording.Title) && (onemessage.description == myrecording.Description) && (onemessage.type == MessageType.Deleted.ToString()))
                              {
#if(TV100 || TV101)
                  if (1==1) //always true for 1.0.1
#elif(TV11 || TV12)
                                  if (((myrecording.EpisodeName.ToLower() == onemessage.EpisodeName.ToLower() == true) || (onemessage.EpisodeName == "")) && ((myrecording.EpisodePart.ToLower() == onemessage.EpisodePart.ToLower() == true) || (onemessage.EpisodePart == "")) && ((myrecording.SeriesNum.ToLower() == onemessage.SeriesNum.ToLower()) || (onemessage.SeriesNum == "")) && ((myrecording.EpisodeNum.ToLower() == onemessage.EpisodeNum.ToLower()) || (onemessage.EpisodeNum == "")))
#endif
                                  {
                                      //delete message
                                      Log.Debug("Deleting message " + onemessage.title+" at "+onemessage.start+" due to new recording");
                                      mymessage.DeleteTvMessageAt(i);             
                                  }
                              }
                          }
                      }
                      catch (Exception exc)
                      {
                          LogDebug("Error: searching deleted messages failed with exception " + exc.Message, (int)LogSetting.ERROR);
                          string languagetext2 = lng.TranslateString("Fatal error - check the log file", 24);
                          labelmessage(languagetext2, PipeCommands.StartEpg); //do not stop - do not flag as error
                          Thread.Sleep(ErrorWaitTime);
                          return false;
                      }

                              
                  }
                  
              }//end episode filter
              string languagetext = lng.TranslateString("Processing Recording {0} at {1}", 22, myrecording.Title, myrecording.StartTime.ToString());
              labelmessage(languagetext, PipeCommands.StartEpg);
          }//end all recordings
          

          LogDebug("TvWishList: Autocomplete finished", (int)LogSetting.DEBUG);
          return true;
      }
示例#11
0
      public bool addsingleschedule(Program oneprogram, ref TvWish mywish, int counter)
      {

          /*
          string programName = oneprogram.Title;
          string description = oneprogram.Description;
          Int32 idChannel = oneprogram.IdChannel;
          DateTime startTime = oneprogram.StartTime;
          DateTime endTime = oneprogram.EndTime;
          */

          
          TvBusinessLayer layer = new TvBusinessLayer();

          
#if(TV100)
          IList allschedules = Schedule.ListAll();
#elif(TV101 || TV11 || TV12)
          IList<Schedule> allschedules = Schedule.ListAll();
#endif
          int allschedules_before = allschedules.Count;
         
          // add new schedule
          Schedule schedule = null;
           
          try
          {
              schedule = layer.AddSchedule(oneprogram.IdChannel, oneprogram.Title, oneprogram.StartTime, oneprogram.EndTime, 0);
              schedule.PreRecordInterval = mywish.i_prerecord;
              schedule.PostRecordInterval = mywish.i_postrecord;
              schedule.ScheduleType = 0;
              schedule.Series = mywish.b_series;

              if (mywish.useFolderName == lng.TranslateString("Automatic", 2853)) //automatic seriesname with MP management
              {

#if (TV12 || TV11)
                  if ((oneprogram.EpisodePart != string.Empty) || (oneprogram.EpisodeName != string.Empty) || (oneprogram.SeriesNum != string.Empty) || (oneprogram.EpisodeNum != string.Empty))
#else
                  if ((oneprogram.SeriesNum != string.Empty) || (oneprogram.EpisodeNum != string.Empty))
#endif


                  {
                      schedule.Series = true;
                      LogDebug("schedule.Series changed to true for automatic", (int)LogSetting.DEBUG);
                  }
                  else
                  {
                      schedule.Series = false;
                      LogDebug("schedule.Series changed to false for automatic", (int)LogSetting.DEBUG);
                  }
                  
              }
            
              LogDebug("schedule.Series=" + schedule.Series.ToString(), (int)LogSetting.DEBUG);

              schedule.KeepDate = mywish.D_keepuntil;
              schedule.KeepMethod = mywish.i_keepmethod;
              schedule.MaxAirings = mywish.i_keepepisodes;             
              schedule.RecommendedCard = mywish.i_recommendedcard;
              schedule.Priority = mywish.i_priority;
              schedule.Persist();

              
              
          }
          catch
          {
              LogDebug("", (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
              message = lng.TranslateString("Failed to add program {0}",60,oneprogram.Title);
              LogDebug(message, (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
              mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FAILED_ADDING, mywish.tvwishid, string.Empty);
              return false;

          }
          LogDebug("schedule created", (int)LogSetting.DEBUG);
          if (schedule == null)
          {
              LogDebug("", (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
              message = lng.TranslateString("Failed to create schedule for program {0}", 61, oneprogram.Title);
              LogDebug(message, (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
              mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FAILED_CREATE, mywish.tvwishid, string.Empty);
              return false;
          }

          #region schedule exists
          int allschedules_after = Schedule.ListAll().Count;
          LogDebug("allschedule", (int)LogSetting.DEBUG);
          if (allschedules_after == allschedules_before)  //fatal BUG fixed:     &&(VIEW_ONLY_MODE==false)  existing schedule can be deleted afterewards
          {
              LogDebug("", (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
              message = lng.TranslateString("Program: {0} already scheduled", 62, oneprogram.Title);
              LogDebug(message, (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);

              //  old: mymessage.addmessage(schedule, message, mywish.t_action, mywish.name, (int)XmlMessages.MessageEvents.SCHEDULE_FOUND, mywish.tvwishid);  //only added if no other message did exist before do not change
              mymessage.addmessage(schedule, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FAILED_ADDING, mywish.tvwishid, string.Empty);
              
              //outputscheduletoresponse(schedule, (int)LogSetting.INFO);
              return false;
          }
          #endregion schedule exists

          #region filter days
          LogDebug("start filterfunctions", (int)LogSetting.DEBUG);
          // filter function only use schedules starting after after_days and ending before before_days
          if ((mywish.i_afterdays > -1) && (mywish.i_beforedays > -1))
          {


              LogDebug("after_days= " + mywish.i_afterdays.ToString(), (int)LogSetting.DEBUG);
              LogDebug("before_days= " + mywish.i_beforedays.ToString(), (int)LogSetting.DEBUG);

              Int32 start_day = (int)oneprogram.StartTime.DayOfWeek;           
              //changed to usage of start time only !!!!!!!!!!!!!!!
              //Int32 end_day = (int)endTime.DayOfWeek;
              Int32 end_day = (int)oneprogram.StartTime.DayOfWeek;
              LogDebug("start_day= " + start_day, (int)LogSetting.DEBUG);
              LogDebug("end_day= " + end_day, (int)LogSetting.DEBUG);

              if (mywish.i_beforedays >= mywish.i_afterdays)
               /*
                      ------I-------------------------------------------------I------
               *          after                                            before
               *                          start              end
               *                          
               *    start >= after  &&  end <= before  &&  end >= start
               *       
               */
              
              { //use regular timeinterval from after_days till before_days
                  if ((start_day < mywish.i_afterdays) || (end_day > mywish.i_beforedays) || (end_day < start_day))

                  {
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message =lng.TranslateString("Skipping program {0} because it is not between {1} and {2}",63, oneprogram.Title, ((DayOfWeek)mywish.i_afterdays).ToString() , ((DayOfWeek)mywish.i_beforedays).ToString());                                       
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("\nStart=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);    
                      LogDebug("End=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);

                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                      schedule.Delete();
                      return false;
                  }

              }
              else if (mywish.i_beforedays < mywish.i_afterdays)
              /*                                    0:0
                      -----I-------------------------I------------------------I------
               *          after                                            before
               *          
               *     1)    I    start        end     I                        I               start >= after   &&   end >= after   &&   end >= start
               *          
               *          
               *     2)    I                         I       start     end    I                start <=before   &&   end <= before  &&   end >= start
               *     
               *     3)    I    start                I       end              I                start >= after   &&   end <= before  &&   end <= start
               *                          
               *    
               *       
               */
              {  //use timeinterval from before_days till after_days
                  bool doublecheck = false;
                  if (((start_day >= mywish.i_afterdays) && (end_day >= mywish.i_afterdays) && (end_day >= start_day)) || ((start_day <= mywish.i_beforedays) && (end_day <= mywish.i_beforedays) && (end_day >= start_day)) || ((start_day >= mywish.i_afterdays) && (end_day <= mywish.i_beforedays) && (end_day <= start_day)))
                  {
                      doublecheck = true;
                  }

                  if (((start_day < mywish.i_afterdays) || (end_day < mywish.i_afterdays) || (end_day < start_day)) && ((start_day > mywish.i_beforedays) || (end_day > mywish.i_beforedays) || (end_day < start_day)) && ((start_day < mywish.i_afterdays) || (end_day > mywish.i_beforedays)))
                  {
                      if (doublecheck == true)
                      {
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.ERROR);
                          LogDebug("doublecheck failed check equation for days - please post logfile and contact huha", (int)LogSetting.ERROR);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.ERROR);
                      }
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Skipping program {0} because it is not between {1} and {2}",63, oneprogram.Title, ((DayOfWeek)mywish.i_afterdays).ToString() , ((DayOfWeek)mywish.i_beforedays).ToString() );
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("\nStart=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);                     
                      LogDebug("End=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                      
                      schedule.Delete();
                      return false;
                  }
              }// if (before_days == after_days) do nothing
          }
          #endregion filter days

          #region filter time
          LogDebug("afterhours filter", (int)LogSetting.DEBUG);
          // filter function only use schedules starting after hh:mm and ending before hh:mm
          if ((mywish.i_aftertime > -1) && (mywish.i_beforetime > -1))
          {

              int start_time_minutes_all = oneprogram.StartTime.Hour * 60 + oneprogram.StartTime.Minute;
              int end_time_minutes_all = start_time_minutes_all;

              LogDebug("after_minutes= " + mywish.i_aftertime, (int)LogSetting.DEBUG);
              LogDebug("before_minutes= " + mywish.i_beforetime, (int)LogSetting.DEBUG);
              LogDebug("start_time_minutes= " + start_time_minutes_all, (int)LogSetting.DEBUG);
              LogDebug("end_time_minutes= " + end_time_minutes_all, (int)LogSetting.DEBUG);

              if (mywish.i_beforetime >= mywish.i_aftertime)
              /*
                      ------I-------------------------------------------------I------
               *          after                                            before
               *                          start              end
               *                          
               *    start >= after  &&  end <= before  &&  end >= start
               *       
               */
              { //use regular timeinterval from after_minutes till before_minutes
                  if ((start_time_minutes_all < mywish.i_aftertime) || (end_time_minutes_all > mywish.i_beforetime) || (end_time_minutes_all < start_time_minutes_all))  
                  
                  {

                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Skipping program {0} because it is not between {1} and {2}",64, oneprogram.Title, mywish.aftertime , mywish.beforetime);
                      message+="\nStart=" + oneprogram.StartTime.ToString();
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("End=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                      
                      schedule.Delete();
                      return false;
                  }

              }
              else if (mywish.i_beforetime < mywish.i_aftertime)
              /*                                    0:0
                      -----I-------------------------I------------------------I------
               *          after                                            before
               *          
               *     1)    I    start        end     I                        I               start >= after   &&   end >= after   &&   end >= start
               *          
               *          
               *     2)    I                         I       start     end    I                start <=before   &&   end <= before  &&   end >= start
               *     
               *     3)    I    start                I       end              I                start >= after   &&   end <= before  &&   end <= start
               *                          
               *    
               *       
               */
              {  //use timeinterval from after_minutes till 23:59 and from 00:00 till before_minutes
                  bool doublecheck = false;
                  if (((start_time_minutes_all >= mywish.i_aftertime) && (end_time_minutes_all >= mywish.i_aftertime) && (end_time_minutes_all >= start_time_minutes_all)) || ((start_time_minutes_all <= mywish.i_beforetime) && (end_time_minutes_all <= mywish.i_beforetime) && (end_time_minutes_all >= start_time_minutes_all)) || ((start_time_minutes_all >= mywish.i_aftertime) && (end_time_minutes_all <= mywish.i_beforetime) && (end_time_minutes_all <= start_time_minutes_all)))
                  {
                      doublecheck = true;
                  }
                  //if (((start_time_minutes_all < mywish.i_aftertime) && (start_time_minutes_all > mywish.i_beforetime)) || ((end_time_minutes_all > mywish.i_beforetime) && (end_time_minutes_all < mywish.i_aftertime)))
                  if ( ( (start_time_minutes_all < mywish.i_aftertime)||(end_time_minutes_all < mywish.i_aftertime)||(end_time_minutes_all < start_time_minutes_all) ) && ( (start_time_minutes_all > mywish.i_beforetime)||(end_time_minutes_all > mywish.i_beforetime)||(end_time_minutes_all < start_time_minutes_all) ) && ( (start_time_minutes_all < mywish.i_aftertime)||(end_time_minutes_all > mywish.i_beforetime) ) )
                  {
                      if (doublecheck == true)
                      {
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.ERROR);
                          LogDebug("doublecheck failed check equation for minutes - please post logfile and contact huha", (int)LogSetting.ERROR);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.ERROR);
                      }
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Skipping program {0} because it is not between {1} and {2}",64,oneprogram.Title, mywish.aftertime , mywish.beforetime);
                      message+="\nStart=" + oneprogram.StartTime.ToString();
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("End=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);                      
                      
                      schedule.Delete();
                      return false;
                  }
              }// if (before_minutes == after_minutes) do nothing
          }
          #endregion filter time

          #region within next hours
          LogDebug("start WithinNextHours", (int)LogSetting.DEBUG);
          if (mywish.i_withinNextHours > 0)
          {
              DateTime myNextDateTime = DateTime.Now;
              myNextDateTime = myNextDateTime.AddHours(mywish.i_withinNextHours);

              if (oneprogram.StartTime > myNextDateTime)
              {
                  LogDebug("", (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  lng.TranslateString(message = "Skipping program {0} because it is not within the next {1} hours", 65, oneprogram.Title,mywish.i_withinNextHours.ToString());
                  message+="\nStart=" + oneprogram.StartTime.ToString();
                  LogDebug(message, (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);                      
                      
                  schedule.Delete();
                  return false;
              }
          }
          #endregion within next hours

          #region channelfilter
          LogDebug("start channelfilter", (int)LogSetting.DEBUG);
          //filter one specific channel
          if (mywish.channel != "")
          {
              Channel channel = null;
              string channelname = "";
              try  //must use try due to in bug in map.ReferencedChannelGroup() - caused exception before
              {
                  //search for TV group match
                  channel = schedule.ReferencedChannel();
                  channelname = channel.DisplayName;
              }
              catch
              {
                  LogDebug("", (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  LogDebug("Error: could not retrieve channel name for program " + schedule.ProgramName, (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  channelname = "";
              }
              LogDebug("channelname=" + channelname, (int)LogSetting.DEBUG);
              LogDebug("channelfilter=" + mywish.channel, (int)LogSetting.DEBUG);

              if ((mywish.channel != channelname)&&(mywish.channel != lng.TranslateString("Any",4100)))
              {
                  LogDebug("", (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  message = lng.TranslateString("Skipping program {0} because it does not match the required channel filter {1}",66, oneprogram.Title, mywish.channel);                
                  LogDebug(message, (int)LogSetting.INFO);
                  LogDebug("\nChannelname=" + channelname, (int)LogSetting.INFO);
                  LogDebug("\nStart=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                  LogDebug("End=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);                      
                  
                  schedule.Delete();
                  return false;
              }
          }
          #endregion channelfilter

#if (TV12)
          #region filter episode part
          //filter episode part
          LogDebug("start filterepisode part", (int)LogSetting.DEBUG);
          if (mywish.episodepart != "")
          {
              if (mywish.episodepart.ToUpper() != oneprogram.EpisodePart.ToUpper())
              {
                  LogDebug("", (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  message = lng.TranslateString("Skipping program {0} because it does not match the required episode part {1}",67,oneprogram.Title,mywish.episodepart);
                  LogDebug(message, (int)LogSetting.INFO);
                  LogDebug("\nStart=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                  LogDebug("\nEnd=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                  LogDebug("\nEpisodepart=" + oneprogram.EpisodePart, (int)LogSetting.INFO);                 
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);

                  schedule.Delete();
                  return false;
              }
          }
          #endregion filter episode part

          #region filter episode name
          //filter episode name
          LogDebug("start filterepisodename", (int)LogSetting.DEBUG);
          if (mywish.episodename != "")
          {
              if (mywish.episodename.ToUpper() != oneprogram.EpisodeName.ToUpper())
              {
                  LogDebug("", (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  message = lng.TranslateString("Skipping program {0} because it does not match the required episode name {1}",68, oneprogram.Title, mywish.episodename);
                  LogDebug(message, (int)LogSetting.INFO);
                  LogDebug("\nStart=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                  LogDebug("\nEnd=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                  LogDebug("\nEpisodeName=" + oneprogram.EpisodeName, (int)LogSetting.INFO);                
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                  
                  schedule.Delete();
                  return false;
              }
          }
          #endregion filter episode name

          

          #region filter series number
          //filter series number
          LogDebug("start filterseries", (int)LogSetting.DEBUG);
          if ((mywish.seriesnumber != "") && (oneprogram.SeriesNum != ""))
          {
              try
              {
                  string[] tokens = oneprogram.SeriesNum.Split('\\','/');
                  Log.Debug("tokens[0]=" + tokens[0]);

                  int programNumber = -1;
                  int.TryParse(tokens[0], out programNumber);
                  Log.Debug("programNumber=" + programNumber.ToString());
                  //process expressions
                  bool expression = false;
                  string[] expressionArray = mywish.seriesnumber.Split(',');
                  foreach (string myExpression in expressionArray)
                  {
                      if (myExpression.Contains("-") == true)
                      {
                          string[] numberarray = myExpression.Split('-');
                          Log.Debug("numberarray.Length=" + numberarray.Length.ToString());
                          if (numberarray.Length == 2)
                          {
                              if ((numberarray[0] == string.Empty) || (numberarray[1] == string.Empty))
                              {  // a- or -a
                                  Log.Debug("a- or -a case");
                                  string temp = myExpression.Replace("-", string.Empty);

                                  int maxValue = 0;
                                  int.TryParse(temp, out maxValue);
                                  Log.Debug("Expression = " + mywish.seriesnumber + " maxValue=" + maxValue.ToString());
                                  if (programNumber <= maxValue)
                                  {
                                      expression = true;
                                      Log.Debug("Found match in expression " + myExpression);
                                      break;
                                  }    
                              }
                              else //a-b
                              {
                                  int minValue = 0;
                                  int.TryParse(numberarray[0], out minValue);
                                  Log.Debug("Expression = " + mywish.seriesnumber + " minValue=" + minValue.ToString());

                                  int maxValue = 0;
                                  int.TryParse(numberarray[1], out maxValue);
                                  Log.Debug("Expression = " + mywish.seriesnumber + " maxValue=" + maxValue.ToString());

                                  if ((programNumber >= minValue) && (programNumber <= maxValue))
                                  {
                                      expression = true;
                                      Log.Debug("Found match in expression " + myExpression);
                                      break;
                                  }
                              }
                          }
                          else
                          {
                              Log.Error("Ignoring invalid expression " + myExpression);
                              break;
                          }                        
                      }
                      else if (myExpression.Contains("+") == true)
                      {
                          string temp = myExpression.Replace("+", string.Empty);
                          int minValue = 0;
                          int.TryParse(temp, out minValue);
                          Log.Debug("Expression = " + mywish.seriesnumber + " minValue=" + minValue.ToString());
                          if (programNumber >= minValue)
                          {
                              expression = true;
                              Log.Debug("Found match in expression " + myExpression);
                              break;
                          }                          
                      }                      
                      else
                      {
                          int minValue = 0;
                          int.TryParse(myExpression, out minValue);
                          Log.Debug("Expression = " + mywish.seriesnumber + " intValue=" + minValue.ToString());
                          if (programNumber == minValue)
                          {
                              expression = true;
                              Log.Debug("Found match in expression " + myExpression);
                              break;
                          }                          
                      }
                  }

                  if (expression == false) //skip incorrect numbers
                  {
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Skipping program {0} because it is not matching the required series number {1}",69, oneprogram.Title,mywish.seriesnumber);
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("Start=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("End=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("Seriesnumber=" + oneprogram.SeriesNum, (int)LogSetting.INFO);                     
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);

                      schedule.Delete();
                      return false;
                  }
              }
              catch (Exception exc)
              {
                  //ignore errors
                  LogDebug("Exception in filter series number - Message=" + exc.Message, (int)LogSetting.ERROR);
                  string languagetext = lng.TranslateString("Fatal error - check the log file", 24);
                  labelmessage(languagetext, PipeCommands.StartEpg); //do not stop - do not flag as error
                  Thread.Sleep(ErrorWaitTime);
              }
          }
          #endregion filter series number


          #region filter episode number
          //filter episode number
          LogDebug("start filter episode number", (int)LogSetting.DEBUG);
          if ((mywish.episodenumber != "") && (oneprogram.EpisodeNum != ""))
          {
              try
              {
                  string[] tokens = oneprogram.EpisodeNum.Split('\\', '/');
                  Log.Debug("tokens[0]=" + tokens[0]);
                  int programNumber = 0;
                  int.TryParse(tokens[0], out programNumber);
                  Log.Debug("programNumber=" + programNumber.ToString());
                  //process expressions
                  bool expression = false;
                  string[] expressionArray = mywish.episodenumber.Split(',');
                  foreach (string myExpression in expressionArray)
                  {
                      if (myExpression.Contains("-") == true)
                      {
                          string[] numberarray = myExpression.Split('-');
                          if (numberarray.Length == 2)
                          {
                              if ((numberarray[0] == string.Empty) || (numberarray[1] == string.Empty))
                              {  // a- or -a
                                  Log.Debug("a- or -a case");
                                  string temp = myExpression.Replace("-", string.Empty);

                                  int maxValue = 0;
                                  int.TryParse(temp, out maxValue);
                                  Log.Debug("Expression = " + mywish.episodenumber + " maxValue=" + maxValue.ToString());
                                  if (programNumber <= maxValue)
                                  {
                                      expression = true;
                                      Log.Debug("Found match in expression " + myExpression);
                                      break;
                                  }
                              }
                              else //a-b
                              {
                                  int minValue = 0;
                                  int.TryParse(numberarray[0], out minValue);
                                  Log.Debug("Expression = " + mywish.episodenumber + " minValue=" + minValue.ToString());

                                  int maxValue = 0;
                                  int.TryParse(numberarray[1], out maxValue);
                                  Log.Debug("Expression = " + mywish.episodenumber + " maxValue=" + maxValue.ToString());

                                  if ((programNumber >= minValue) && (programNumber <= maxValue))
                                  {
                                      expression = true;
                                      Log.Debug("Found match in expression " + myExpression);
                                      break;
                                  }
                              }
                          }
                          else
                          {
                              Log.Error("Ignoring invalid expression " + myExpression);
                              break;
                          }
                      }                      
                      else if (myExpression.Contains("+") == true)
                      {
                          string temp = myExpression.Replace("+", string.Empty);
                          int minValue = 0;
                          int.TryParse(temp, out minValue);
                          Log.Debug("Expression = " + mywish.episodenumber + " intValue2=" + minValue.ToString());
                          if (programNumber >= minValue)
                          {                       
                              expression = true;
                              Log.Debug("Found match in expression " + myExpression);
                              break;
                          }
                      }
                      else
                      {
                          int minValue = 0;
                          int.TryParse(myExpression, out minValue);
                          Log.Debug("Expression = " + mywish.episodenumber + " intValue=" + minValue.ToString());
                          if (programNumber == minValue)
                          {
                              expression = true;
                              Log.Debug("Found match in expression " + myExpression);
                              break;
                          }
                      }
                  }

                  if (expression == false) //skip incorrect numbers
                  {
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Skipping program {0} because it is not matching the required episode number {1}",70, oneprogram.Title, mywish.episodenumber);
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("Start=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("End=" + oneprogram.EndTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("Episodenumber=" + oneprogram.EpisodeNum, (int)LogSetting.INFO);                     
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);

                      schedule.Delete();
                      return false;
                  }
              }
              catch (Exception exc)
              {
                  //ignore errors
                  LogDebug("Exception in filter episode number - Message=" + exc.Message, (int)LogSetting.ERROR);
                  string languagetext = lng.TranslateString("Fatal error - check the log file", 24);
                  labelmessage(languagetext, PipeCommands.StartEpg); //do not stop - do not flag as error
                  Thread.Sleep(ErrorWaitTime);
              }
          }
          #endregion filter episode number


#endif

          
          //start checking for repeated and convert to upper
          string programNameRpt = ProcessEpgMarker(oneprogram.Title);
          string descriptionRpt = ProcessEpgMarker(oneprogram.Description);

          /*string programNameRpt = oneprogram.Title.ToUpper();
          try
          {
              programNameRpt = programNameRpt.Replace(_EpgMarker.ToUpper(), "");
          }
          catch
          {
              //ignore errors
          }
          string descriptionRpt = oneprogram.Description.ToUpper();
          
          try
          {
              descriptionRpt = descriptionRpt.Replace(_EpgMarker.ToUpper(), "");
          }
          catch
          {
              //ignore errors
          }*/

          
          LogDebug("programNameRpt=" + programNameRpt, (int)LogSetting.DEBUG);
          LogDebug("descriptionRpt=" + descriptionRpt, (int)LogSetting.DEBUG);

          #region recording exist
          //check for existing recording of same title and description 
          if (mywish.b_skip == true)
          {

              
              foreach (Recording onerecording in Recording.ListAll())
              {
                  Log.Debug("Recording=" + onerecording.Title);
                  string recordedTitle = ProcessEpgMarker(onerecording.Title);
                  string recordedDescription = ProcessEpgMarker(onerecording.Description);

                  /*string recordedTitle = onerecording.Title.ToUpper();
                  try
                  {
                      recordedTitle = recordedTitle.Replace(_EpgMarker.ToUpper(), "");
                  }
                  catch
                  {
                      //ignore errors
                  }
                  string recordedDescription = onerecording.Description.ToUpper();
                  try
                  {
                      recordedDescription = recordedDescription.Replace(_EpgMarker.ToUpper(), "");
                  }
                  catch
                  {
                      //ignore errors
                  }*/
                  //LogDebug("recordedDescription=" + recordedDescription, (int)LogSetting.DEBUG);
                  //LogDebug("descriptionRpt=" + descriptionRpt, (int)LogSetting.DEBUG);


                  if (recordedTitle != programNameRpt)
                      continue;        //new: added for speedup do not do episodemanagament if title does not match
                  

#if(TV100 || TV101)
                  //bool ok = episodeManagement(recordedDescription, descriptionRpt, "", "", "", "", "", oneprogram.SeriesNum, "", oneprogram.EpisodeNum, _episode_d, local_episode_n, local_episode_m);
                  bool ok = episodeManagement(recordedDescription, descriptionRpt, "", "", "", "", "", oneprogram.SeriesNum, "", oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);
                  
#elif(TV11)
                  //bool ok = episodeManagement(recordedDescription, descriptionRpt, onerecording.EpisodePart, oneprogram.EpisodePart, onerecording.EpisodeName, oneprogram.EpisodeName, onerecording.SeriesNum, oneprogram.SeriesNum, onerecording.EpisodeNum, oneprogram.EpisodeNum, _episode_d, local_episode_n, local_episode_m);
                  bool ok = episodeManagement(recordedDescription, descriptionRpt, onerecording.EpisodePart, oneprogram.EpisodePart, onerecording.EpisodeName, oneprogram.EpisodeName, onerecording.SeriesNum, oneprogram.SeriesNum, onerecording.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);
                  
#elif(TV12)

                  //bool ok = episodeManagement(recordedDescription, descriptionRpt, onerecording.EpisodePart, oneprogram.EpisodePart, onerecording.EpisodeName, oneprogram.EpisodeName, onerecording.SeriesNum, oneprogram.SeriesNum, onerecording.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_a, mywish.b_episodecriteria_d, mywish.b_episodecriteria_p, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);
                  bool ok = episodeManagement(recordedDescription, descriptionRpt, onerecording.EpisodePart, oneprogram.EpisodePart, onerecording.EpisodeName, oneprogram.EpisodeName, onerecording.SeriesNum, oneprogram.SeriesNum, onerecording.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);
                  
#endif                    

                  if ((VIEW_ONLY_MODE == false) && (recordedTitle == programNameRpt) && (ok == true))
                  {
                      //check for preferred group

                      
                      bool old1 = IsChannelInGroup(onerecording.IdChannel, mywish.preferredgroup);
                      bool old2 = IsRadioChannelInGroup(onerecording.IdChannel, mywish.preferredgroup);
                      bool new1 = IsChannelInGroup(oneprogram.IdChannel, mywish.preferredgroup);
                      bool new2 = IsRadioChannelInGroup(oneprogram.IdChannel, mywish.preferredgroup);
                      bool expression = (!new1 && !new2) || old1 || old2;

                      Log.Debug("old1=" + old1.ToString(), (int)LogSetting.DEBUG);
                      Log.Debug("old2=" + old2.ToString(), (int)LogSetting.DEBUG);
                      Log.Debug("new1=" + new1.ToString(), (int)LogSetting.DEBUG);
                      Log.Debug("new2=" + new2.ToString(), (int)LogSetting.DEBUG);
                      Log.Debug("expression=" + expression.ToString(), (int)LogSetting.DEBUG);
                      Log.Debug("mywish.b_includeRecordings=" + mywish.b_includeRecordings.ToString(), (int)LogSetting.DEBUG);
                      
                      if (!mywish.b_includeRecordings || (mywish.preferredgroup==lng.TranslateString("All Channels",4104)) || expression)  //preferred group only if includeRecordings==true
                      {
                          LogDebug("", (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO); //do not send reply mail for already scheduled movies
                          message = lng.TranslateString("Program: {0} already recorded",71,oneprogram.Title);
                          LogDebug(message, (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                          outputscheduletoresponse(schedule, (int)LogSetting.INFO);
                          mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.ALREADY_RECORDED, mywish.tvwishid, string.Empty);
                  
                          schedule.Delete();
                          return false;
                      }
                      else
                      {
                          LogDebug("", (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO); //do not send reply mail for already scheduled movies
                          LogDebug("Warning: Program: " + oneprogram.Title + " already recorded, but not in preferred group - will try again", (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                                                   
                      }
                  }
              }
          }
          #endregion recording exist

          #region skip deleted entries in messages
          //skip deleted entries in messages if found again
          if ((mywish.b_skip == true) && (_skipDeleted == true))
          {
              foreach (xmlmessage singlemessage in mymessage.ListAllTvMessages())
              {
                  if (singlemessage.type == MessageType.Deleted.ToString())
                  {
                      string title = ProcessEpgMarker(singlemessage.title);
                      string messageDescription = ProcessEpgMarker(singlemessage.description);
                      
                      
                      /*string title = singlemessage.title.ToUpper();
                      try
                      {
                          title = title.Replace(_EpgMarker.ToUpper(), "");
                      }
                      catch
                      {
                          //ignore errors
                      }
                      string messageDescription = singlemessage.description.ToUpper();
                      try
                      {
                          messageDescription = messageDescription.Replace(_EpgMarker.ToUpper(), "");
                      }
                      catch
                      {
                          //ignore errors
                      }*/
                      //LogDebug("onerecording.Description=" + onerecording.Description, (int)LogSetting.DEBUG);
                      //LogDebug("onerecording.Description=" + onerecording.Description, (int)LogSetting.DEBUG);

                      if (title != programNameRpt)
                          continue;   //new. added for speedup - ignore if title does not match and do not do episodemanagement


#if(TV100 || TV101)
                      //bool ok = episodeManagement(messageDescription, descriptionRpt, "", "", "", "", "", oneprogram.SeriesNum, "", oneprogram.EpisodeNum, _episode_d, local_episode_n, local_episode_m);
                      bool ok = episodeManagement(messageDescription, descriptionRpt,  "", "", "", "", "", oneprogram.SeriesNum, "", oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);


#elif(TV11)
                      //bool ok = episodeManagement(messageDescription, descriptionRpt, singlemessage.EpisodePart, oneprogram.EpisodePart, singlemessage.EpisodeName, oneprogram.EpisodeName, singlemessage.SeriesNum, oneprogram.SeriesNum, singlemessage.EpisodeNum, oneprogram.EpisodeNum, _episode_d, local_episode_n, local_episode_m);
                      bool ok = episodeManagement(messageDescription, descriptionRpt, singlemessage.EpisodePart, oneprogram.EpisodePart, singlemessage.EpisodeName, oneprogram.EpisodeName, singlemessage.SeriesNum, oneprogram.SeriesNum, singlemessage.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);

#elif(TV12)
                      //bool ok = episodeManagement(messageDescription, descriptionRpt, singlemessage.EpisodePart, oneprogram.EpisodePart, singlemessage.EpisodeName, oneprogram.EpisodeName, singlemessage.SeriesNum, oneprogram.SeriesNum, singlemessage.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_a, mywish.b_episodecriteria_d, mywish.b_episodecriteria_p, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);
                      bool ok = episodeManagement(messageDescription, descriptionRpt, singlemessage.EpisodePart, oneprogram.EpisodePart, singlemessage.EpisodeName, oneprogram.EpisodeName, singlemessage.SeriesNum, oneprogram.SeriesNum, singlemessage.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);

#endif

                      if ((VIEW_ONLY_MODE == false) && (title == programNameRpt) && (ok == true))
                      {
                          LogDebug("", (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO); //do not send reply mail for already scheduled movies
                          message = lng.TranslateString("Program: {0} has been already deleted and is skipped",72,oneprogram.Title);
                          LogDebug(message, (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                          outputscheduletoresponse(schedule, (int)LogSetting.INFO);
                          mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.REPEATED_FOUND, mywish.tvwishid, string.Empty);

                          schedule.Delete();
                          return false;
                      }
                  }

              }
          }//end skip deleted entries in messages if found again
          #endregion skip deleted entries in messages

          #region skip entries from the past
          //skip entries from the past
          if ((schedule.StartTime < DateTime.Now) && (schedule.ScheduleType == 0) && (VIEW_ONLY_MODE == false)) //old date, but only for type "ONCE" and Email/Recording mode  
          {

              LogDebug("", (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
              message = lng.TranslateString("Start time of program {0} is in the past - will skip schedule",73,oneprogram.Title);
              LogDebug(message, (int)LogSetting.INFO);
              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
              mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);

              schedule.Delete();
              return false;
          }
          #endregion skip entries from the past

          Schedule nonPreferredGroupSchedule = null;

          #region Check for repeated schedules (1st)
          if ((mywish.b_skip == true)&&(VIEW_ONLY_MODE == false)) // 1st
          {//Check for repeated schedules of same title and description
              foreach (Schedule myschedule in allschedules)
              {
                  string myscheduleProgramName = ProcessEpgMarker(myschedule.ProgramName);
                  

                  /*string myscheduleProgramName = myschedule.ProgramName.ToUpper();
                  try
                  {
                      myscheduleProgramName = myscheduleProgramName.Replace(_EpgMarker.ToUpper(), "");
                  }
                  catch
                  {
                      //ignore errors
                  }*/

                  //check for identical description
                  LogDebug("check for identical description", (int)LogSetting.DEBUG);
                  //retrieve Program from Schedule
#if(TV100 || TV101)
                          Program myprogram = Program.RetrieveByTitleAndTimes(myschedule.ProgramName, myschedule.StartTime, myschedule.EndTime);
#elif(TV11 || TV12)
                  Program myprogram = Program.RetrieveByTitleTimesAndChannel(myschedule.ProgramName, myschedule.StartTime, myschedule.EndTime, myschedule.IdChannel);
#endif

                  if (myprogram != null)
                  {
                      string myprogramDescription = ProcessEpgMarker(myprogram.Description);
                      /*string myprogramDescription = myprogram.Description.ToUpper();
                      try
                      {
                          myprogramDescription = myprogramDescription.Replace(_EpgMarker.ToUpper(), "");
                      }
                      catch
                      {
                          //ignore errors
                      }*/

                      //compare episodes


#if(TV100 || TV101)
                      bool ok = episodeManagement(myprogramDescription, descriptionRpt, "", "", "", "", myprogram.SeriesNum, oneprogram.SeriesNum, myprogram.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);


#elif(TV11)
                      bool ok = episodeManagement(myprogramDescription, descriptionRpt, myprogram.EpisodePart, oneprogram.EpisodePart, myprogram.EpisodeName, oneprogram.EpisodeName, myprogram.SeriesNum, oneprogram.SeriesNum, myprogram.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);

#elif(TV12)
                      bool ok = episodeManagement(myprogramDescription, descriptionRpt, myprogram.EpisodePart, oneprogram.EpisodePart, myprogram.EpisodeName, oneprogram.EpisodeName, myprogram.SeriesNum, oneprogram.SeriesNum, myprogram.EpisodeNum, oneprogram.EpisodeNum, mywish.b_episodecriteria_d, mywish.b_episodecriteria_n, mywish.b_episodecriteria_c);

#endif

                      if ((VIEW_ONLY_MODE == false) && (ok == true) && (myprogram.Title.ToUpper() == oneprogram.Title.ToUpper()) )  //old bug fixed need to compare title!!!
                      {//schedules do match -> repeated schedule  

                          Log.Debug("mywish.preferredgroup=" + mywish.preferredgroup, (int)LogSetting.DEBUG);

                          bool old1 = IsChannelInGroup(myschedule.IdChannel, mywish.preferredgroup);
                          bool old2 = IsRadioChannelInGroup(myschedule.IdChannel, mywish.preferredgroup);
                          bool new1 = IsChannelInGroup(oneprogram.IdChannel, mywish.preferredgroup);
                          bool new2 = IsRadioChannelInGroup(oneprogram.IdChannel, mywish.preferredgroup);
                          bool expression = (!new1 && !new2) || old1 || old2;

                          Log.Debug("old1=" + old1.ToString(), (int)LogSetting.DEBUG);
                          Log.Debug("old2=" + old2.ToString(), (int)LogSetting.DEBUG);
                          Log.Debug("new1=" + new1.ToString(), (int)LogSetting.DEBUG);
                          Log.Debug("new2=" + new2.ToString(), (int)LogSetting.DEBUG);
                          Log.Debug("expression=" + expression.ToString(), (int)LogSetting.DEBUG);

                          if ((mywish.preferredgroup == lng.TranslateString("All Channels",4104)) || expression)
                          {
                              LogDebug("", (int)LogSetting.INFO);
                              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                              message = lng.TranslateString("Repeated Schedule {0} found  - skipping",74,oneprogram.Title);
                              LogDebug(message, (int)LogSetting.INFO);
                              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                              LogDebug("Old Schedule:", (int)LogSetting.INFO);
                              outputscheduletoresponse(myschedule, (int)LogSetting.INFO);
                              mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.REPEATED_FOUND, mywish.tvwishid, string.Empty);

                              schedule.Delete();
                              return false;
                          }
                          else
                          {
                              LogDebug("", (int)LogSetting.INFO);
                              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                              LogDebug("Repeated Schedule " + oneprogram.Title + " found with same title, but not in preferred group - will try again", (int)LogSetting.INFO);
                              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);


                              if ((_automaticrecording == true) && (mywish.action != lng.TranslateString("Email",2701)) && (mywish.action != lng.TranslateString("View",2703))) //schedule new recording
                              {
                                  
                                  Log.Debug("Storing as nonPreferredGroupSchedule old schedule not in preferred group");
                                  nonPreferredGroupSchedule = myschedule;  //will be deleted later
                                  
                              }
                          }

                      }//end schedules do match -> repeated schedule

                  }//end (myprogram != null)

              }//end all schedules loop
              
          }//end skip repeated schedules
          #endregion Check for repeated schedules (1st)

          #region Check For Conflicts  (2nd)
          // Check for conflicts (2nd)
          LogDebug("check for conflicts", (int)LogSetting.DEBUG);
          if ((VIEW_ONLY_MODE == false)&& (_scheduleconflicts == false))  //scheduleconflicts = true will trigger priority processing
          {
              
#if(MPTV2)
              IList<Schedule> conflict_schedules = Schedule.GetConflictingSchedules(schedule);
#else
              IList<Schedule> conflict_schedules = GetAllConflictSchedules(schedule, nonPreferredGroupSchedule);
#endif
              int conflict_count = conflict_schedules.Count;

              if (conflict_count > 0) 
              {
                  LogDebug("", (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO); //do not send reply mail for already scheduled movies
                  message = lng.TranslateString("Program: {0} has conflicts and will not be scheduled",75,oneprogram.Title);
                  LogDebug(message, (int)LogSetting.INFO);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                  outputscheduletoresponse(schedule, (int)LogSetting.INFO);
                  //conflictprograms.Add(oneprogram);
                  mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.MANUAL_CONFLICT, mywish.tvwishid, string.Empty);

                  Log.Debug("Schedule number before deleting"+Schedule.ListAll().Count.ToString());

                  schedule.Delete();

                  
                  Log.Debug("Schedule number after deleting" + Schedule.ListAll().Count.ToString());

                  return false;
              }
          }
          #endregion Check For Conflicts  (2nd)

          #region PriorityProcessing (3rd)
          //priority processing 3rd if schedule conflicts==true, must come after conflicts
          LogDebug("start priorityprocessing", (int)LogSetting.DEBUG);
          if ((_scheduleconflicts == true) && (_automaticrecording == true) && (mywish.action != lng.TranslateString("Email", 2701)) && (VIEW_ONLY_MODE == false)) 
          {
              
              IList<Schedule> allconflicts = GetAllConflictSchedules(schedule, nonPreferredGroupSchedule);

              LogDebug("allconflicts.Count=" + allconflicts.Count.ToString(), (int)LogSetting.DEBUG);
              while (allconflicts.Count > 0)  //loop until all conflicts are resolved
              {
                  bool foundflag = false;
                  foreach (Schedule conflictschedule in allconflicts)  //only one conflict will be removed (break statements prevents complete loop)
                  {
                      LogDebug("schedule.Priority=" + schedule.Priority.ToString(), (int)LogSetting.DEBUG);
                      LogDebug("conflictschedule.ProgramName=" + conflictschedule.ProgramName.ToString(), (int)LogSetting.DEBUG);
                      LogDebug("conflictschedule.Priority=" + conflictschedule.Priority.ToString(), (int)LogSetting.DEBUG);

                      if (conflictschedule.Priority < schedule.Priority)
                      {
                          //delete conflicting schedule and send message
                          LogDebug("", (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                          message = lng.TranslateString("Deleting schedule {0} because of lower priority",76,conflictschedule.ProgramName);
                          LogDebug(message, (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                          mymessage.addmessage(conflictschedule, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.LOW_PRIORITY_DELETE, mywish.tvwishid, string.Empty);


                          

                          //checked above to avoid email or viewonly
                          Log.Debug("Changing message for old schedule to conflict");
                          int index = mymessage.GetTvMessageBySchedule(conflictschedule,MessageType.Scheduled);
                          if (index >= 0)
                          {
                              xmlmessage changemessage = mymessage.GetTvMessageAtIndex(index);
                              changemessage.message = "Deleting schedule with lower priority";
                              changemessage.type = MessageType.Conflict.ToString();
                              mymessage.ReplaceTvMessageAtIndex(index, changemessage);
                          }

                          Log.Debug("Deleting schedule with lower priority");
                          conflictschedule.Delete();
                          mywish.i_scheduled--;
                          foundflag = true;
                          break; //only one conflict deletion should fix it
                      }
                  }//end loop all conflicting schedules for priority processing
                  if (foundflag == false) //skip schedule due to not high enough priority
                  {
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Schedule {0} has not enough priority to delete conflicts - skipping",77,oneprogram.Title);
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      outputprogramresponse(oneprogram, (int)LogSetting.INFO);

                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.LOW_PRIORITY_DELETE, mywish.tvwishid, string.Empty);

                      schedule.Delete();
                      return false;
                  }
                  
                  //check for additional conflicts and rerun loop
                  allconflicts = GetAllConflictSchedules(schedule, nonPreferredGroupSchedule);
                  
              }//end conflicts do exist for priority processing  while (allconflicts.Count > 0)

          } //end priority processing
          #endregion PriorityProcessing (3rd)

          #region delete nonpreferred group schedule (4th)
          //delete nonpreferred schedule as it is now sure that the preferred group schedule will be scheduled
          if (nonPreferredGroupSchedule != null)
          {
              //delete message for nonpreferred group schedule
              Log.Debug("Changing message for old schedule to conflict");
              int index = mymessage.GetTvMessageBySchedule(nonPreferredGroupSchedule,MessageType.Scheduled);
              if (index >= 0)
              {
                  xmlmessage changemessage = mymessage.GetTvMessageAtIndex(index);
                  changemessage.message = lng.TranslateString("Better Schedule Found In Preferred Group",78);
                  changemessage.type = MessageType.Conflict.ToString();
                  mymessage.ReplaceTvMessageAtIndex(index, changemessage);
              }

              LogDebug("Deleting nonPreferredGroupSchedule title=" + nonPreferredGroupSchedule.ProgramName, (int)LogSetting.DEBUG);
              nonPreferredGroupSchedule.Delete();
              mywish.i_scheduled--;

          }
          #endregion delete nonpreferred schedule (4th)

          //do not insert new code here 

          #region success: schedule and/or email
          //success: schedule and/or email         
          if ((_automaticrecording == true) && (mywish.action != lng.TranslateString("Email", 2701)) && (mywish.action != lng.TranslateString("View", 2703))) //schedule new recording
          {
              LogDebug("", (int)LogSetting.INFO);
              LogDebug("*******************************************************************************\n", (int)LogSetting.INFO);
              message = lng.TranslateString("TvWishList found program from Tv Wish [{0}]: {1}\nTvWishList did schedule the program", 79, (counter + 1).ToString(), mywish.name);
              LogDebug(message, (int)LogSetting.INFO);
              LogDebug("*******************************************************************************\n", (int)LogSetting.INFO);
              


              

              mymessage.addmessage(schedule, message, mywish.t_action, mywish.name, (int)XmlMessages.MessageEvents.SCHEDULE_FOUND, mywish.tvwishid, string.Empty);
              outputscheduletoresponse(schedule, (int)LogSetting.DEBUG);
              LogDebug("End of new schedule", (int)LogSetting.INFO);
              //mywish.i_scheduled++;


              if (mywish.i_keepuntil > 0) //handle days for keepuntil and convert back to date after schedule has been found
              {
                  schedule.KeepDate = DateTime.Now.AddDays(mywish.i_keepuntil);
                  schedule.Persist();
              }


              if (mywish.b_useFoldername)  //add folder move of recording
              {
                  if ((schedule.ProgramName.Contains(@"\")) || (mywish.name.Contains(@"\")))
                  {
                      LogDebug("", (int)LogSetting.ADDRESPONSE);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.ADDRESPONSE);
                      LogDebug("Failed to add folder " + schedule.ProgramName + " because program and name must not contain \" \\\"", (int)LogSetting.ADDRESPONSE);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.ADDRESPONSE);
                  }
                  else
                  {

                      //create new xml file for renaming recorded filename
                      try
                      {
                          XmlDocument xmlDoc = new XmlDocument();
                          string filename = TV_USER_FOLDER + @"\TvWishList\" + FileRenameXML;

                          try
                          {
                              xmlDoc.Load(filename);
                          }
                          catch (System.IO.FileNotFoundException)
                          {
                              XmlTextWriter xmlWriter = new XmlTextWriter(filename, System.Text.Encoding.UTF8);
                              xmlWriter.Formatting = Formatting.Indented;
                              xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
                              xmlWriter.WriteStartElement("AllJobs");
                              xmlWriter.Close();
                              xmlDoc.Load(filename);
                          }

                          XmlNode alljobs = xmlDoc.DocumentElement;
                          //XmlNode alljobs = xmlDoc.SelectSingleNode("/AllJobs");
                          XmlNode node = xmlDoc.CreateElement("Job");
                          AddAttribute(node, "ScheduleName", schedule.ProgramName);
                          AddAttribute(node, "Folder", mywish.name);

                          //episode mode with separate folder has been disabled above already

                          Double number = Convert.ToDouble(schedule.PreRecordInterval) * (-1);
                          DateTime absoluteStartTime = oneprogram.StartTime.AddMinutes(number);
                          AddAttribute(node, "Start", absoluteStartTime.ToString("yyyy-MM-dd_HH:mm", CultureInfo.InvariantCulture));
                          LogDebug("Start=" + absoluteStartTime.ToString("yyyy-MM-dd_HH:mm", CultureInfo.InvariantCulture), (int)LogSetting.DEBUG);

                          number = Convert.ToDouble(schedule.PostRecordInterval);
                          DateTime absoluteEndTime = oneprogram.EndTime.AddMinutes(number);
                          AddAttribute(node, "End", absoluteEndTime.ToString("yyyy-MM-dd_HH:mm", CultureInfo.InvariantCulture));
                          LogDebug("End=" + absoluteEndTime.ToString("yyyy-MM-dd_HH:mm", CultureInfo.InvariantCulture), (int)LogSetting.DEBUG);

                          AddAttribute(node, "idChannel", schedule.IdChannel.ToString());

                          alljobs.AppendChild(node);


                          xmlDoc.Save(filename);
                      }
                      catch (Exception exc)
                      {
                          LogDebug("Could not update " + TV_USER_FOLDER + @"\TvWishList\" + FileRenameXML, (int)LogSetting.ERROR);
                          LogDebug("Exception message was " + exc.Message, (int)LogSetting.ERROR);
                          string languagetext = lng.TranslateString("Fatal error - check the log file", 24);
                          labelmessage(languagetext, PipeCommands.StartEpg); //do not stop - do not flag as error
                          Thread.Sleep(ErrorWaitTime);
                      }
                  }
              }


          }
          else
          {
              if (mymessage.existsmessage(schedule, mywish.t_action) == false)  //new reminder - send email
              {
                  LogDebug("", (int)LogSetting.INFO);
                  LogDebug("*******************************************************************************\n", (int)LogSetting.INFO);
                  message = lng.TranslateString("TvWishList found program from Tv Wish [{0}]: {1}\nTvWishList did not schedule but is reminding you of the program", 80, (counter + 1).ToString(), mywish.name);
                  LogDebug("*******************************************************************************\n", (int)LogSetting.INFO);
                  LogDebug(message, (int)LogSetting.INFO);
                  schedule.ScheduleType = 9;  //bug in 1.2.0.15
                  mymessage.addmessage(schedule, message, mywish.t_action, mywish.name, (int)XmlMessages.MessageEvents.EMAIL_FOUND, mywish.tvwishid, string.Empty);
                  outputscheduletoresponse(schedule, (int)LogSetting.DEBUG);
                  schedule.ScheduleType = 0; //end bug 1.2.0.15
                  LogDebug("End of reminder a", (int)LogSetting.DEBUG);
                  schedule.Delete();
                  //mywish.i_scheduled++;

              }
              else //message does exist already - do not send email but return
              {
                  LogDebug("", (int)LogSetting.DEBUG);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.DEBUG);
                  LogDebug("Message does exist already - not included in email", (int)LogSetting.DEBUG);
                  LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.DEBUG);
                  outputscheduletoresponse(schedule, (int)LogSetting.DEBUG);
                  LogDebug("End of old reminder b", (int)LogSetting.DEBUG);
                  schedule.Delete();

              }
          }
          #endregion success: schedule and/or email

          return true;
      }
示例#12
0
      //-------------------------------------------------------------------------------------------------------------        
      // Search epg data and find all matching programs 
      //-------------------------------------------------------------------------------------------------------------  
      // matching programs are searched based on available information for program name, start time, endtime, displayname or groupname
      // if dispalyname is defined, groupnames will be ignored
      // partial name = true will handle partial name matches from program name
      // the routine will return an IList<Program> matchingprograms which contains all EPG programs of Type Program
      // the routine will not do any checking for conflicts of the list
      //-------------------------------------------------------------------------------------------------------------                              
      public bool SqlQueryPrograms(ref TvWish mywish, int counter)
      {

          LogDebug("TvWishList: Autocomplete search for matching programs", (int)LogSetting.DEBUG);
          

          if (mywish.b_active == false)
          {
              Log.Debug("Tvwish is inactive - returning");
              return true;
          }

          string SearchIn = mywish.s_SearchIn.ToLower();
          String Expression = String.Empty;
          IFormatProvider mmddFormat = new CultureInfo(String.Empty, false);
          IList<Program> myprogramlist = null;

          /*  search names are case invariant (title SOKO equal to title soko)
                   * 
                   * LIKE
                   * NOT LIKE
                   % 	A substitute for zero or more characters
                   _ 	A substitute for exactly one character
                   [charlist] 	Any single character in charlist
                   [^charlist] or [!charlist] Any single character not in charlist
                   * 
                   * 
                   * 
                   * SELECT column_name(s)
                     FROM table_name
                     WHERE column_name operator value
                   
                   Operators Allowed in the WHERE Clause

                    With the WHERE clause, the following operators can be used:
                    Operator 	Description
                    = 	Equal
                    <> 	Not equal
                    > 	Greater than
                    < 	Less than
                    >= 	Greater than or equal
                    <= 	Less than or equal
                    BETWEEN 	Between an inclusive range
                    LIKE 	Search for a pattern
                    IN 	If you know the exact value you want to return for at least one of the columns
                   * 
                   * 
                   * Combine with brackets ()
                   * and with AND or OR

                    Note: In some versions of SQL the <> operator may be written as !=
           * 
           * 
           *       Program columns:
           *       title
           *       description
           *       classification
           *       
                   
         string Title 
         string Classification 
         string Description 
         DateTime StartTime 
         DateTime EndTime
         DateTime OriginalAirDate
         string EpisodeName 
         string EpisodeNum 
         string EpisodeNumber 
         string EpisodePart 
         string Genre 
         int ParentalRating 
         string SeriesNum 
         int StarRating
         int IdChannel 
         int IdProgram        
         
          
          
        
        */
          string EscapeName = EscapeSQLString(mywish.searchfor);
          if (SearchIn == "title") //no translation needed due to separation of original string
          {
              Expression += String.Format("(EndTime >= '{0}') AND ", DateTime.Now.ToString(GetDateTimeString(), mmddFormat));  //only programs after now
              if (mywish.b_partialname == true)  //partial title
              {
                  Expression += String.Format("( title like '%{0}%' ) ", EscapeName);                
              }
              else                      //exact title
              {
                  Expression += String.Format("( title = '{0}' ) ", EscapeName);
              }              
          }//end title
          else if (SearchIn == "text")  //search in description  //no translation needed due to separation of original string
          {
              Expression += String.Format("(EndTime >= '{0}') AND ", DateTime.Now.ToString(GetDateTimeString(), mmddFormat));  //only programs after now
              Expression += String.Format("( description like '%{0}%' ) ", EscapeName);
          }//end description
          else if (SearchIn == "both") //no translation needed due to separation of original string
          {
              Expression += String.Format("(EndTime >= '{0}') AND (", DateTime.Now.ToString(GetDateTimeString(), mmddFormat));  //only programs after now

              if (mywish.b_partialname == true)  //partial title
              {
                  Expression += String.Format("( title like '%{0}%' ) OR ", EscapeName);
              }
              else                      //exact title
              {
                  Expression += String.Format("( title = '{0}' ) OR ", EscapeName);
              }

              Expression += String.Format("( description like '%{0}%' ) )", EscapeName);

          }//end both

          if (SearchIn == "expression") //no translation needed due to separation of original string
          {
              Expression = mywish.searchfor;

              //split in schedule and recording expression
              Expression = Expression.Replace("<BR>", "\n");
              Expression = Expression.Replace("<br>", "\n");
              Expression = Expression.Replace(@"\n", "\n");
              Expression = Expression.Replace(@"\'", "'");  //needed for expressions
              string[] expArray = Expression.Split('\n');
              if (expArray.Length < 1)
              {
                  Log.Debug("No expression defined for searching schedules on tvwish " + mywish.name);
                  return true;
              }
              else
              {
                  Expression = expArray[0];
                  Log.Debug("Expression=" + Expression);
              }
          }

          //SQL Query
          LogDebug("SQL query for: " + Expression, (int)LogSetting.DEBUG);
          try
          {
#if (MPTV2)
              string command = "select * from programs where "+Expression;

              Log.Debug("command=" + command);
              myprogramlist = Program.GeneralSqlQuery(command);
#else
              StringBuilder SqlSelectCommand = new StringBuilder();
              SqlSelectCommand.Append("select * from Program ");
              SqlSelectCommand.AppendFormat("where {0}", Expression);  //!!!!!!!!!!!!!!!!!!!!!!EscapeSQLString cannot be checked for expression
              SqlSelectCommand.Append(" order by StartTime");
              SqlStatement stmt = new SqlBuilder(StatementType.Select, typeof(Program)).GetStatement(true);
              SqlStatement ManualJoinSQL = new SqlStatement(StatementType.Select, stmt.Command, SqlSelectCommand.ToString(),typeof(Program));
              myprogramlist = ObjectFactory.GetCollection<Program>(ManualJoinSQL.Execute());
#endif
          }
          catch (Exception exc)
          {
              LogDebug("Error in SQL query for searching " + Expression, (int)LogSetting.ERROR);
              LogDebug("Exception message was " + exc.Message, (int)LogSetting.ERROR);

              string languagetext = lng.TranslateString("Error in SQL query - check the expression {0}", 25, Expression);
              labelmessage(languagetext, PipeCommands.StartEpg); //do not mark as an error as other commands are still coming - just delay message
              Thread.Sleep(ErrorWaitTime);
              return false;
          }
          // End of SQL Query

          Log.Debug(myprogramlist.Count.ToString()+" programs found");
         
          foreach (Program myprogram in myprogramlist)
          {
              Program oneprogram = myprogram;

              LogDebug("\n************************************************************", (int)LogSetting.DEBUG);
              LogDebug("****Next program in autocompletion:", (int)LogSetting.DEBUG);
              outputprogramresponse(myprogram, (int)LogSetting.DEBUG); //Debug only

              // process groupname
              if (mywish.group != lng.TranslateString("All Channels",4104))
              {
                  if ((IsChannelInGroup(oneprogram.IdChannel, mywish.group) == false) && (IsRadioChannelInGroup(oneprogram.IdChannel, mywish.group) == false))
                  {
                      LogDebug("!!!!!!!Groupname " + mywish.group + " not matching for title " + oneprogram.Title + " at " + oneprogram.StartTime.ToString(), (int)LogSetting.DEBUG);
                      continue;                     
                  }
              }
              
              //process exclude
              if (mywish.exclude != string.Empty)
              {
                  string Exclude = mywish.exclude.ToUpper();
                  String Exclude1 = "";
                  String Exclude2 = "";
                  Exclude = Exclude.Replace("||", "\n");//bug fix: was && before
                  String[] Tokens = Exclude.Split('\n');
                  if (Tokens.Length >= 2)
                  {
                      Exclude2 = Tokens[1];
                  }

                  if (Tokens.Length >= 1)
                  {
                      Exclude1 = Tokens[0];
                  }
                  LogDebug("TvWishList: Exclude1=" + Exclude1, (int)LogSetting.DEBUG);
                  LogDebug("TvWishList: Exclude2=" + Exclude2, (int)LogSetting.DEBUG);

                  Boolean foundflag = false;

                  if ((Exclude1.StartsWith("*") == true) && (Exclude1.StartsWith("**") == false)) //exclude in description
                  {
                      string Exclude_mod = Exclude1.Substring(1, Exclude.Length - 1);
                      //LogDebug("Exclude_mod= " + Exclude_mod, (int)LogSetting.DEBUG);
                      if ((oneprogram.Description.ToUpper().Contains(Exclude_mod) == false) || (Exclude_mod == ""))
                      {
                          if ((oneprogram.Description.ToUpper().Contains(Exclude2) == false) || (Exclude2 == ""))
                          {
                              foundflag = true;
                              LogDebug("No Exclude of program for " + oneprogram.Title + " at " + oneprogram.StartTime.ToString(), (int)LogSetting.DEBUG);
                          }
                      }
                  }
                  else if (Exclude1.StartsWith("**") == true) //exclude in title or description
                  {
                      string Exclude_mod = Exclude1.Substring(2, Exclude.Length - 2);
                      //LogDebug("Exclude_mod= " + Exclude_mod, (int)LogSetting.DEBUG);
                      if (((oneprogram.Title.ToUpper().Contains(Exclude_mod) == false) && (oneprogram.Description.ToUpper().Contains(Exclude_mod) == false)) || (Exclude_mod == ""))
                      {
                          if (((oneprogram.Title.ToUpper().Contains(Exclude2) == false) && (oneprogram.Description.ToUpper().Contains(Exclude2) == false)) || (Exclude2 == ""))
                          {
                              foundflag = true;
                              LogDebug("No Exclude of program for title " + oneprogram.Title + " at " + oneprogram.StartTime.ToString(), (int)LogSetting.DEBUG);
                          }
                      }
                  }
                  else if ((oneprogram.Title.ToUpper().Contains(Exclude1) == false) || (Exclude1 == "")) //exclude only in title
                  {
                      if ((oneprogram.Title.ToUpper().Contains(Exclude2) == false) || (Exclude2 == ""))
                      {
                          foundflag = true;
                          LogDebug("No Exclude of program for title " + oneprogram.Title + " at " + oneprogram.StartTime.ToString(), (int)LogSetting.DEBUG);
                      }
                  }

                  if (foundflag == false)
                  {                      
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Excluding program {0} due to exclude filter condition {1}",55,oneprogram.Title,mywish.exclude);
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("Start=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);

                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                      continue;
                  }

              }//end exclude
              
              // process valid word check
              if (mywish.b_wordmatch == true)
              {
                  if (SearchIn == "title") //no translation needed due to separation of original string
                  {
                      if (mywish.b_partialname == true)  //partial title
                      {
                          if (validwordcheck(oneprogram.Title,mywish.searchfor) == false)
                          {
                              LogDebug("", (int)LogSetting.INFO);
                              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                              message = lng.TranslateString("Excluding program {0} due to wordcheck filter condition",56,oneprogram.Title);
                              LogDebug(message, (int)LogSetting.INFO);
                              LogDebug("Start=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                              LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);

                              mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                              continue;
                          }
                      }
                  
                  }
                  else if (SearchIn == "text")  //search in description  //no translation needed due to separation of original string
                  {
                      if (validwordcheck(oneprogram.Description, mywish.searchfor) == false)
                      {
                          LogDebug("", (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                          message = lng.TranslateString("Excluding program {0} due to wordcheck filter condition ", 57, oneprogram.Title);
                          LogDebug(message, (int)LogSetting.INFO);
                          LogDebug("Start=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);

                          mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                          continue;
                      }
                  }
                  else if (SearchIn == "both")  //search in either title or description  //no translation needed due to separation of original string
                  {
                      if ((validwordcheck(oneprogram.Title, mywish.searchfor) == false) && (validwordcheck(oneprogram.Description, mywish.searchfor) == false))
                      {
                          LogDebug("", (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                          message = lng.TranslateString("Excluding program {0} due to wordcheck filter condition ", 57, oneprogram.Title);
                          LogDebug(message, (int)LogSetting.INFO);
                          LogDebug("Start=" + oneprogram.StartTime.ToString(), (int)LogSetting.INFO);
                          LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);

                          mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.FILTER_MISMATCH, mywish.tvwishid, string.Empty);
                          continue;
                      }
                  }

              } //end processing valid wordcheck

 
                  string channelname = "Error_with_ID_" + oneprogram.IdChannel.ToString();
                  try
                  {
                      channelname = Channel.Retrieve(oneprogram.IdChannel).DisplayName;
                  }
                  catch//do nothing
                  {

                  }
                  string languagetext = lng.TranslateString("Processing EPG data {0} on {1} at {2}", 21, oneprogram.Title, channelname, oneprogram.StartTime.ToString());
                  labelmessage(languagetext, PipeCommands.StartEpg);
                      

                  if (mywish.i_scheduled >= MAXFOUND)
                  {
                      LogDebug("", (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);
                      message = lng.TranslateString("Maximum number ({0}) of programs found - will ignore additional matches",58, MAXFOUND.ToString());
                      LogDebug(message, (int)LogSetting.INFO);
                      LogDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", (int)LogSetting.INFO);

                      mymessage.addmessage(oneprogram, message, MessageType.Conflict, mywish.name, (int)XmlMessages.MessageEvents.MAXFOUND_EXCEEDED, mywish.tvwishid, string.Empty);

                      return true;
                  }

                  DateTime start = DateTime.Now; //DEBUG PERFORMANCE
                  

                  bool ok = addsingleschedule(oneprogram, ref mywish, counter);

                  DateTime end = DateTime.Now; //DEBUG PERFORMANCE
                  Log.Debug("addsingleschedule time=" + end.Subtract(start).TotalSeconds.ToString()); //DEBUG PERFORMANCE

                  //post processing and updating of Tv wish data by locking to existing found schedule
                  if (ok == true)
                  {
                      try  //update lock filters into tv server
                      {

                          if (mywish.recordtype == lng.TranslateString("Only Once",2650)) // stop after first successful program
                          {
                              LogDebug("Program " + mywish.name + " deactivated", (int)LogSetting.DEBUG);
                              mywish.b_active = false;
                              mywish.active = "False";
                              break; // stop after first successful program
                          }

                          //include all language strings with recordtype Channel
                          if (((mywish.recordtype == lng.Get(2652)) || (mywish.recordtype== lng.Get(2653)) || (mywish.recordtype== lng.Get(2654))|| (mywish.recordtype== lng.Get(2655)))&& (mywish.channel == lng.TranslateString("Any",4100)))
                          {
                              mywish.channel = channelname;
                              Log.Debug("Locked to channelfilter=" + channelname);
                          }

                          //include all language strings with recordtype Time
                          if (((mywish.recordtype == lng.Get(2654)) ||  (mywish.recordtype == lng.Get(2655)))&& (mywish.i_aftertime == -1) && (mywish.i_beforetime == -1))
                          {
                              mywish.i_aftertime = oneprogram.StartTime.Hour * 60 + oneprogram.StartTime.Minute;
                              mywish.aftertime = oneprogram.StartTime.Hour.ToString("D2") + ":" + oneprogram.StartTime.Minute.ToString("D2");
                              Log.Debug("Locked to i_aftertime=" + mywish.i_aftertime.ToString());

                              mywish.i_beforetime = oneprogram.EndTime.Hour * 60 + oneprogram.EndTime.Minute;
                              mywish.beforetime = oneprogram.EndTime.Hour.ToString("D2") + ":" + oneprogram.EndTime.Minute.ToString("D2");
                              Log.Debug("Locked to i_beforetime=" + mywish.i_beforetime.ToString());

                          }

                          //include all language strings with recordtype Day
                          if (((mywish.recordtype == lng.Get(2653)) ||  (mywish.recordtype == lng.Get(2655))) && (mywish.i_afterdays == -1) && (mywish.i_beforedays == -1))
                          {
                              mywish.i_afterdays = (int)oneprogram.StartTime.DayOfWeek;

                              if (mywish.i_afterdays == (int)DayOfWeek.Sunday)
                                  mywish.afterdays = "Sunday";
                              else if (mywish.i_afterdays == (int)DayOfWeek.Monday)
                                  mywish.afterdays = "Monday";
                              else if (mywish.i_afterdays == (int)DayOfWeek.Tuesday)
                                  mywish.afterdays = "Tuesday";
                              else if (mywish.i_afterdays == (int)DayOfWeek.Wednesday)
                                  mywish.afterdays = "Wednesday";
                              else if (mywish.i_afterdays == (int)DayOfWeek.Thursday)
                                  mywish.afterdays = "Thursday";
                              else if (mywish.i_afterdays == (int)DayOfWeek.Friday)
                                  mywish.afterdays = "Friday";
                              else if (mywish.i_afterdays == (int)DayOfWeek.Saturday)
                                  mywish.afterdays = "Saturday";

                              mywish.i_beforedays = (int)oneprogram.StartTime.DayOfWeek;

                              if (mywish.i_beforedays == (int)DayOfWeek.Sunday)
                                  mywish.beforedays = "Sunday";
                              else if (mywish.i_beforedays == (int)DayOfWeek.Monday)
                                  mywish.beforedays = "Monday";
                              else if (mywish.i_beforedays == (int)DayOfWeek.Tuesday)
                                  mywish.beforedays = "Tuesday";
                              else if (mywish.i_beforedays == (int)DayOfWeek.Wednesday)
                                  mywish.beforedays = "Wednesday";
                              else if (mywish.i_beforedays == (int)DayOfWeek.Thursday)
                                  mywish.beforedays = "Thursday";
                              else if (mywish.i_beforedays == (int)DayOfWeek.Friday)
                                  mywish.beforedays = "Friday";
                              else if (mywish.i_beforedays == (int)DayOfWeek.Saturday)
                                  mywish.beforedays = "Saturday";

                              Log.Debug("Locked to day=" + mywish.i_beforedays.ToString());
                          }
                      }
                      catch (Exception exc)
                      {
                          Log.Error("Error in updating lock filter - ex ception:" + exc.Message);
                          languagetext = lng.TranslateString("Fatal error - check the log file", 24);
                          labelmessage(languagetext, PipeCommands.StartEpg); //do not stop - do not flag as error
                          Thread.Sleep(ErrorWaitTime);
                      }
                  }  //end locking condition

              }//end search episode n
          //}

          LogDebug("TvWishList: Autocomplete finished", (int)LogSetting.DEBUG);
          return true;
      }
        public void EpisodeCriteriaDialogEvaluation(TvWish mywish)
        {
            string evaluationstring = "";
            if (mywish.b_episodecriteria_d == true)
            {
                evaluationstring += PluginGuiLocalizeStrings.Get(2960) + "+";  //"Description"
            }
            if (mywish.b_episodecriteria_n == true)
            {
                evaluationstring += PluginGuiLocalizeStrings.Get(2961) + "+";  //"Episode Names"
            }
            if (mywish.b_episodecriteria_c == true)
            {
                evaluationstring += PluginGuiLocalizeStrings.Get(2962) + "+"; //"Episode Numbers"
            }

            if (evaluationstring == "")
            {
                evaluationstring = PluginGuiLocalizeStrings.Get(3264); //None
            }
            else
            {
                evaluationstring = evaluationstring.Substring(0, evaluationstring.Length - 1);
            }

            mywish.episodecriteria = evaluationstring;
            myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish);
        }
示例#14
0
        private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            // set check boxes with initial value in case of added rows as the initialized null value is not recognized
            try
            {
                LogDebug("dataGridView1_RowsAdded  e.RowIndex="+e.RowIndex.ToString(), (int)LogSetting.DEBUG);
                LogDebug("dataGridView1_RowsAdded  e.RowCount=" + e.RowCount.ToString(), (int)LogSetting.DEBUG);
                LogDebug("dataGridView1_RowsAdded  dataGridView1.RowCount=" + dataGridView1.RowCount.ToString(), (int)LogSetting.DEBUG);
                LogDebug("", (int)LogSetting.DEBUG);

               
                //convert defaultdata with language translation
                string[] columndata = (string[])myTvWishes.DefaultValues.Clone();
                TvWish defaultwish = new TvWish();
                defaultwish = myTvWishes.CreateTvWish(true, columndata);
                Log.Debug("defaultwish with Languagetranslation created");
                //myTvWishes.DebugTvWish(defaultwish);


                LoadTvWishToDataGridRow(e.RowIndex - 1, defaultwish);


               /* dataGridView1[(int)TvWishEntries.active, e.RowIndex - 1].Value = true;
                dataGridView1[(int)TvWishEntries.skip, e.RowIndex - 1].Value = true;
                dataGridView1[(int)TvWishEntries.includerecordings, e.RowIndex - 1].Value = false;*/
               
                myTvWishes.MaxTvWishId++;
                dataGridView1[(int)TvWishEntries.tvwishid, e.RowIndex - 1].Value = myTvWishes.MaxTvWishId.ToString();
                
            }
            catch (Exception Exc)
            {
                LogDebug("dataGridView1_RowsAdded exception for e.RowIndex="+e.RowIndex.ToString()+" is: " + Exc.Message, (int)LogSetting.ERROR);
            }
        }
示例#15
0
 public void Add(TvWish newWish)
 {
     //Log.Debug("ADD newWish.name=" + newWish.name);
     TvWishes.Add(newWish);
 }
示例#16
0
        public TvWish CreateTvWish(bool createDefaultData, string[] itemData)
        {
            //Log.Debug("CreateTvWish");
            TvWish mywish = new TvWish();
            int errorCtr = 0;
            try
            {
                //Log.Debug("itemData.Length="+itemData.Length.ToString());
                //Log.Debug("_DefaultValues.Length=" + _DefaultValues.Length.ToString());


                int maxlength=itemData.Length;
                

                string errorMessages = ""; //errormessages will be just stored in log file
                mywish.active = _DefaultValues[0];
                if (maxlength > 0)
                    ConvertString2Bool(itemData[0], ref mywish.active, ref mywish.b_active, "active", ref errorMessages);

                errorCtr++;
                mywish.searchfor = _DefaultValues[1];
                if (maxlength > 1)
                    mywish.searchfor = itemData[1];

                errorCtr++;
                mywish.matchtype = _DefaultValues[2];
                if (maxlength > 2)
                    ConvertString2MatchType(itemData[2], ref mywish.matchtype, ref mywish.b_partialname, ref mywish.b_wordmatch, ref mywish.s_SearchIn, ref errorMessages);

                errorCtr++;
                mywish.group = _DefaultValues[3];
                if (maxlength > 3)
                    mywish.group = itemData[3];

                errorCtr++;
                mywish.recordtype = _DefaultValues[4];
                if (maxlength > 4)
                    mywish.recordtype = itemData[4];

                errorCtr++;
                mywish.action = _DefaultValues[5];
                if (maxlength > 5)
                    ConvertString2Action(itemData[5], ref mywish.action, ref mywish.t_action, ref errorMessages);

                
                //double check for incorrect default data in Email and ViewOnly Mode
                if ((_ViewOnlyMode == true) && (createDefaultData))
                    mywish.action = "View";  //only "view" is allowed
                else if ((_ViewOnlyMode == false) && (createDefaultData))
                {
                    if (mywish.action == "View")
                        mywish.action = "Both";  // "view is not allowed for email and record mode => change to "Both"
                }

                errorCtr++;
                mywish.exclude = _DefaultValues[6];
                if (maxlength > 6)
                    mywish.exclude = itemData[6];

                errorCtr++;
                mywish.viewed = _DefaultValues[7];
                if (maxlength > 7)
                    ConvertString2Int(itemData[7], ref mywish.viewed, ref mywish.i_viewed, 0, 0, _MaxNumber, "viewed", "", 0, ref errorMessages);

                errorCtr++;
                mywish.prerecord = _DefaultValues[8];
                if (maxlength > 8)
                    ConvertString2Int(itemData[8], ref mywish.prerecord, ref mywish.i_prerecord, -1, 0, _MaxNumber, "prerecord", "", 0, ref errorMessages);

                errorCtr++;
                mywish.postrecord = _DefaultValues[9];
                if (maxlength > 9)
                    ConvertString2Int(itemData[9], ref mywish.postrecord, ref mywish.i_postrecord, -1, 0, _MaxNumber, "postrecord", "", 0, ref errorMessages);

                errorCtr++;
                mywish.episodename = _DefaultValues[10];
                if (maxlength > 10)
                    mywish.episodename = itemData[10];

                errorCtr++;
                mywish.episodepart = _DefaultValues[11];
                if (maxlength > 11)
                    mywish.episodepart = itemData[11];

                errorCtr++;
                mywish.episodenumber = _DefaultValues[12];
                if (maxlength > 12)
                    ConvertString2IntExpression(itemData[12], ref mywish.episodenumber, ref mywish.i_episodenumber, -1, 1, _MaxNumber, "EpisodeNumber", "", -1, ref errorMessages);

                errorCtr++;
                mywish.seriesnumber = _DefaultValues[13];
                if (maxlength > 13)
                    ConvertString2IntExpression(itemData[13], ref mywish.seriesnumber, ref mywish.i_seriesnumber, -1, 1, _MaxNumber, "SeriesNumber", "", -1, ref errorMessages);

                errorCtr++;
                mywish.keepepisodes = _DefaultValues[14];
                if (maxlength > 14)
                    ConvertString2Int(itemData[14], ref mywish.keepepisodes, ref mywish.i_keepepisodes, -1, 1, _MaxNumber, "KeepEpisodes", "All", _MaxNumber, ref errorMessages);

                errorCtr++;
                mywish.keepuntil = _DefaultValues[15];
                if (maxlength > 15)
                    ConvertString2KeepUntil(itemData[15], ref mywish.keepuntil, ref mywish.i_keepmethod, ref mywish.i_keepuntil, ref mywish.D_keepuntil, ref errorMessages);

                errorCtr++;

                //Log.Debug("errorCtr=" + errorCtr.ToString());
                //Log.Debug("_DefaultValues[16]=" + _DefaultValues[16]);

                mywish.recommendedcard = _DefaultValues[16];
                if (maxlength > 16)
                {
                    //Log.Debug("AllCards.Count=" + AllCards.Count.ToString());
                    ConvertString2Int(itemData[16], ref mywish.recommendedcard, ref mywish.i_recommendedcard, -1, 1, AllCards.Count, "RecommendedCard", "Any", -1, ref errorMessages);
                }

                errorCtr++;
                //Log.Debug("errorCtr=" + errorCtr.ToString());
                mywish.priority = _DefaultValues[17];
                if (maxlength > 17)
                ConvertString2Int(itemData[17], ref mywish.priority, ref mywish.i_priority, 0, 0, 9, "Priority", "", 0, ref errorMessages);

                errorCtr++;
                mywish.aftertime = _DefaultValues[18];
                if (maxlength > 18)
                    ConvertString2Time(itemData[18], ref mywish.aftertime, ref mywish.i_aftertime, "After Time", ref errorMessages);

                errorCtr++;
                mywish.beforetime = _DefaultValues[19];
                if (maxlength > 19)
                    ConvertString2Time(itemData[19], ref mywish.beforetime, ref mywish.i_beforetime, "Before Time", ref errorMessages);

                errorCtr++;
                mywish.afterdays = _DefaultValues[20];
                if (maxlength > 20)
                    ConvertString2Day(itemData[20], ref mywish.afterdays, ref mywish.i_afterdays, "After Day", ref errorMessages);

                errorCtr++;
                mywish.beforedays = _DefaultValues[21];
                if (maxlength > 21)
                    ConvertString2Day(itemData[21], ref mywish.beforedays, ref mywish.i_beforedays, "Before Day", ref errorMessages);

                errorCtr++;
                mywish.channel = _DefaultValues[22];
                if (maxlength > 22)
                    mywish.channel = itemData[22];

                errorCtr++;
                mywish.skip = _DefaultValues[23];
                if (maxlength > 23)
                    ConvertString2Bool(itemData[23], ref mywish.skip, ref mywish.b_skip, "Skip", ref errorMessages);

                errorCtr++;
                mywish.name = _DefaultValues[24];
                if (maxlength > 24)
                    mywish.name = itemData[24];

                errorCtr++;
                mywish.useFolderName = _DefaultValues[25];
                if (maxlength > 25)
                    ConvertString2UseFolder(itemData[25], ref mywish.useFolderName, ref mywish.b_useFoldername, ref mywish.b_series, ref errorMessages);

                errorCtr++;
                mywish.withinNextHours = _DefaultValues[26];
                if (maxlength > 26)
                    ConvertString2Int(itemData[26], ref mywish.withinNextHours, ref mywish.i_withinNextHours, -1, 1, _MaxNumber, "WithinNextHours", "Any", -1, ref errorMessages);

                errorCtr++;
                mywish.scheduled = _DefaultValues[27];
                if (maxlength > 27)
                    ConvertString2Int(itemData[27], ref mywish.scheduled, ref mywish.i_scheduled, 0, 0, _MaxNumber, "Scheduled", "", 0, ref errorMessages);

                errorCtr++;
                mywish.tvwishid = _DefaultValues[28];
                if (maxlength > 28)
                    mywish.tvwishid = itemData[28];

                //double checking if _MaxTvWishId is screwed up
                try
                {
                    int number = 0;
                    int.TryParse(mywish.tvwishid, out number);
                    if (_MaxTvWishId < number)
                    {
                        Log.Error("Fatal Error: mywish.tvwishid=" + mywish.tvwishid);
                        Log.Error("Fatal Error: _MaxTvWishId=" + _MaxTvWishId.ToString());
                        _MaxTvWishId = number;
                        Log.Error("Resetting _MaxTvWishId to " + _MaxTvWishId.ToString());
                    }
                }
                catch (Exception exc)
                {
                    Log.Error("Could not convert tvwishID to number for " + mywish.tvwishid);
                    Log.Error("Exception " + exc.Message);
                }

                errorCtr++;
                mywish.recorded = _DefaultValues[29];
                if (maxlength > 29)
                    ConvertString2Int(itemData[29], ref mywish.recorded, ref mywish.i_recorded, 0, 0, _MaxNumber, "Recorded", "", 0, ref errorMessages);

                errorCtr++;
                mywish.deleted = _DefaultValues[30];
                if (maxlength > 30)
                    ConvertString2Int(itemData[30], ref mywish.deleted, ref mywish.i_deleted, 0, 0, _MaxNumber, "Deleted", "", 0, ref errorMessages);

                errorCtr++;
                mywish.emailed = _DefaultValues[31];
                if (maxlength > 31)
                    ConvertString2Int(itemData[31], ref mywish.emailed, ref mywish.i_emailed, 0, 0, _MaxNumber, "Emailed", "", 0, ref errorMessages);

                errorCtr++;
                mywish.conflicts = _DefaultValues[32];
                if (maxlength > 32)
                    ConvertString2Int(itemData[32], ref mywish.conflicts, ref mywish.i_conflicts, 0, 0, _MaxNumber, "Conflicts", "", 0, ref errorMessages);

                errorCtr++;
                mywish.episodecriteria = _DefaultValues[33];
                if (maxlength > 33)
                    //ConvertString2EpisodeCriteria(itemData[33], ref mywish.episodecriteria, ref mywish.b_episodecriteria_a, ref mywish.b_episodecriteria_d, ref mywish.b_episodecriteria_p, ref mywish.b_episodecriteria_n, ref mywish.b_episodecriteria_c, ref errorMessages);
                    ConvertString2EpisodeCriteria(itemData[33], ref mywish.episodecriteria,  ref mywish.b_episodecriteria_d, ref mywish.b_episodecriteria_n, ref mywish.b_episodecriteria_c, ref errorMessages);

                errorCtr++;
                mywish.preferredgroup = _DefaultValues[34];
                if (maxlength > 34)
                    mywish.preferredgroup = itemData[34];

                errorCtr++;
                mywish.includeRecordings = _DefaultValues[35];
                if (maxlength > 35)
                    ConvertString2Bool(itemData[35], ref mywish.includeRecordings, ref mywish.b_includeRecordings, "IncludeRecordings", ref errorMessages);
                //modify for listview table changes


                TvWishLanguageTranslation(ref mywish); //must come afte data                
            
                
            }
            catch (Exception exc)
            {
                Log.Error("CreateTvWish: ****** Exception in item " + errorCtr.ToString()+ " - Message is" + exc.Message);
            }
            return mywish;
        }
示例#17
0
 public void ReplaceAtIndex(int index, TvWish newWish)
 {
     TvWishes[index] = newWish;
 }
示例#18
0
        public TvWish CreateTvWishNoCheckingNoTranslation(bool createDefaultData, string[] itemData)
        {
            //Log.Debug("CreateTvWish");
            TvWish mywish = new TvWish();
            int ctr=0;
            try
            {
                Log.Debug("itemData.Length=" + itemData.Length.ToString());
                int maxlength = itemData.Length;
                

                mywish.active = _DefaultValues[0];  
                if (maxlength > 0)
                    mywish.active = itemData[0];
                
                ctr++;
                mywish.searchfor = _DefaultValues[1];  
                if (maxlength > 1)
                    mywish.searchfor = itemData[1];

                ctr++;
                mywish.matchtype = _DefaultValues[2]; 
                if (maxlength > 2)
                    mywish.matchtype = itemData[2];

                ctr++;
                mywish.group = _DefaultValues[3];  
                if (maxlength > 3)
                    mywish.group = itemData[3];

                ctr++;
                mywish.recordtype = _DefaultValues[4];
                if (maxlength > 4)
                    mywish.recordtype = itemData[4];

                ctr++;
                mywish.action = _DefaultValues[5]; 
                if (maxlength > 5)
                    mywish.action = itemData[5];

                ctr++;
                mywish.exclude = _DefaultValues[6];
                if (maxlength > 6)
                    mywish.exclude = itemData[6];

                ctr++;
                mywish.viewed = _DefaultValues[7];
                if (maxlength > 7)
                    mywish.viewed = itemData[7];

                ctr++;
                mywish.prerecord = _DefaultValues[8];
                if (maxlength > 8)
                    mywish.prerecord = itemData[8];
                
                mywish.postrecord = _DefaultValues[9];
                if (maxlength > 9)
                    mywish.postrecord = itemData[9];

                ctr++;
                mywish.episodename = _DefaultValues[10];
                if (maxlength > 10)
                    mywish.episodename = itemData[10];

                ctr++;
                mywish.episodepart = _DefaultValues[11];
                if (maxlength > 11)
                    mywish.episodepart = itemData[11];

                ctr++;
                mywish.episodenumber = _DefaultValues[12];
                if (maxlength > 12)
                    mywish.episodenumber = itemData[12];

                ctr++;
                mywish.seriesnumber = _DefaultValues[13];
                if (maxlength > 13)
                    mywish.seriesnumber = itemData[13];

                mywish.keepepisodes = _DefaultValues[14];
                if (maxlength > 14)
                    mywish.keepepisodes = itemData[14];

                mywish.keepuntil = _DefaultValues[15];
                if (maxlength > 15)
                    mywish.keepuntil = itemData[15];

                ctr++;
                mywish.recommendedcard = _DefaultValues[16];
                if (maxlength > 16)
                    mywish.recommendedcard = itemData[16];
                
                ctr++;
                mywish.priority = _DefaultValues[17];
                if (maxlength > 17)
                    mywish.priority = itemData[17];

                ctr++;
                mywish.aftertime = _DefaultValues[18];
                if (maxlength > 18)
                    mywish.aftertime = itemData[18];

                ctr++;
                mywish.beforetime = _DefaultValues[19];
                if (maxlength > 19)
                    mywish.beforetime = itemData[19];

                ctr++;
                mywish.afterdays = _DefaultValues[20];
                if (maxlength > 20)
                    mywish.afterdays = itemData[20];

                ctr++;
                mywish.beforedays = _DefaultValues[21];
                if (maxlength > 21)
                    mywish.beforedays =itemData[21];

                ctr++;
                mywish.channel = _DefaultValues[22];
                if (maxlength > 22)
                    mywish.channel = itemData[22];
                
                ctr++;
                mywish.skip = _DefaultValues[23];
                if (maxlength > 23)
                    mywish.skip = itemData[23];

                ctr++;
                mywish.name = _DefaultValues[24];
                if (maxlength > 24)
                    mywish.name = itemData[24];

                ctr++;
                mywish.useFolderName = _DefaultValues[25];
                if (maxlength > 25)
                    mywish.useFolderName = itemData[25];

                ctr++;
                mywish.withinNextHours = _DefaultValues[26];
                if (maxlength > 26)
                    mywish.withinNextHours = itemData[26];

                ctr++;
                mywish.scheduled = _DefaultValues[27];
                if (maxlength > 27)
                    mywish.scheduled = itemData[27];

                ctr++;
                mywish.tvwishid = _DefaultValues[28];
                if (maxlength > 28)
                    mywish.tvwishid = itemData[28];

                ctr++;
                mywish.recorded = _DefaultValues[29];
                if (maxlength > 29)
                    mywish.recorded = itemData[29];

                ctr++;
                mywish.deleted = _DefaultValues[30];
                if (maxlength > 30)
                    mywish.deleted = itemData[30];

                ctr++;
                mywish.emailed = _DefaultValues[31];
                if (maxlength > 31)
                    mywish.emailed = itemData[31];

                ctr++;
                mywish.conflicts = _DefaultValues[32];
                if (maxlength > 32)
                    mywish.conflicts = itemData[32];

                ctr++;
                mywish.episodecriteria = _DefaultValues[33];
                if (maxlength > 33)
                    mywish.episodecriteria = itemData[33];

                ctr++;
                mywish.preferredgroup = _DefaultValues[34];
                if (maxlength > 34)
                    mywish.preferredgroup = itemData[34];

                ctr++;
                mywish.includeRecordings = _DefaultValues[35];
                if (maxlength > 35)
                    mywish.includeRecordings = itemData[35];
                //modify for listview table changes

            }
            catch (Exception exc)
            {
                Log.Error("CreateTvWishNoCheckingNoTranslation: ****** Exception for item "+ctr.ToString()+" Message is" + exc.Message);
            }
            return mywish;
        }
示例#19
0
        private void CopySchedulesToTvWishList()
        {
            try
            {
                if (myTvWishes.ViewOnlyMode == true)
                {
                    myTvWishes.MyMessageBox(4305, 4310); //Copy Schedules Works only for Email Mode
                    return;
                }



                Log.Debug("mymessages.ListAllTvMessages().Count=" + mymessages.ListAllTvMessages().Count.ToString());

                mymessages.FilterExistingWishes(myTvWishes.ListAll());

                int count = 0;
                foreach (Schedule mySchedule in Schedule.ListAll())
                {
                    bool found = false;
                    foreach (xmlmessage mymessage in mymessages.ListAllTvMessagesFiltered())
                    {
                        if (mySchedule.ProgramName == mymessage.title)
                        {
                            Log.Debug("found=true mySchedule.ProgramName=" + mySchedule.ProgramName);
                            found = true;
                            break;
                        }
                    }

                    if (found == false)  //do not add if found=true it does exist already in a message
                    {
                        foreach (TvWish mywish in myTvWishes.ListAll())// check in TvWishList if already on
                        {
                            if (mywish.searchfor == mySchedule.ProgramName)
                            {
                                found = true;
                                break;
                            }
                        }
                        if (found == false)//delete schedule and add new TvWish
                        {
                            TvWish newWish = new TvWish();
                            newWish = myTvWishes.DefaultData();
                            newWish.searchfor = mySchedule.ProgramName;
                            newWish.name = mySchedule.ProgramName;
                            newWish.matchtype = PluginGuiLocalizeStrings.Get(2601);  //Exact Title
                            newWish.recordtype = PluginGuiLocalizeStrings.Get(2650);  //One Movie
                            myTvWishes.Add(newWish);
                            mySchedule.Delete();
                            count++;
                            Log.Debug("Moved new schedule to TvWishList title=" + newWish.searchfor);
                        }
                    }
                }

                //Info, Moving Schedules to TvWishList completed and found {0} wishes
                myTvWishes.MyMessageBox(4400, string.Format(PluginGuiLocalizeStrings.Get(1554), count.ToString()));
            }
            catch (Exception exc)
            {
                myTvWishes.MyMessageBox(4305, 1555); //Moving Schedules to TvWishList failed
                Log.Debug("Error in More Case 8 - Exception:" + exc.Message);
            }
        }
示例#20
0
        public void LoadFromStringNoChecking(string listviewdata, bool allowsamename)
        {
            Log.Debug("LoadFromStringNoChecking: listviewdata=" + listviewdata);

            string[] rowdata = listviewdata.Split('\n');
            foreach (string row in rowdata)
            {
                
                string[] columndata = row.Split(TvWishItemSeparator);
                Log.Debug("columndata.Length=" + columndata.Length.ToString());
                if (columndata.Length > 5)//avoid dummy rows
                {
                    
                    try
                    {
                        TvWish mywish = new TvWish();
                        mywish = CreateTvWish(false, columndata);

                        //check for same name in list already
                        if (allowsamename == false)
                        {
                            foreach (TvWish testwish in TvWishes)
                            {
                                if (testwish.name == mywish.name)
                                {
                                    Log.Debug("Repeated name " + testwish.name + " found and skipped row");
                                    continue;
                                }
                            }
                        }


                        //check for valid search criteria
                        if ((mywish.searchfor != "") || (mywish.name != "") || (mywish.episodename != "") || (mywish.episodepart != "") || (mywish.episodenumber != "") || (mywish.seriesnumber != "") || (_validSearchCriteria == false))
                        {

                            Add(mywish);
                            DebugTvWish(mywish);                            
                        }
                    }
                    catch (Exception exc)
                    {
                        Log.Error("[TVWishListMP]:TvserverdatabaseLoadSettings: ****** Exception " + exc.Message);
                        Log.Error("[TVWishListMP]:TvserverdatabaseLoadSettings:row=" + row);
                    }
                }
            }
        }
示例#21
0
        private string SaveDefaultFormatsToString()
        {
            //store default formats
            if (Defaultformat_select >= 0)
            {
                Log.Debug("Save: Defaultformat_select=" + Defaultformat_select.ToString());
                Array_Defaultformats[Defaultformat_select] = textBoxDefaultFormats.Text;  // store last selected element
            }

            //SavePart DefaultFormats
            string[] userCountryDefaultsComplete = TvWishArray2Defaults(Array_Defaultformats);  //complete user default Formats array in country language from screen
            string userCountryDefaultsCompleteString = SaveToStringNoLngTranslation(userCountryDefaultsComplete); //complete user default Formats string in country language from screen
            Log.Debug("SaveSettings(): userCountryDefaultsCompleteString=" + userCountryDefaultsCompleteString);
            TvWish usercountrywish = new TvWish();
            usercountrywish = myTvWishes.CreateTvWishNoCheckingNoTranslation(true, userCountryDefaultsCompleteString.Split(TvWishItemSeparator));  //user default tvwish in country language, because input has full array size                    
            Log.Debug("userEnglishwish before translation");
            myTvWishes.DebugTvWish(usercountrywish);
            usercountrywish.tvwishid = "1";
            string userEnglishDefaultsCompleteString = myTvWishes.SaveToString(ref usercountrywish); //complete default user string in english (includes reverse language translation to string)
            Log.Debug("SaveSettings(): userEnglishDefaultsCompleteString=" + userEnglishDefaultsCompleteString);
            string defaultformats = myTvWishes.CheckRowEntries(userEnglishDefaultsCompleteString, TvWishItemSeparator); //complete default user string in english and checked                   
            Log.Debug("Save: after checking defaultformats=" + defaultformats);
            return defaultformats;
        }
示例#22
0
        public void MyLoadSettings()
        {
            
            LogDebug("Loadsettings started", (int)LogSetting.DEBUG);
            TvBusinessLayer layer = new TvBusinessLayer();
            Setting setting;

            try
            {
                
                setting = layer.GetSetting("TvWishList_SkipDeleted", "false");
                if (BoolConversion(setting.Value,false))
                    checkBoxSkipDeleted.Checked = true;
                else
                    checkBoxSkipDeleted.Checked = false;

                setting = layer.GetSetting("TvWishList_EmailReply", "true");
                if (BoolConversion(setting.Value, true))
                    checkBoxemailreply.Checked = true;
                else
                    checkBoxemailreply.Checked = false;


                setting = layer.GetSetting("TvWishList_Schedule", "true");
                if (BoolConversion(setting.Value, true))
                    checkBoxschedule.Checked = true;
                else
                    checkBoxschedule.Checked = false;

                setting = layer.GetSetting("TvWishList_ScheduleConflicts", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxscheduleconflicts.Checked = true;
                else
                    checkBoxscheduleconflicts.Checked = false;

                setting = layer.GetSetting("TvWishList_EmailOnlyNew", "true");
                if (BoolConversion(setting.Value, true))
                    checkBoxEmailOnlynew.Checked = true;
                else
                    checkBoxEmailOnlynew.Checked = false;

                setting = layer.GetSetting("TvWishList_SlowCPU", "true");
                if (BoolConversion(setting.Value, true))
                    checkBoxSlowCPU.Checked = true;
                else
                    checkBoxSlowCPU.Checked = false;

                setting = layer.GetSetting("TvWishList_Monday", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxMon.Checked = true;
                else
                    checkBoxMon.Checked = false;

                setting = layer.GetSetting("TvWishList_Tuesday", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxTue.Checked = true;
                else
                    checkBoxTue.Checked = false;

                setting = layer.GetSetting("TvWishList_Wednesday", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxWed.Checked = true;
                else
                    checkBoxWed.Checked = false;

                setting = layer.GetSetting("TvWishList_Thursday", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxThur.Checked = true;
                else
                    checkBoxThur.Checked = false;

                setting = layer.GetSetting("TvWishList_Friday", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxFri.Checked = true;
                else
                    checkBoxFri.Checked = false;

                setting = layer.GetSetting("TvWishList_Saturday", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxSat.Checked = true;
                else
                    checkBoxSat.Checked = false;

                setting = layer.GetSetting("TvWishList_Sunday", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxSun.Checked = true;
                else
                    checkBoxSun.Checked = false;

                setting = layer.GetSetting("TvWishList_Every", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxEvery.Checked = true;
                else
                    checkBoxEvery.Checked = false;

                setting = layer.GetSetting("TvWishList_DeleteTimeChanges", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxDeleteChangedEPG.Checked = true;
                else
                    checkBoxDeleteChangedEPG.Checked = false;

                setting = layer.GetSetting("TvWishList_FilterEmail", "true");
                if (BoolConversion(setting.Value, true))
                    checkBoxFilterEmail.Checked = true;
                else
                    checkBoxFilterEmail.Checked = false;

                setting = layer.GetSetting("TvWishList_FilterRecord", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxFilterRecord.Checked = true;
                else
                    checkBoxFilterRecord.Checked = false;

                setting = layer.GetSetting("TvWishList_FilterConflicts", "true");
                if (BoolConversion(setting.Value, true))
                    checkBoxFilterConflicts.Checked = true;
                else
                    checkBoxFilterConflicts.Checked = false;

                setting = layer.GetSetting("TvWishList_DescendingSort", "false");
                if (BoolConversion(setting.Value, false))
                    checkBoxdescendingSort.Checked = true;
                else
                    checkBoxdescendingSort.Checked = false;

                setting = layer.GetSetting("TvWishList_Easy", "true");
                if (BoolConversion(setting.Value, true))
                {
                    radioButtonEasy.Checked = true;
                }

                setting = layer.GetSetting("TvWishList_Expert", "false");
                if (BoolConversion(setting.Value, false))
                {
                    radioButtonExpert.Checked = true;
                }

                LogDebug("TvWishList_Expert=" + radioButtonExpert.Checked.ToString(), (int)LogSetting.DEBUG);

                setting = layer.GetSetting("TvWishList_DateTimeFormat", "{1:00}/{2:00} at {3:00}:{4:00}");
                textBoxDateTimeFormat.Text = setting.Value;
                //LogDebug("TvWishList_DateTimeFormat=" + setting.Value, (int)LogSetting.DEBUG);

                textBoxEmailFormat.Text = myTvWishes.loadlongsettings("TvWishList_EmailFormat");

                setting = layer.GetSetting("TvWishList_Sort", "Start");
                Log.Debug("TvWishList_Sort=" + setting.Value);
                comboBoxSortCriteria.Text = SortCriteriaTranslation(setting.Value);
                
                
                setting = layer.GetSetting("TvWishList_EpgMarker", "");
                textBoxEpgMark.Text = setting.Value;
                
                setting = layer.GetSetting("TvWishList_LanguageFile", "strings_en.xml");
                comboBoxLanguage.Text = LanguageFileTranslation(setting.Value);
                Log.Debug("TvWishList_LanguageFile="+setting.Value);
                
                setting = layer.GetSetting("TvWishList_UserName", "");
                TextBoxUserName.Text = setting.Value;
                
                setting = layer.GetSetting("TvWishList_Password", "");
                TextBoxPassword.Text = setting.Value;
                TextBoxPassword2.Text = setting.Value;
                
                setting = layer.GetSetting("TvWishList_TestReceiver", "");
                TextBoxTestReceiver.Text = setting.Value;
                
                setting = layer.GetSetting("TvWishList_SmtpEmailAddress", "");
                textBoxSmtpEmailAdress.Text = setting.Value;
                
                if (textBoxSmtpEmailAdress.Text == "")
                {
                    textBoxSmtpEmailAdress.Text = TextBoxUserName.Text;
                }
                //combobox
                
                setting = layer.GetSetting("TvWishList_WaitComSkipMinutes", "60");
                try
                {
                    int i = Convert.ToInt32(setting.Value);
                    comboBoxComSkipWaitMinutes.Text = setting.Value;
                }
                catch
                {
                    comboBoxComSkipWaitMinutes.Text = "60";
                }
                
                setting = layer.GetSetting("TvWishList_CheckEpgDays", "07");
                comboBoxdays.Text = setting.Value;
                //checkcombotextbox(ref ComboBox mycombobox,string format,int min, int max, string fieldname);
                checkcombotextbox(ref comboBoxdays, "D2", 1, 14, "Days");
                
                setting = layer.GetSetting("TvWishList_CheckEpgHours", "06");
                comboBoxhours.Text = setting.Value;
                //checkcombotextbox(ref ComboBox mycombobox,string format,int min, int max, string fieldname);
                checkcombotextbox(ref comboBoxhours, "D2", 0, 23, "Hours");
                
                setting = layer.GetSetting("TvWishList_CheckEpgMinutes", "00");
                comboBoxminutes.Text = setting.Value;
                //checkcombotextbox(ref ComboBox mycombobox,string format,int min, int max, string fieldname);
                checkcombotextbox(ref comboBoxminutes, "D2", 0, 59, "Minutes");
                
                setting = layer.GetSetting("TvWishList_BeforeEPGMinutes", "00");
                comboBoxScheduleMinutes.Text = setting.Value;
                //checkcombotextbox(ref ComboBox mycombobox,string format,int min, int max, string fieldname);
                checkcombotextbox(ref comboBoxScheduleMinutes, "D2", 0, 59, "Minutes");
                
                setting = layer.GetSetting("TvWishList_CheckEPGScheduleMinutes", "false");
                //Log.Debug("TvWishList_CheckEPGScheduleMinutes"+setting.Value);
                try
                {
                    checkBoxScheduleMinutes.Checked = Convert.ToBoolean(setting.Value);
                }
                catch
                {
                    checkBoxScheduleMinutes.Checked = false;
                }
                               
                try
                {
                    setting = layer.GetSetting("TvWishList_ChannelGroups", "Any");
                    comboBoxGroups.Text = setting.Value;
                }
                catch
                {
                    comboBoxGroups.Text = "Any";
                }
                
                //maxfound
                setting = layer.GetSetting("TvWishList_MaxFound", "100");
                comboBoxmaxfound.Text = setting.Value;
                //checkcombotextbox(ref ComboBox mycombobox,string format,int min, int max, string fieldname);
                checkcombotextbox(ref comboBoxmaxfound, "", 1, 1000000000, "Max Found");

                setting = layer.GetSetting("TvWishList_MaxTvWishId", "0");
                int maxTvWishId = 0;
                int.TryParse(setting.Value, out maxTvWishId);

                myTvWishes.MaxTvWishId = maxTvWishId;
                LogDebug("LoadSettings: MaxTvWishId=" + myTvWishes.MaxTvWishId.ToString(), (int)LogSetting.DEBUG);

                setting = layer.GetSetting("TvWishList_DeleteExpiration", "12");
                comboBoxDeleteExpiration.Text = setting.Value;      
                

                //initialize messages
                string messagedata = "";
                //mymessage = new XmlMessages(mymessage.date_time_format, mymessage.EmailFormat, DEBUG);                
                messagedata = myTvWishes.loadlongsettings("TvWishList_ListViewMessages");                
                mymessage.readxmlfile(messagedata, false);
                Log.Debug(mymessage.ListAllTvMessages().Count.ToString()+" messages read");

                

                setting = layer.GetSetting("TvWishList_ColumnSeparator", ";");
                TV_WISH_COLUMN_SEPARATOR = setting.Value[0];

                //default pre and post record from general recording settings
                setting = layer.GetSetting("preRecordInterval", "5");
                PRERECORD = setting.Value;
                setting = layer.GetSetting("postRecordInterval", "5");
                POSTRECORD = setting.Value;

                //initialize tvserver settings in TvWish for checking of channels
                myTvWishes.TvServerSettings(PRERECORD, POSTRECORD, ChannelGroup.ListAll(), RadioChannelGroup.ListAll(), Channel.ListAll(), Card.ListAll(), TV_WISH_COLUMN_SEPARATOR);


                //listviewdata
                //Log.Debug("Turnuing off eventhandler for adding rows");
                //dataGridView1.RowsAdded -= new DataGridViewRowsAddedEventHandler(dataGridView1_RowsAdded);


                DataGridViewComboBoxColumn channelfilter = dataGridView1.Columns[22] as DataGridViewComboBoxColumn;
                string addnames = ";";
                for (int i = 0; i < channelfilter.Items.Count; i++)
                {
                    addnames += channelfilter.Items[i] + ";" as String;
                }

                //convert defaultdata with language translation
                string[] columndata = (string[])myTvWishes.DefaultValues.Clone();
                TvWish defaultwish = new TvWish();
                defaultwish = myTvWishes.CreateTvWish(true, columndata);
                //Log.Debug("defaultwish with Languagetranslation");
                myTvWishes.DebugTvWish(defaultwish);

               

                //define nullvalues for datagrid with language translation
                DataGridViewCheckBoxColumn active = dataGridView1.Columns[(int)TvWishEntries.active] as DataGridViewCheckBoxColumn;
                active.DefaultCellStyle.NullValue = defaultwish.b_active;
                DataGridViewCheckBoxColumn skip = dataGridView1.Columns[(int)TvWishEntries.skip] as DataGridViewCheckBoxColumn;
                skip.DefaultCellStyle.NullValue = defaultwish.b_skip;
                DataGridViewCheckBoxColumn includerecordings = dataGridView1.Columns[(int)TvWishEntries.includerecordings] as DataGridViewCheckBoxColumn;
                includerecordings.DefaultCellStyle.NullValue = defaultwish.b_includeRecordings;
                DataGridViewTextBoxColumn searchfor = dataGridView1.Columns[(int)TvWishEntries.searchfor] as DataGridViewTextBoxColumn;
                searchfor.DefaultCellStyle.NullValue = defaultwish.searchfor;
                DataGridViewComboBoxColumn matchtype = dataGridView1.Columns[(int)TvWishEntries.matchtype] as DataGridViewComboBoxColumn;
                matchtype.DefaultCellStyle.NullValue = defaultwish.matchtype;
                DataGridViewComboBoxColumn group = dataGridView1.Columns[(int)TvWishEntries.group] as DataGridViewComboBoxColumn;
                group.DefaultCellStyle.NullValue = defaultwish.group;
                DataGridViewComboBoxColumn recordtype = dataGridView1.Columns[(int)TvWishEntries.recordtype] as DataGridViewComboBoxColumn;
                recordtype.DefaultCellStyle.NullValue = defaultwish.recordtype;
                DataGridViewComboBoxColumn action = dataGridView1.Columns[(int)TvWishEntries.action] as DataGridViewComboBoxColumn;
                action.DefaultCellStyle.NullValue = defaultwish.action;
                DataGridViewTextBoxColumn exclude = dataGridView1.Columns[(int)TvWishEntries.exclude] as DataGridViewTextBoxColumn;
                exclude.DefaultCellStyle.NullValue = defaultwish.exclude;
                DataGridViewTextBoxColumn prerecord = dataGridView1.Columns[(int)TvWishEntries.prerecord] as DataGridViewTextBoxColumn;
                prerecord.DefaultCellStyle.NullValue = defaultwish.prerecord;
                DataGridViewTextBoxColumn postrecord = dataGridView1.Columns[(int)TvWishEntries.postrecord] as DataGridViewTextBoxColumn;
                postrecord.DefaultCellStyle.NullValue = defaultwish.postrecord;
                DataGridViewTextBoxColumn episodename = dataGridView1.Columns[(int)TvWishEntries.episodename] as DataGridViewTextBoxColumn;
                episodename.DefaultCellStyle.NullValue = defaultwish.episodename;
                DataGridViewTextBoxColumn episodepart = dataGridView1.Columns[(int)TvWishEntries.episodepart] as DataGridViewTextBoxColumn;
                episodepart.DefaultCellStyle.NullValue = defaultwish.episodepart;
                DataGridViewTextBoxColumn episodenumber = dataGridView1.Columns[(int)TvWishEntries.episodenumber] as DataGridViewTextBoxColumn;
                episodenumber.DefaultCellStyle.NullValue = defaultwish.episodenumber;
                DataGridViewTextBoxColumn seriesnumber = dataGridView1.Columns[(int)TvWishEntries.seriesnumber] as DataGridViewTextBoxColumn;
                seriesnumber.DefaultCellStyle.NullValue = defaultwish.seriesnumber;
                DataGridViewTextBoxColumn keepepisodes = dataGridView1.Columns[(int)TvWishEntries.keepepisodes] as DataGridViewTextBoxColumn;
                keepepisodes.DefaultCellStyle.NullValue = defaultwish.keepepisodes;
                DataGridViewTextBoxColumn keepuntil = dataGridView1.Columns[(int)TvWishEntries.keepuntil] as DataGridViewTextBoxColumn;
                keepuntil.DefaultCellStyle.NullValue = defaultwish.keepuntil;
                DataGridViewComboBoxColumn recommendedcard = dataGridView1.Columns[(int)TvWishEntries.recommendedcard] as DataGridViewComboBoxColumn;
                recommendedcard.DefaultCellStyle.NullValue = defaultwish.recommendedcard;
                DataGridViewComboBoxColumn priority = dataGridView1.Columns[(int)TvWishEntries.priority] as DataGridViewComboBoxColumn;
                priority.DefaultCellStyle.NullValue = defaultwish.priority;
                DataGridViewTextBoxColumn aftertime = dataGridView1.Columns[(int)TvWishEntries.aftertime] as DataGridViewTextBoxColumn;
                aftertime.DefaultCellStyle.NullValue = defaultwish.aftertime;
                DataGridViewTextBoxColumn beforetime = dataGridView1.Columns[(int)TvWishEntries.beforetime] as DataGridViewTextBoxColumn;
                beforetime.DefaultCellStyle.NullValue = defaultwish.beforetime;
                DataGridViewComboBoxColumn afterdays = dataGridView1.Columns[(int)TvWishEntries.afterdays] as DataGridViewComboBoxColumn;
                afterdays.DefaultCellStyle.NullValue = defaultwish.afterdays;
                DataGridViewComboBoxColumn beforedays = dataGridView1.Columns[(int)TvWishEntries.beforedays] as DataGridViewComboBoxColumn;
                beforedays.DefaultCellStyle.NullValue = defaultwish.beforedays;
                DataGridViewComboBoxColumn channel = dataGridView1.Columns[(int)TvWishEntries.channel] as DataGridViewComboBoxColumn;
                channel.DefaultCellStyle.NullValue = defaultwish.channel;
                DataGridViewTextBoxColumn name = dataGridView1.Columns[(int)TvWishEntries.name] as DataGridViewTextBoxColumn;
                name.DefaultCellStyle.NullValue = defaultwish.name;
                DataGridViewComboBoxColumn useFolderName = dataGridView1.Columns[(int)TvWishEntries.useFolderName] as DataGridViewComboBoxColumn;
                useFolderName.DefaultCellStyle.NullValue = defaultwish.useFolderName;
                DataGridViewTextBoxColumn withinNextHours = dataGridView1.Columns[(int)TvWishEntries.withinNextHours] as DataGridViewTextBoxColumn;
                withinNextHours.DefaultCellStyle.NullValue = defaultwish.withinNextHours;
                DataGridViewComboBoxColumn episodecriteria = dataGridView1.Columns[(int)TvWishEntries.episodecriteria] as DataGridViewComboBoxColumn;
                episodecriteria.DefaultCellStyle.NullValue = defaultwish.episodecriteria;
                DataGridViewComboBoxColumn preferredgroup = dataGridView1.Columns[(int)TvWishEntries.preferredgroup] as DataGridViewComboBoxColumn;
                preferredgroup.DefaultCellStyle.NullValue = defaultwish.preferredgroup;
                
               
                //load all tvwishes
                string listviewdata = myTvWishes.loadlongsettings("TvWishList_ListView");
                LogDebug("liestview=" + listviewdata, (int)LogSetting.DEBUG);
                myTvWishes.LoadFromString(listviewdata, true); //needed for later checking in savesettings()

                //fill datagridview
                LogDebug("initial datagrid rowcount=" + dataGridView1.Rows.Count.ToString(), (int)LogSetting.DEBUG);
                
                int newrow = dataGridView1.Rows.Count - 1;
                if (newrow == 0) //fill only the first time, datagrid is being remembered
                {
                    Log.Debug("myTvWishes.ListAll().Count="+myTvWishes.ListAll().Count.ToString());
                    foreach (TvWish mywish in myTvWishes.ListAll())
                    {
                        newrow = dataGridView1.Rows.Count - 1;
                        Log.Debug("searchfor" + mywish.searchfor);
                        Log.Debug("newrow=" + newrow.ToString());

                        if (addnames.Contains(";" + mywish.channel + ";") == false)//add new channel names
                        {
                            channelfilter.Items.Add(mywish.channel);
                            addnames += mywish.channel + ";";
                            //LogDebug("loadsetting addnames: " + addnames, (int)LogSetting.DEBUG);
                        }


                        LoadTvWishToDataGridRow(newrow, mywish);

                    }
                    Log.Debug(myTvWishes.ListAll().Count.ToString()+" Tvwishes added");
                }//end fill datagrid

                updatechannelnames();

                //dataGridView1.RowsAdded += new DataGridViewRowsAddedEventHandler(dataGridView1_RowsAdded);
                //Log.Debug("Turnuing on eventhandler for adding rows");

                //end listviewdata

                //load providervalues
                setdefaultproviders(false);

                //load last settings and store it in providerstring [0]
                setting = layer.GetSetting("TvWishList_Providers_0", "_Last Setting;;0;False");
                providers[0] = setting.Value;
                //LogDebug("Load settings: provider_0=" + providers[0]);
                
                try
                {
                    translateprovider(providers[0]);  //restore last user settings providers[0]
                }
                catch
                {
                    LogDebug("translateprovider(providers[0]= " + providers[0] + " failed", (int)LogSetting.DEBUG);
                }
                

                //labels
                DateTime NextEpgDate = DateTime.Now;
                setting = layer.GetSetting("TvWishList_NextEpgDate", DateTime.Now.ToString("yyyy-MM-dd_HH:mm", System.Globalization.CultureInfo.InvariantCulture));
                try
                {
                    NextEpgDate = DateTime.ParseExact(setting.Value, "yyyy-MM-dd_HH:mm", System.Globalization.CultureInfo.InvariantCulture);
                }
                catch (Exception exc)
                {
                    LogDebug("NextEpgDate failed with exception: " + exc.Message, (int)LogSetting.ERROR);
                }

                Log.Debug("FormatConversion:");
                string mydate = NextEpgDate.ToString(lng.TranslateString(@"MM/dd/yyyy", 189), System.Globalization.CultureInfo.InvariantCulture);
                Log.Debug("mydate=" + mydate);
                string mytime = NextEpgDate.ToString(lng.TranslateString(@"HH:mm", 190), System.Globalization.CultureInfo.InvariantCulture);
                Log.Debug("mytime=" + mytime);
                labelCheckingdate.Text = lng.TranslateString("{0} at {1}",191,mydate,mytime);
                Log.Debug("labelCheckingdate.Text" + labelCheckingdate.Text);
                
                //integer values
                setting = layer.GetSetting("TvWishList_ProviderSelected", "0");
                int j = 0;
                int.TryParse(setting.Value, out j);
                if ((j < 0) || (j > listBoxProvider2.Items.Count))
                {
                    j = 0;
                }
                try
                {
                    listBoxProvider2.SetSelected(0, true);   //select custom item in listbox
                }
                catch (Exception exc)
                {
                    LogDebug("listBoxProvider2.SetSelected failed with exception: " + exc.Message, (int)LogSetting.ERROR);
                }

                LogDebug("LoadSettings Completed", (int)LogSetting.DEBUG);
                LoadSettingError = false;
            }
            catch (Exception exc)
            {
                LogDebug("LoadSettings Error: Exception: "+exc.Message, (int)LogSetting.ERROR);
                LoadSettingError = true;
            }

            
        }