Advertisement
KDOXG

CamVault Recording File Organizer

Aug 5th, 2019
1,234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.98 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstdio>
  4. #include <string>
  5.  
  6. /** Usage: It will create a data.txt file with all your video file names in each line. The files needs to be named in CamVault's format: C4_"camgirl_nickname"_"Month"-"day"-"year"_"hour"-"minute"-"second".mp4
  7.  * This program natively works with Cam4's recordings, but it should work fine with Chaturbate's or MyFreeCams' recordings too, provided you modify in this source code changing "C4_" to "CB_" to work with Chaturbate, or to "MFC_" to 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. int main(int argc, char *argv[])
  67. {
  68.     int i = 0, j = 0;
  69.     std::string param = std::string();
  70.     std::string video = std::string();
  71.     std::string folder = std::string();
  72.     std::string newFolder = std::string();
  73.     std::string nameOfNewFolder = std::string();
  74.  
  75.     folder.erase(folder.begin(),folder.end());
  76.     folder.append(argv[0]);
  77.     fixPath(folder);
  78.     i = folder.rfind('\\');
  79.     folder.erase(folder.begin()+i+1,folder.end());
  80.  
  81.     system("dir > data.txt");
  82.     std::ifstream cam;
  83.     cam.open("data.txt", std::ios::out);
  84.  
  85.     while(!cam.fail())
  86.     {
  87.         video.erase(video.begin(),video.end());
  88.         getline(cam,video);
  89.         while (video.find("C4_") == -1 && !cam.fail())
  90.         {
  91.             video.erase(video.begin(),video.end());
  92.             getline(cam,video);
  93.         }
  94.         if (cam.fail())
  95.             break;
  96.         i = video.find("C4_");
  97.         video.erase(video.begin(),video.begin()+i-1);
  98.  
  99.         nameOfNewFolder.erase(nameOfNewFolder.begin(),nameOfNewFolder.end());
  100.         i = video.find("C4_");
  101.         j = findMonth(video);
  102.         if (j == -1)
  103.             break;
  104.         i += 3;
  105.         j -= i;
  106.         nameOfNewFolder = video.substr(i,j);
  107.  
  108.         newFolder.erase(newFolder.begin(),newFolder.end());
  109.         newFolder = folder.substr(0,folder.size());
  110.         newFolder += nameOfNewFolder;
  111.  
  112.         param.erase(param.begin(),param.end());
  113.         param += "mkdir " + nameOfNewFolder + " 2>NUL";
  114.         system(param.c_str());
  115.         param.erase(param.begin(),param.end());
  116.         param += "move " + video + " " + nameOfNewFolder + " >NUL";
  117.         system(param.c_str());
  118.     }
  119.  
  120.     cam.close();
  121.     system("del data.txt");
  122.     return 0;
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement