mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-20 05:56:10 +05:00
Merge branch 'master' into old-engine
This commit is contained in:
@@ -64,7 +64,7 @@ func (c *Cache) Init(info *metainfo.Info, hash metainfo.Hash) {
|
||||
|
||||
if settings.BTsets.UseDisk {
|
||||
name := filepath.Join(settings.BTsets.TorrentsSavePath, hash.HexString())
|
||||
err := os.MkdirAll(name, 0777)
|
||||
err := os.MkdirAll(name, 0o777)
|
||||
if err != nil {
|
||||
log.TLogln("Error create dir:", err)
|
||||
}
|
||||
@@ -235,7 +235,7 @@ func (c *Cache) getRemPieces() []*Piece {
|
||||
}
|
||||
} else {
|
||||
// on preload clean
|
||||
//TODO проверить
|
||||
// TODO проверить
|
||||
if p.Size > 0 && !c.isIdInFileBE(ranges, id) {
|
||||
piecesRemove = append(piecesRemove, p)
|
||||
}
|
||||
@@ -288,7 +288,6 @@ func (c *Cache) getRemPieces() []*Piece {
|
||||
}
|
||||
|
||||
func (c *Cache) isIdInFileBE(ranges []Range, id int) bool {
|
||||
|
||||
// keep 8/16 MB
|
||||
FileRangeNotDelete := int64(c.pieceLength)
|
||||
if FileRangeNotDelete < 8*1024*1024 {
|
||||
|
||||
@@ -35,7 +35,7 @@ func (p *DiskPiece) WriteAt(b []byte, off int64) (n int, err error) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
ff, err := os.OpenFile(p.name, os.O_RDWR|os.O_CREATE, 0666)
|
||||
ff, err := os.OpenFile(p.name, os.O_RDWR|os.O_CREATE, 0o666)
|
||||
if err != nil {
|
||||
log.TLogln("Error open file:", err)
|
||||
return 0, err
|
||||
@@ -55,7 +55,7 @@ func (p *DiskPiece) ReadAt(b []byte, off int64) (n int, err error) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
ff, err := os.OpenFile(p.name, os.O_RDONLY, 0666)
|
||||
ff, err := os.OpenFile(p.name, os.O_RDONLY, 0o666)
|
||||
if os.IsNotExist(err) {
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
@@ -71,21 +71,21 @@ func (r *Reader) Read(p []byte) (n int, err error) {
|
||||
r.readerOn()
|
||||
n, err = r.Reader.Read(p)
|
||||
|
||||
//samsung tv fix xvid/divx
|
||||
// samsung tv fix xvid/divx
|
||||
if r.offset == 0 && len(p) >= 192 {
|
||||
str := strings.ToLower(string(p[112:116]))
|
||||
if str == "xvid" || str == "divx" {
|
||||
p[112] = 0x4D //M
|
||||
p[113] = 0x50 //P
|
||||
p[114] = 0x34 //4
|
||||
p[115] = 0x56 //V
|
||||
p[112] = 0x4D // M
|
||||
p[113] = 0x50 // P
|
||||
p[114] = 0x34 // 4
|
||||
p[115] = 0x56 // V
|
||||
}
|
||||
str = strings.ToLower(string(p[188:192]))
|
||||
if str == "xvid" || str == "divx" {
|
||||
p[188] = 0x4D //M
|
||||
p[189] = 0x50 //P
|
||||
p[190] = 0x34 //4
|
||||
p[191] = 0x56 //V
|
||||
p[188] = 0x4D // M
|
||||
p[189] = 0x50 // P
|
||||
p[190] = 0x34 // 4
|
||||
p[191] = 0x56 // V
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user