Changeset 40834


Ignore:
Timestamp:
08/27/17 00:42:19 (7 years ago)
Author:
obi
Message:

tithek add youtube_dl background option

File:
1 edited

Legend:

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

    r40829 r40834  
    13451345}
    13461346
    1347 void backgrounddl(char* link, char* filename)
     1347
     1348void backgrounddl(char* link, char* filename, int flag)
    13481349{
    13491350        int port = 80, ret = 0;
     
    13771378        debug(99, "---------------------------------------");
    13781379
    1379         if(ostrstr(path, "|User-Agent=") != NULL)
     1380        if(flag == 1)
     1381        {
     1382                stringreplacechar(path, '|', '\0');
     1383                printf("page changed: %s\n", path);
     1384
     1385                char* cmd = NULL;
     1386                cmd = ostrcat("/tmp/localhoster/bin/python.sh4 /tmp/localhoster/lib/youtube_dl/__main__.py --no-check-certificate --cookies /mnt/network/cookies --user-agent 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.3000 Chrome/30.0.1599.101 Safari/537.36' --format mp4 --restrict-filenames --ignore-errors --output /", , 0, 0);
     1387                cmd = ostrcat(cmd, file, 1, 0);
     1388                cmd = ostrcat(cmd, " ", 1, 0);
     1389
     1390                cmd = ostrcat(cmd, link, 1, 0);
     1391                cmd = ostrcat(cmd, " &", 1, 0);
     1392
     1393                printf("cmd: %s\n", cmd);
     1394                ret = system(cmd);
     1395                free(cmd), cmd = NULL;
     1396        }
     1397/*
     1398        else if(ostrstr(path, "|User-Agent=") != NULL)
    13801399        {
    13811400                stringreplacechar(path, '|', '\0');
     
    13931412                free(cmd), cmd = NULL;
    13941413        }
     1414*/
    13951415        else
    13961416                ret = startbgdownload(host, path, port, file, NULL, 30000, 1);
     
    16761696                                        addmenulist(&mlist, "Download Full File (background)", _("Download Full File (background)"), NULL, 0, 0);
    16771697                                }
     1698
     1699                                if(file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))))
     1700                                {
     1701                                        addmenulist(&mlist, "Download via Youtube_DL (background)", _("", _("Download Full File (youtube_dl)"), NULL, 0, 0);                    }
    16781702                        }
    16791703                }
     
    17701794                        char* search = textinput(_("Filename"), filename);
    17711795                        if(search != NULL)
    1772                                 backgrounddl(tmpstr1, search);
     1796                                backgrounddl(tmpstr1, search, 0);
     1797                        free(search), search = NULL;
     1798                }
     1799                else if(ostrcmp(keyconf, "Download via Youtube_DL (background)") == 0)
     1800                {
     1801                        char* search = textinput(_("Filename"), filename);
     1802                        if(search != NULL)
     1803                                backgrounddl(tmpstr1, search, 1);
    17731804                        free(search), search = NULL;
    17741805                }
Note: See TracChangeset for help on using the changeset viewer.