MCPcopy
hub / github.com/ChineseSubFinder/ChineseSubFinder / GetFrontNameAndOrgName

Function GetFrontNameAndOrgName

pkg/sub_helper/sub_helper.go:211–228  ·  view source on GitHub ↗

GetFrontNameAndOrgName 返回的名称包含,那个网站下载的,这个网站中排名第几,文件名

(log *logrus.Logger, info *supplier.SubInfo)

Source from the content-addressed store, hash-verified

209
210// GetFrontNameAndOrgName 返回的名称包含,那个网站下载的,这个网站中排名第几,文件名
211func GetFrontNameAndOrgName(log *logrus.Logger, info *supplier.SubInfo) string {
212
213 infoName := ""
214 fileName, err := decode.GetVideoInfoFromFileName(info.Name)
215 if err != nil {
216 log.Warnln("", err)
217 // 替换特殊字符
218 infoName = pkg.ReplaceSpecString(info.Name, "x")
219 } else {
220 infoName = fileName.Title + "_S" + strconv.Itoa(fileName.Season) + "E" + strconv.Itoa(fileName.Episode) + filepath.Ext(info.Name)
221 }
222 if len(infoName) < 1 {
223 infoName = pkg.RandStringBytesMaskImprSrcSB(10) + filepath.Ext(info.Name)
224 }
225 info.Name = infoName
226
227 return "[" + info.FromWhere + "]_" + strconv.FormatInt(info.TopN, 10) + "_" + infoName
228}
229
230// AddFrontName 添加文件的前缀
231func AddFrontName(info supplier.SubInfo, orgName string) string {

Callers 1

OrganizeDlSubFilesFunction · 0.85

Calls 3

GetVideoInfoFromFileNameFunction · 0.92
ReplaceSpecStringFunction · 0.92

Tested by

no test coverage detected