@@ -81,6 +81,30 @@ func filterEmptyFiles(localPath string, lDiff []sdk.FileDiff) (filterDiff []sdk.
8181 return
8282}
8383
84+ func filterVideoFiles (localPath string , lDiff []sdk.FileDiff ) (filterDiff []sdk.FileDiff ) {
85+ localPath = strings .TrimRight (localPath , "/" )
86+ for _ , f := range lDiff {
87+ path := localPath + f .Path
88+ parentPath := filepath .Dir (path )
89+ videoPath := filepath .Dir (parentPath )
90+ //get extension of directory name
91+ parentPathExt := filepath .Ext (parentPath )
92+ if parentPathExt == "" && filepath .Base (parentPath ) != "preview" {
93+ filterDiff = append (filterDiff , f )
94+ continue
95+ }
96+ if filepath .Base (path ) == "thumbnail_generated.jpg" || filepath .Base (path ) == "0kb" || (f .Type == "d" && filepath .Base (path ) == "preview" ) {
97+ continue
98+ }
99+
100+ ext := filepath .Ext (videoPath )
101+ if ext != ".mp4" && ext != ".mkv" && ext != ".avi" && ext != ".mov" && ext != ".flv" && ext != ".wmv" && ext != ".webm" {
102+ filterDiff = append (filterDiff , f )
103+ }
104+ }
105+ return
106+ }
107+
84108func startMultiUploadUpdate (allocationObj * sdk.Allocation , argsSlice []chunkedUploadArgs ) error {
85109 totalOperations := len (argsSlice )
86110 if totalOperations == 0 {
@@ -220,6 +244,7 @@ var syncCmd = &cobra.Command{
220244 }
221245
222246 lDiff = filterEmptyFiles (localpath , lDiff )
247+ lDiff = filterVideoFiles (localpath , lDiff )
223248
224249 if len (lDiff ) > 0 {
225250 printTable (lDiff )
@@ -282,7 +307,11 @@ var syncCmd = &cobra.Command{
282307 fileMetas [f .Path ] = fileMeta
283308 // TODO: User confirm??
284309 fmt .Printf ("Deleting remote %s...\n " , f .Path )
285- err = allocationObj .DeleteFile (f .Path )
310+ opReq := sdk.OperationRequest {
311+ RemotePath : f .Path ,
312+ OperationType : constants .FileOperationDelete ,
313+ }
314+ err = allocationObj .DoMultiOperation ([]sdk.OperationRequest {opReq })
286315 if err != nil {
287316 PrintError ("Error deleting remote file," , err .Error ())
288317 }
@@ -374,6 +403,7 @@ var getDiffCmd = &cobra.Command{
374403 PrintError ("Error getting diff." , err )
375404 os .Exit (1 )
376405 }
406+ lDiff = filterVideoFiles (localpath , lDiff )
377407
378408 util .PrintJSON (lDiff )
379409 },
@@ -394,7 +424,7 @@ func init() {
394424If file exists, this will be used for comparison with remote.
395425After sync complete, remote snapshot will be updated to the same file for next use.` )
396426 syncCmd .PersistentFlags ().StringArray ("excludepath" , []string {}, "Remote folder paths exclude to sync" )
397- syncCmd .Flags ().BoolP ("verifydownload" , "v" , true , "pass this option to verify downloaded blocks" )
427+ syncCmd .Flags ().BoolP ("verifydownload" , "v" , false , "pass this option to verify downloaded blocks" )
398428
399429 syncCmd .MarkFlagRequired ("allocation" )
400430 syncCmd .MarkFlagRequired ("localpath" )
0 commit comments