MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / getBufTmpFiles

Function getBufTmpFiles

src/buffer.go:561–606  ·  view source on GitHub ↗
(stream *ThisStream)

Source from the content-addressed store, hash-verified

559}
560
561func getBufTmpFiles(stream *ThisStream) (tmpFiles []string) {
562
563 var tmpFolder = stream.Folder
564 var fileIDs []float64
565
566 if _, err := bufferVFS.Stat(tmpFolder); !fsIsNotExistErr(err) {
567
568 files, err := bufferVFS.ReadDir(getPlatformPath(tmpFolder))
569 if err != nil {
570 ShowError(err, 000)
571 return
572 }
573
574 if len(files) > 2 {
575
576 for _, file := range files {
577
578 var fileID = strings.Replace(file.Name(), ".ts", "", -1)
579 var f, err = strconv.ParseFloat(fileID, 64)
580
581 if err == nil {
582 fileIDs = append(fileIDs, f)
583 }
584
585 }
586
587 sort.Float64s(fileIDs)
588 fileIDs = fileIDs[:len(fileIDs)-1]
589
590 for _, file := range fileIDs {
591
592 var fileName = fmt.Sprintf("%d.ts", int64(file))
593
594 if indexOfString(fileName, stream.OldSegments) == -1 {
595 tmpFiles = append(tmpFiles, fileName)
596 stream.OldSegments = append(stream.OldSegments, fileName)
597 }
598
599 }
600
601 }
602
603 }
604
605 return
606}
607
608func killClientConnection(streamID int, playlistID string, force bool) {
609 Lock.Lock()

Callers 1

bufferingStreamFunction · 0.85

Calls 4

fsIsNotExistErrFunction · 0.85
ShowErrorFunction · 0.85
getPlatformPathFunction · 0.70
indexOfStringFunction · 0.70

Tested by

no test coverage detected