refactor: 清理临时RenameVideoSource函数,改名逻辑统一在SaveVideoSourceAsset中
This commit is contained in:
parent
c817b42ff7
commit
b0895d8fce
@ -878,27 +878,6 @@ func (s *ConfigPreviewService) SaveVideoSourceAsset(asset ConfigVideoSourceAsset
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ConfigPreviewService) RenameVideoSource(oldName, newName string) error {
|
||||
if s == nil || s.assets == nil {
|
||||
return fmt.Errorf("基础配置仓库未初始化")
|
||||
}
|
||||
if oldName == newName {
|
||||
return nil
|
||||
}
|
||||
// Update recognition units referencing old name
|
||||
units, _ := s.ListRecognitionUnits()
|
||||
for _, u := range units {
|
||||
if u.VideoSourceRef == oldName {
|
||||
u.VideoSourceRef = newName
|
||||
ref := recognitionUnitRef(u.SceneTemplateName, u.Name)
|
||||
s.SaveRecognitionUnit(u, ref)
|
||||
}
|
||||
}
|
||||
// Delete old, save new
|
||||
s.DeleteVideoSource(oldName)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ConfigPreviewService) DeleteVideoSource(name string) error {
|
||||
if s == nil || s.assets == nil {
|
||||
return fmt.Errorf("基础配置仓库未初始化")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user