Documentation
¶
Index ¶
- Constants
- Variables
- func GetFile(rel DownloadRelease) ([]byte, error)
- func RarRootName(path string) string
- func TotalSize[T FileLike](items []T) int64
- type Add
- type Adds
- type ArchivedFile
- type ArchivedFiles
- type AvHeadBlock
- type CommHeadBlock
- type DownloadRelease
- type EndArcHeadBlock
- type File
- type FileHeadBlock
- func (b *FileHeadBlock) GetCRC() uint32
- func (b *FileHeadBlock) GetFileName() string
- func (b *FileHeadBlock) GetMethod() uint8
- func (b *FileHeadBlock) GetPackSize() int
- func (b *FileHeadBlock) GetSize() int
- func (b *FileHeadBlock) GetUnpackSize() int
- func (b *FileHeadBlock) IsCompressed() bool
- func (b *FileHeadBlock) Parse(data []byte) error
- func (b *FileHeadBlock) UpdatePackedFile(p *PackedFile) error
- type FileLike
- type Files
- type MainHeadBlock
- type MarkHeadBlock
- type NewSubHeadBlock
- type OSOHash
- type OSOHashHeadBlock
- type PackedFile
- type ProtectHeadBlock
- type RarFile
- type RarHeader
- type RarHeaderFlag
- type RarHeaderType
- type RarNameFmt
- type Release
- type SignHeadBlock
- type SrrFile
- type SrrRarPadHeadBlock
- type SrrRarSubBlockHeadBlock
- type SrrStoredFileHeadBlock
- type SrrVolHeadBlock
- type StoredFile
- type SubHeadBlock
Constants ¶
View Source
const ( EmptyHead RarHeaderType = 0x00 SrrVolHead RarHeaderType = 0x69 SrrStoredFileHead RarHeaderType = 0x6A OSOHashHead RarHeaderType = 0x6B SrrRarPadHead RarHeaderType = 0x6C SrrRarSubBlockHead RarHeaderType = 0x71 MarkHead RarHeaderType = 0x72 MainHead RarHeaderType = 0x73 FileHead RarHeaderType = 0x74 CommHead RarHeaderType = 0x75 AvHead RarHeaderType = 0x76 SubHead RarHeaderType = 0x77 ProtectHead RarHeaderType = 0x78 SignHead RarHeaderType = 0x79 NewSubHead RarHeaderType = 0x7A EndArcHead RarHeaderType = 0x7B MHD_VOLUME RarHeaderFlag = 0x0001 MHD_COMMENT RarHeaderFlag = 0x0002 MHD_LOCK RarHeaderFlag = 0x0004 MHD_SOLID RarHeaderFlag = 0x0008 MHD_NEWNUMBERING RarHeaderFlag = 0x0010 MHD_AV RarHeaderFlag = 0x0020 MHD_PROTECT RarHeaderFlag = 0x0040 MHD_PASSWORD RarHeaderFlag = 0x0080 MHD_FIRSTVOLUME RarHeaderFlag = 0x0100 MHD_ENCRYPTVER RarHeaderFlag = 0x0200 LHD_SPLIT_BEFORE RarHeaderFlag = 0x0001 LHD_SPLIT_AFTER RarHeaderFlag = 0x0002 LHD_PASSWORD RarHeaderFlag = 0x0004 LHD_COMMENT RarHeaderFlag = 0x0008 LHD_SOLID RarHeaderFlag = 0x0010 LHD_LARGE RarHeaderFlag = 0x0100 LHD_UNICODE RarHeaderFlag = 0x0200 LHD_SALT RarHeaderFlag = 0x0400 LHD_VERSION RarHeaderFlag = 0x0800 LHD_EXTTIME RarHeaderFlag = 0x1000 LHD_EXTFLAGS RarHeaderFlag = 0x2000 HAS_DATA RarHeaderFlag = 0x8000 SRR_APP_NAME RarHeaderFlag = 0x0001 )
View Source
const ( ReleaseURL = "https://api.srrdb.com/v1/details/{release}" DownloadURL = "https://www.srrdb.com/download/file/{release}/{file}" DownloadSrrURL = "https://www.srrdb.com/download/srr/{release}" DownloadAddURL = "https://www.srrdb.com/download/temp/{release}/{id}/{file}" )
Variables ¶
View Source
var ( // ErrCRCMismatch crc doesn't match ErrCRCMismatch = errors.New("rescene: crc error") // ErrBadBlock block not formatted properly ErrBadBlock = errors.New("rescene: block not properly formatted") // ErrBadFile file not properly formatted ErrBadFile = errors.New("rescene: file not properly formatted") // ErrBadData invalid data ErrBadData = errors.New("rescene: incorrect data") // ErrNoData data missing ErrNoData = errors.New("rescene: no data") // ErrDuplicateSFV file referenced twice in sfv ErrDuplicateSFV = errors.New("rescene: duplicate file in sfv") )
View Source
var ( // DownloadableExtensions defines file extensions that are allowed for download. DownloadableExtensions = []string{".nfo", ".m3u", ".jpg", ".sfv"} // ErrFileNotFound indicates that the requested file could not be found during an operation. ErrFileNotFound = fmt.Errorf("file not found") )
Functions ¶
func GetFile ¶
func GetFile(rel DownloadRelease) ([]byte, error)
GetFile retrieves the content of a file for the given DownloadRelease configuration via HTTP request. It dynamically generates the URL based on the provided release name, file, and ID details.
func RarRootName ¶
Types ¶
type Add ¶
type ArchivedFile ¶
type ArchivedFile struct { Name string `json:"name"` Size int64 `json:"size"` CRC string `json:"crc"` }
func (ArchivedFile) GetSize ¶
func (af ArchivedFile) GetSize() int64
type ArchivedFiles ¶
type ArchivedFiles []ArchivedFile
type AvHeadBlock ¶
type AvHeadBlock struct {
RarHeader
}
type CommHeadBlock ¶
type CommHeadBlock struct {
RarHeader
}
type DownloadRelease ¶
type EndArcHeadBlock ¶
type EndArcHeadBlock struct {
RarHeader
}
type FileHeadBlock ¶
type FileHeadBlock struct { RarHeader LowPackSize uint32 LowUnpackSize uint32 HostOS uint8 FileCRC uint32 FileTime uint32 UnpackVersion uint8 Method uint8 NameSize uint16 FileAttr uint32 HighPackSize uint32 HighUnpackSize uint32 FileName []byte FileNameUnicode []byte Salt uint64 }
func (*FileHeadBlock) GetCRC ¶
func (b *FileHeadBlock) GetCRC() uint32
func (*FileHeadBlock) GetFileName ¶
func (b *FileHeadBlock) GetFileName() string
func (*FileHeadBlock) GetMethod ¶
func (b *FileHeadBlock) GetMethod() uint8
func (*FileHeadBlock) GetPackSize ¶
func (b *FileHeadBlock) GetPackSize() int
func (*FileHeadBlock) GetSize ¶
func (b *FileHeadBlock) GetSize() int
func (*FileHeadBlock) GetUnpackSize ¶
func (b *FileHeadBlock) GetUnpackSize() int
func (*FileHeadBlock) IsCompressed ¶
func (b *FileHeadBlock) IsCompressed() bool
func (*FileHeadBlock) Parse ¶
func (b *FileHeadBlock) Parse(data []byte) error
func (*FileHeadBlock) UpdatePackedFile ¶
func (b *FileHeadBlock) UpdatePackedFile(p *PackedFile) error
type MainHeadBlock ¶
type MainHeadBlock struct {
RarHeader
}
type MarkHeadBlock ¶
type MarkHeadBlock struct {
RarHeader
}
type NewSubHeadBlock ¶
type NewSubHeadBlock struct { RarHeader LowPackSize uint32 LowUnpackSize uint32 HostOS uint8 FileCRC uint32 FileTime uint32 UnpackVersion uint8 Method uint8 NameSize uint16 FileAttr uint32 HighPackSize uint32 HighUnpackSize uint32 FileName []byte Salt uint64 }
func (*NewSubHeadBlock) GetFileName ¶
func (b *NewSubHeadBlock) GetFileName() string
func (*NewSubHeadBlock) GetPackSize ¶
func (b *NewSubHeadBlock) GetPackSize() int
func (*NewSubHeadBlock) GetSize ¶
func (b *NewSubHeadBlock) GetSize() int
func (*NewSubHeadBlock) Parse ¶
func (b *NewSubHeadBlock) Parse(data []byte) error
type OSOHashHeadBlock ¶
type OSOHashHeadBlock struct { RarHeader FileSize uint64 OSOHash uint64 NameSize uint16 FileName []byte }
func (*OSOHashHeadBlock) GetOSOHash ¶
func (b *OSOHashHeadBlock) GetOSOHash() (h *OSOHash, err error)
func (*OSOHashHeadBlock) Parse ¶
func (b *OSOHashHeadBlock) Parse(data []byte) error
type PackedFile ¶
type ProtectHeadBlock ¶
type ProtectHeadBlock struct { RarHeader PackedSize uint32 Version uint8 RecSectorCount uint16 DataSectorCount uint32 }
func (*ProtectHeadBlock) GetSize ¶
func (b *ProtectHeadBlock) GetSize() int
func (*ProtectHeadBlock) Parse ¶
func (b *ProtectHeadBlock) Parse(data []byte) error
type RarHeader ¶
type RarHeader struct { CRC uint16 Type RarHeaderType Flags RarHeaderFlag Size uint16 }
func (*RarHeader) Flag ¶
func (h *RarHeader) Flag(f RarHeaderFlag) bool
type RarHeaderFlag ¶
type RarHeaderFlag uint16
type RarHeaderType ¶
type RarHeaderType byte
type RarNameFmt ¶
type RarNameFmt byte
type Release ¶
type Release struct { Name string `json:"name"` Files Files `json:"files"` ArchivedFiles ArchivedFiles `json:"archived-files"` Adds Adds `json:"adds"` }
func GetInformation ¶
GetInformation fetches and decodes release information from a remote API based on the given release name.
type SignHeadBlock ¶
type SignHeadBlock struct {
RarHeader
}
type SrrFile ¶
type SrrFile struct { ApplicationName string StoredFiles []*StoredFile OSOHashes []*OSOHash RarFiles []*RarFile RarCompressed bool PackedFiles []*PackedFile SFVComments []string }
func GetSrrFile ¶
GetSrrFile retrieves and unmarshals an SRR file based on the given release name, returning an SrrFile object.
func LoadFromFile ¶
LoadFromFile reads a file from the given path and unmarshals its content into an SrrFile.
type SrrRarPadHeadBlock ¶
func (*SrrRarPadHeadBlock) GetPadSize ¶
func (b *SrrRarPadHeadBlock) GetPadSize() int
func (*SrrRarPadHeadBlock) GetSize ¶
func (b *SrrRarPadHeadBlock) GetSize() int
func (*SrrRarPadHeadBlock) Parse ¶
func (b *SrrRarPadHeadBlock) Parse(data []byte) error
type SrrRarSubBlockHeadBlock ¶
func (*SrrRarSubBlockHeadBlock) GetRarFileName ¶
func (b *SrrRarSubBlockHeadBlock) GetRarFileName() string
func (*SrrRarSubBlockHeadBlock) Parse ¶
func (b *SrrRarSubBlockHeadBlock) Parse(data []byte) error
type SrrStoredFileHeadBlock ¶
type SrrStoredFileHeadBlock struct { RarHeader DataSize uint32 NameSize uint16 FileName []byte FileData []byte }
func (*SrrStoredFileHeadBlock) GetSize ¶
func (b *SrrStoredFileHeadBlock) GetSize() int
func (*SrrStoredFileHeadBlock) GetStoredFile ¶
func (b *SrrStoredFileHeadBlock) GetStoredFile() (f *StoredFile, err error)
func (*SrrStoredFileHeadBlock) Parse ¶
func (b *SrrStoredFileHeadBlock) Parse(data []byte) error
type SrrVolHeadBlock ¶
func (*SrrVolHeadBlock) GetAppName ¶
func (b *SrrVolHeadBlock) GetAppName() string
func (*SrrVolHeadBlock) Parse ¶
func (b *SrrVolHeadBlock) Parse(data []byte) (err error)
type StoredFile ¶
type SubHeadBlock ¶
type SubHeadBlock struct {
RarHeader
}
Click to show internal directories.
Click to hide internal directories.