Advertisement
KDOXG

Not-working script

Aug 5th, 2019
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstdio>
  4. #include <string>
  5.  
  6. /** Usage: Drag and drop into the compiled executable a .txt file with all your video file names in each line (you can use "dir > data.txt" command on cmd — you don't need to worry about the other information, the program will handle it). The files need to be named in CamVault's format: C4_"camgirl_nickname"_"Month"-"day"-"year"_"hour"-"minute"-"second".mp4
  7.  * This program nativelly works with Cam4's recordings, but it should work fine with Chaturbate's or MyFreeCams' recordings too, provided you modify in this source code at lines 89 and 93, changing "C4_" to "CB_" for work with Chaturbate, or to "MFC_" for work with MyFreeCams.
  8.  */
  9.  
  10. int findMonth(std::string file)
  11. {
  12.     if (file.find("_January-") != -1)
  13.         return file.find("_January-");
  14.     if (file.find("_February-") != -1)
  15.         return file.find("_February-");
  16.     if (file.find("_March-") != -1)
  17.         return file.find("_March-");
  18.     if (file.find("_April-") != -1)
  19.         return file.find("_April-");
  20.     if (file.find("_May-") != -1)
  21.         return file.find("_May-");
  22.     if (file.find("_June-") != -1)
  23.         return file.find("_June-");
  24.     if (file.find("_July-") != -1)
  25.         return file.find("_July-");
  26.     if (file.find("_August-") != -1)
  27.         return file.find("_August-");
  28.     if (file.find("_September-") != -1)
  29.         return file.find("_September-");
  30.     if (file.find("_October-") != -1)
  31.         return file.find("_October-");
  32.     if (file.find("_November-") != -1)
  33.         return file.find("_November-");
  34.     return file.find("_December-");
  35. }
  36.  
  37. void fixPath(std::string path)
  38. {
  39.     int i = 0, j = 0, k = 0;
  40.     std::string temp1 = std::string();
  41.     std::string temp2 = std::string();
  42.     std::string temp3 = std::string();
  43.     for (i = 0; i < path.size(); i++)
  44.     {
  45.         if (path[i] == '\\')
  46.             j = i;
  47.         if (path[i] == ' ')
  48.         {
  49.             k = path.find('\\',i);
  50.             temp1 = path.substr(0,j);
  51.             temp1 += "\"";
  52.             temp2 = path.substr(j,k-1);
  53.             temp2 += "\"";
  54.             temp3 = path.substr(k,path.size());
  55.             path.erase(path.begin(),path.end());
  56.             path += temp1 + temp2 + temp3;
  57.             i +=2;
  58.             i = path.find('\"',i);
  59.             temp1.erase(temp1.begin(),temp1.end());
  60.             temp2.erase(temp2.begin(),temp2.end());
  61.             temp3.erase(temp3.begin(),temp3.end());
  62.         }
  63.     }
  64. }
  65.  
  66. //void fixCmdDirFile(std::ifstream text, char* string);
  67.  
  68. int main(int argc, char *argv[])
  69. {
  70.     int i = 0, j = 0;
  71.     std::string param = std::string();
  72.     std::string video = std::string();
  73.     std::string text = std::string();
  74.     std::string folder = std::string();
  75.     std::string newFolder = std::string();
  76.     std::string nameOfNewFolder = std::string();
  77.  
  78.     folder.erase(folder.begin(),folder.end());
  79.     folder.append(argv[0]);
  80.     fixPath(folder);
  81.  
  82.     //for (i = folder.size()-1; folder[i] != '\\'; i--);
  83.     i = folder.rfind('\\');
  84.     folder.erase(folder.begin()+i+1,folder.end());
  85.  
  86.     text.erase(text.begin(),text.end());
  87.     text.append(argv[1]);
  88.     //for (i = text.find(".txt"); text[i] != '\\'; i--);
  89.     i = text.rfind('\\');
  90.     text.erase(text.begin(),text.begin()+i);
  91.     if (text.find(".txt") == -1)
  92.         return -1;
  93.     if (text.find("data.txt") != -1)
  94.     {
  95.         system("ren data.txt data0.txt");
  96.         text.erase(text.begin(),text.end());
  97.         text += "data0.txt";
  98.     }
  99.     std::ifstream cam_temp;
  100.     cam_temp.open(text.c_str(),std::ios::out);
  101. {
  102.     std::string temp = std::string();
  103.     std::string aux = std::string();
  104.     std::ofstream result;
  105.     //result.open("data.txt", std::ios::out | std::ios::app);
  106.     result.open("data.txt");
  107.  
  108.     while(!cam_temp.fail())
  109.     {
  110.         temp.erase(temp.begin(),temp.end());
  111.         getline(cam_temp,temp);
  112.         if (temp.find("C4_") != -1 && temp.find(".mp4") != -1)
  113.             result << temp << '\n';
  114.     }
  115.    
  116.     result.close();
  117. }
  118.     //fixCmdDirFile(cam_temp,"C4_");
  119.     cam_temp.close();
  120.     std::ifstream cam;
  121.     cam.open("data.txt",std::ios::out);
  122.     system("del data0.txt");
  123.  
  124.     while(!cam.fail())
  125.     {
  126.         video.erase(video.begin(),video.end());
  127.         getline(cam,video);
  128.         i = video.find("C4_");
  129.         video.erase(video.begin(),video.begin()+i-1);
  130.  
  131.         nameOfNewFolder.erase(nameOfNewFolder.begin(),nameOfNewFolder.end());
  132.         i = video.find("C4_");
  133.         j = findMonth(video);
  134.         if (j == -1)
  135.             return -1;
  136.         i += 3;
  137.         j -= i;
  138.         nameOfNewFolder = video.substr(i,j);
  139.  
  140.         newFolder.erase(newFolder.begin(),newFolder.end());
  141.         newFolder = folder.substr(0,folder.size());
  142.         newFolder += nameOfNewFolder;
  143.  
  144.         param.erase(param.begin(),param.end());
  145.         param += "mkdir " + nameOfNewFolder;
  146.         system(param.c_str());
  147.         param.erase(param.begin(),param.end());
  148.         param += "move " + video + " " + nameOfNewFolder;
  149.         system(param.c_str());
  150.     }
  151.  
  152.     cam.close();
  153.     return 0;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement