コード例 #1
0
void Reader_Directory::Xdcam_Directory_Cleanup(ZtringList &List)
{
    //if there is a XDCAM/Clip folder, this is Xdcam
    Ztring ToSearch=Ztring(1, PathSeparator)+_T("Clip")+PathSeparator; //"/Clip/"
    for (size_t File_Pos=0; File_Pos<List.size(); File_Pos++)
    {
        size_t Xdcam_Pos=List[File_Pos].find(ToSearch);
        if (Xdcam_Pos!=string::npos && Xdcam_Pos!=0 && Xdcam_Pos+1+4+1+12==List[File_Pos].size())
        {
            //This is a XDCAM CLIP
            Ztring Path_Begin=List[File_Pos];
            Path_Begin.resize(Path_Begin.size()-(1+4+1+12));
            Path_Begin+=Ztring(1, PathSeparator);
            if (Dir::Exists(Path_Begin+_T("Edit")) && Dir::Exists(Path_Begin+_T("General")) && Dir::Exists(Path_Begin+_T("Sub")))
            {
                bool HasChanged=false;
                for (size_t Pos=0; Pos<List.size(); Pos++)
                {
                    if (List[Pos].find(Path_Begin)==0 && (List[Pos].find(Path_Begin+_T("Clip")+PathSeparator)==string::npos || (List[Pos].find(_T(".XML"))!=List[Pos].size()-4))) //Remove all subdirs of Path_Begin but not with the right XML
                    {
                        //Removing the file in the XDCAM directory
                        List.erase(List.begin()+Pos);
                        Pos--;
                        HasChanged=true;
                    }
                }
                if (HasChanged)
                    File_Pos=0;
            }
        }
    }
}
コード例 #2
0
void Reader_Directory::Bdmv_Directory_Cleanup(ZtringList &List)
{
    //if there is a BDMV folder, this is blu-ray
    Ztring ToSearch=Ztring(1, PathSeparator)+_T("BDMV")+PathSeparator+_T("index.bdmv"); //"\BDMV\index.bdmv"
    for (size_t File_Pos=0; File_Pos<List.size(); File_Pos++)
    {
        size_t BDMV_Pos=List[File_Pos].find(ToSearch);
        if (BDMV_Pos!=string::npos && BDMV_Pos!=0 && BDMV_Pos+16==List[File_Pos].size())
        {
            //This is a BDMV index, parsing the directory only if index and movie objects are BOTH present
            ToSearch=List[File_Pos];
            ToSearch.resize(ToSearch.size()-10);
            ToSearch+=_T("MovieObject.bdmv");  //"%CompletePath%\BDMV\MovieObject.bdmv"
            if (List.Find(ToSearch)!=string::npos)
            {
                //We want the folder instead of the files
                List[File_Pos].resize(List[File_Pos].size()-11); //only %CompletePath%\BDMV
                ToSearch=List[File_Pos];

                for (size_t Pos=0; Pos<List.size(); Pos++)
                {
                    if (List[Pos].find(ToSearch)==0 && List[Pos]!=ToSearch) //Remove all subdirs of ToSearch but not ToSearch
                    {
                        //Removing the file in the blu-ray directory
                        List.erase(List.begin()+Pos);
                        Pos--;
                    }
                }
            }
        }
    }
}
コード例 #3
0
void Reader_Directory::P2_Directory_Cleanup(ZtringList &List)
{
    //if there is a CONTENTS/CLIP folder, this is P2
    Ztring ToSearch=Ztring(1, PathSeparator)+_T("CONTENTS")+PathSeparator+_T("CLIP")+PathSeparator; //"/CONTENTS/CLIP/"
    for (size_t File_Pos=0; File_Pos<List.size(); File_Pos++)
    {
        size_t P2_Pos=List[File_Pos].find(ToSearch);
        if (P2_Pos!=string::npos && P2_Pos!=0 && P2_Pos+1+8+1+4+1+10==List[File_Pos].size())
        {
            //This is a P2 CLIP
            Ztring Path_Begin=List[File_Pos];
            Path_Begin.resize(Path_Begin.size()-(1+8+1+4+1+10));
            Path_Begin+=Ztring(1, PathSeparator);
            bool HasChanged=false;
            for (size_t Pos=0; Pos<List.size(); Pos++)
            {
                if (List[Pos].find(Path_Begin)==0 && List[Pos].find(Path_Begin+_T("CONTENTS")+PathSeparator+_T("CLIP")+PathSeparator)==string::npos) //Remove all subdirs of Path_Begin but not with CLIP
                {
                    //Removing the file in the P2 directory
                    List.erase(List.begin()+Pos);
                    Pos--;
                    HasChanged=true;
                }
            }
            if (HasChanged)
                File_Pos=0;
        }
    }
}