Changeset 19891


Ignore:
Timestamp:
02/01/13 20:53:50 (11 years ago)
Author:
obi
Message:

fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/tithek/tithek.h

    r19889 r19891  
    672672                gethttpreal(node->host, node->page, node->port, node->filename, node->auth, NULL, 0, NULL, NULL, node->timeout, 0);
    673673
    674                 if(flag == NULL)
    675                 {
    676                         if(tithekrun == 0)
     674                if(tithekrun == 0)
     675                        unlink(node->filename);
     676                else
     677                {
     678                        //check file size
     679                        off64_t checkpic = getfilesize(node->filename);
     680                        if(checkpic < 1000) defpic = 1;
     681
     682                        //check file is gif or html
     683                        if(defpic == 0)
     684                        {
     685                                char* tmp = NULL;
     686                                tmp = readbintomem(node->filename, 3);
     687                                if(ostrcmp("GIF", tmp) == 0) defpic = 1; //gif
     688                                if(ostrcmp("<", tmp) == 0) defpic = 1; //html
     689                                free(tmp); tmp = NULL;
     690                        }
     691
     692                        if(defpic == 1)
     693                        {
     694                                m_lock(&status.tithekmutex, 20);
    677695                                unlink(node->filename);
    678                         else
    679                         {
    680                                 //check file size
    681                                 off64_t checkpic = getfilesize(node->filename);
    682                                 if(checkpic < 1000) defpic = 1;
    683        
    684                                 //check file is gif or html
    685                                 if(defpic == 0)
    686                                 {
    687                                         char* tmp = NULL;
    688                                         tmp = readbintomem(node->filename, 3);
    689                                         if(ostrcmp("GIF", tmp) == 0) defpic = 1; //gif
    690                                         if(ostrcmp("<", tmp) == 0) defpic = 1; //html
    691                                         free(tmp); tmp = NULL;
    692                                 }
    693        
    694                                 if(defpic == 1)
    695                                 {
    696                                         m_lock(&status.tithekmutex, 20);
    697                                         unlink(node->filename);
    698                                         symlink("/var/usr/local/share/titan/plugins/tithek/default.jpg", node->filename);
    699                                         m_unlock(&status.tithekmutex, 20);
    700                                 }
    701                         }
    702                 }
    703                 else
    704                 {
    705                         char* tmpstr = ostrcat(_("Start playback"), "\n\n", 0, 0);
    706                         tmpstr = ostrcat(tmpstr, node->filename, 1, 0);         
    707                         if(textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1)
    708                         {
    709                                 screenplay(node->filename, 2, flag);
    710                         }               
    711                         free(tmpstr); tmpstr = NULL;
    712                 }
     696                                symlink("/var/usr/local/share/titan/plugins/tithek/default.jpg", node->filename);
     697                                m_unlock(&status.tithekmutex, 20);
     698                        }
     699                }
     700
     701end:
     702                free(node->host); node->host = NULL;
     703                free(node->page); node->page = NULL;
     704                free(node->filename); node->filename = NULL;
     705                free(node->auth); node->auth = NULL;
     706        }
     707
     708        free(node); node = NULL;
     709
     710        tithekdownloadcount--;
     711        tithekdownloadrun = 1;
     712}
     713
     714void tithekbackgrounddownloadthread(struct stimerthread* timernode, struct download* node, int flag)
     715{
     716        tithekdownloadcount++;
     717
     718        if(node != NULL)
     719        {
     720                m_lock(&status.tithekmutex, 20);
     721                if(file_exist(node->filename))
     722                {
     723                        m_unlock(&status.tithekmutex, 20);
     724                        goto end;
     725                }
     726
     727                FILE *fd; fd = fopen(node->filename, "w");
     728                if(fd != NULL) fclose(fd);
     729                m_unlock(&status.tithekmutex, 20);
     730
     731                gethttpreal(node->host, node->page, node->port, node->filename, node->auth, NULL, 0, NULL, NULL, node->timeout, 0);
     732
     733                char* tmpstr = ostrcat(_("Start playback"), "\n\n", 0, 0);
     734                tmpstr = ostrcat(tmpstr, node->filename, 1, 0);         
     735                if(textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0) == 1)
     736                {
     737                        screenplay(node->filename, 2, flag);
     738                }               
     739                free(tmpstr); tmpstr = NULL;
     740
    713741end:
    714742                free(node->host); node->host = NULL;
     
    11561184}
    11571185
    1158 void backgroundplay(char* link, char* filename, int flag)
    1159 {
    1160         int port = 80, count = 0, mcount = 0;
    1161         off64_t size = 0, msize = 0;
     1186void backgroundplay(char* link, char* filename)
     1187{
     1188        int port = 80;
    11621189        char* host = NULL, *pos = NULL, *path = NULL, *file = NULL, *tmpstr = NULL;
    11631190        host = string_replace("http://", "", (char*)link, 0);
     
    11711198        }
    11721199
    1173         file = ostrcat(getconfig("rec_streampath", NULL), filename, 0, 0);
     1200        file = ostrcat(getconfig("rec_streampath", NULL), "/", 0, 0);
     1201        file = ostrcat(file, filename, 1, 0);
    11741202
    11751203        if(ostrstr(host, ":") != NULL)
     
    12001228                dnode->ret = -1;
    12011229                dnode->timeout = 50000;
    1202                 addtimer(&tithekdownloadthread, START, 100, 1, (void*)dnode, NULL, 1);
     1230                addtimer(&tithekbackgrounddownloadthread, START, 100, 1, (void*)dnode, NULL, NULL);
    12031231        }
    12041232                                       
Note: See TracChangeset for help on using the changeset viewer.