Changeset 23962


Ignore:
Timestamp:
09/28/13 10:10:16 (9 years ago)
Author:
nit
Message:

[titan] extend epgsearch with genre search and only aktual epg search

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/epgsearch.h

    r19490 r23962  
    22#define EPGSEARCH_H
    33
    4 int searchepg(char* search, int searchtype, struct skin* epgsearch, struct skin* listbox)
     4int searchepg(char* search, char* search1, char* search2, int searchtype, struct skin* epgsearch, struct skin* listbox)
    55{
     6        int allepg = 1, count = 0;
    67        char* result = NULL, *epgdesc = NULL, *tmpstr = NULL;
    78        char* buf = NULL;
     
    1011        struct skin* tmp = NULL;
    1112        struct tm *loctime = NULL;
     13        time_t akttime = time(NULL) + 10800;
    1214 
    1315        if(search == NULL || strlen(search) < 2) return 1;
     
    2224                return 1;
    2325        }
     26       
     27        if(textbox(_("Message"), _("Search only aktual epg ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1)
     28                allepg = 0;
    2429
    2530        while(chnode != NULL)
     
    2833                while(epgnode != NULL)
    2934                {
     35                        if(allepg == 0 && epgnode->starttime > akttime) break;
     36               
    3037                        result = NULL;
    31                         if(searchtype == 0 || searchtype == 2)
     38                        count = 0;
     39                       
     40start:
     41                        if(searchtype == 0 || searchtype == 2 || searchtype == 3)
    3242                        {
    3343                                if(epgnode->title != NULL)
    3444                                        result = ostrstrcase(epgnode->title, search);
    3545                        }
    36                         if((searchtype == 1 || searchtype == 2) && result == NULL)
     46                        if(searchtype == 3 && result == NULL)
     47                        {
     48                                if(epgnode->subtitle != NULL)
     49                                        result = ostrstrcase(epgnode->subtitle, search);
     50                        }
     51                        if((searchtype == 1 || searchtype == 2 || searchtype == 3) && result == NULL)
    3752                        {
    3853                                epgdesc = epgdescunzip(epgnode);
     
    4358                                }
    4459                        }
     60                       
     61                        if(result == NULL && count == 0 && search1 != NULL && ostrcmp(search, search1) != 0)
     62                        {
     63                                count = 1;
     64                                search = search1;
     65                                goto start;
     66                        }
     67                       
     68                        if(result == NULL && count == 1 && search2 != NULL)
     69                        {
     70                                count = 2;
     71                                search = search2;
     72                                goto start;
     73                        }
     74                       
    4575                        if(result != NULL)
    4676                        {
     
    85115void screenepgsearch(char* text)
    86116{
    87         int rcret = -1, ret = 0;
     117        int rcret = -1, ret = 0, genre = 0;
    88118        struct skin* epgsearch = getscreen("epgsearch");
    89119        struct skin* listbox = getscreennode(epgsearch, "listbox");
    90120        char* search = NULL;
     121        struct skin* tmp = NULL;
    91122
    92123        if(text != NULL)
    93124        {
    94125                delmarkedscreennodes(epgsearch, 1);
    95                 searchepg(text, 0, epgsearch, listbox);
     126                searchepg(text, NULL, NULL, 0, epgsearch, listbox);
    96127        }
    97128
     
    111142                        if(listbox->select != NULL)
    112143                        {
    113                                 servicecheckret(servicestart((struct channel*)listbox->select->handle, NULL, NULL, 0), 0);
     144                                if(genre == 0)
     145                                        servicecheckret(servicestart((struct channel*)listbox->select->handle, NULL, NULL, 0), 0);
     146                                else
     147                                {
     148                                        genre = 0;
     149                                  delmarkedscreennodes(epgsearch, 1);
     150                                  searchepg(listbox->select->text, listbox->select->handle, listbox->select->handle1, 3, epgsearch, listbox);
     151                                }
    114152                        }
    115153                        break;
     
    118156                if(rcret == getrcconfigint("rcred", NULL))
    119157                {
    120                         if(listbox->select != NULL)
     158                        if(listbox->select != NULL && genre == 0)
    121159                        {
    122160                                ret = addrecepg((struct channel*)listbox->select->handle, (struct epg*)listbox->select->handle1, NULL);
     
    131169                        if(search != NULL)
    132170                        {
     171                                genre = 0;
    133172                                delmarkedscreennodes(epgsearch, 1);
    134                                 searchepg(search, 0, epgsearch, listbox);
     173                                searchepg(search, NULL, NULL, 0, epgsearch, listbox);
    135174                                free(search); search = NULL;
    136175                        }
     
    144183                        if(search != NULL)
    145184                        {
     185                                genre = 0;
    146186                                delmarkedscreennodes(epgsearch, 1);
    147                                 searchepg(search, 1, epgsearch, listbox);
     187                                searchepg(search, NULL, NULL, 1, epgsearch, listbox);
    148188                                free(search); search = NULL;
    149189                        }
     
    157197                        if(search != NULL)
    158198                        {
     199                                genre = 0;
    159200                                delmarkedscreennodes(epgsearch, 1);
    160                                 searchepg(search, 2, epgsearch, listbox);
     201                                searchepg(search, NULL, NULL, 2, epgsearch, listbox);
    161202                                free(search); search = NULL;
    162203                        }
     204                        drawscreen(epgsearch, 0, 0);
     205                        continue;
     206                }
     207               
     208                if(rcret == getrcconfigint("rcmenu", NULL))
     209                {
     210                        genre = 1;
     211                        delmarkedscreennodes(epgsearch, 1);
     212                       
     213                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     214                        if(tmp != NULL)
     215                        {
     216                                changetext(tmp, _("Action"));
     217                                tmp->handle = "Action";
     218                                tmp->handle1 = NULL;
     219                        }
     220                       
     221                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     222                        if(tmp != NULL)
     223                        {
     224                                changetext(tmp, _("Animation"));
     225                                tmp->handle = "Animation";
     226                                tmp->handle1 = NULL;
     227                        }
     228                       
     229                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     230                        if(tmp != NULL)
     231                        {
     232                                changetext(tmp, _("History"));
     233                                tmp->handle = "History";
     234                                tmp->handle1 = NULL;
     235                        }
     236                       
     237                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     238                        if(tmp != NULL)
     239                        {
     240                                changetext(tmp, _("Doku"));
     241                                tmp->handle = "Doku";
     242                                tmp->handle1 = NULL;
     243                        }
     244                       
     245                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     246                        if(tmp != NULL)
     247                        {
     248                                changetext(tmp, _("Thriller"));
     249                                tmp->handle = "Thriller";
     250                                tmp->handle1 = NULL;
     251                        }
     252                       
     253                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     254                        if(tmp != NULL)
     255                        {
     256                                changetext(tmp, _("Child"));
     257                                tmp->handle = "Child";
     258                                tmp->handle1 = NULL;
     259                        }
     260                       
     261                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     262                        if(tmp != NULL)
     263                        {
     264                                changetext(tmp, _("Fantasy"));
     265                                tmp->handle = "Fantasy";
     266                                tmp->handle1 = NULL;
     267                        }
     268                       
     269                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     270                        if(tmp != NULL)
     271                        {
     272                                changetext(tmp, _("Horror"));
     273                                tmp->handle = "Horror";
     274                                tmp->handle1 = NULL;
     275                        }
     276                       
     277                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     278                        if(tmp != NULL)
     279                        {
     280                                changetext(tmp, _("Comedy"));
     281                                tmp->handle = "Comedy";
     282                                tmp->handle1 = NULL;
     283                        }
     284                       
     285                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     286                        if(tmp != NULL)
     287                        {
     288                                changetext(tmp, _("War"));
     289                                tmp->handle = "War";
     290                                tmp->handle1 = NULL;
     291                        }
     292                       
     293                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     294                        if(tmp != NULL)
     295                        {
     296                                changetext(tmp, _("Scifi"));
     297                                tmp->handle = "Scifi";
     298                                tmp->handle1 = "Fiction";
     299                        }
     300                       
     301                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     302                        if(tmp != NULL)
     303                        {
     304                                changetext(tmp, _("Sport"));
     305                                tmp->handle = "Sport";
     306                                tmp->handle1 = NULL;
     307                        }
     308                       
     309                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     310                        if(tmp != NULL)
     311                        {
     312                                changetext(tmp, _("Western"));
     313                                tmp->handle = "Western";
     314                                tmp->handle1 = NULL;
     315                        }
     316                       
     317                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     318                        if(tmp != NULL)
     319                        {
     320                                changetext(tmp, _("Eastern"));
     321                                tmp->handle = "Eastern";
     322                                tmp->handle1 = NULL;
     323                        }
     324                       
     325                        tmp = addlistbox(epgsearch, listbox, tmp, 1);
     326                        if(tmp != NULL)
     327                        {
     328                                changetext(tmp, _("Music"));
     329                                tmp->handle = "Music";
     330                                tmp->handle1 = NULL;
     331                        }
     332                       
    163333                        drawscreen(epgsearch, 0, 0);
    164334                        continue;
Note: See TracChangeset for help on using the changeset viewer.