新版本的 --remove-source 功能好像坏掉了 #59

Closed
opened 2023-01-16 05:58:05 +00:00 by zeetex · 4 comments

v0.2.0-beta.2 版的 --remove-source 选项用不了,文件可以正常转换,但是报错说源文件被占用删不了。

$ um --remove-source .
2023/01/16 13:55:29.881 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 充氧期.mflac", "error": "remove 孙燕姿 - 充氧期.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:30.106 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 天天年年.mflac", "error": "remove 孙燕姿 - 天天年年.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:31.361 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 天越亮,夜越黑.mflac", "error": "remove 孙燕姿 - 天越亮,夜越黑.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:32.814 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 平日快乐.mflac", "error": "remove 孙燕姿 - 平日快乐.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:34.092 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 我很愉快.mflac", "error": "remove 孙燕姿 - 我很愉快.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:35.068 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 极美.mflac", "error": "remove 孙燕姿 - 极美.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:36.232 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 超人类.mflac", "error": "remove 孙燕姿 - 超人类.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:37.217 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 跳舞的梵谷.mflac", "error": "remove 孙燕姿 - 跳舞的梵谷.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:38.451 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 风衣.mflac", "error": "remove 孙燕姿 - 风衣.mflac: The process cannot access the file because it is being used by another process."}
`v0.2.0-beta.2` 版的 `--remove-source` 选项用不了,文件可以正常转换,但是报错说源文件被占用删不了。 ``` $ um --remove-source . 2023/01/16 13:55:29.881 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 充氧期.mflac", "error": "remove 孙燕姿 - 充氧期.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:30.106 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 天天年年.mflac", "error": "remove 孙燕姿 - 天天年年.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:31.361 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 天越亮,夜越黑.mflac", "error": "remove 孙燕姿 - 天越亮,夜越黑.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:32.814 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 平日快乐.mflac", "error": "remove 孙燕姿 - 平日快乐.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:34.092 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 我很愉快.mflac", "error": "remove 孙燕姿 - 我很愉快.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:35.068 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 极美.mflac", "error": "remove 孙燕姿 - 极美.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:36.232 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 超人类.mflac", "error": "remove 孙燕姿 - 超人类.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:37.217 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 跳舞的梵谷.mflac", "error": "remove 孙燕姿 - 跳舞的梵谷.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:38.451 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 风衣.mflac", "error": "remove 孙燕姿 - 风衣.mflac: The process cannot access the file because it is being used by another process."} ```
um-dev added the
bug
label 2023-01-18 02:07:59 +00:00
um-dev self-assigned this 2023-01-18 02:08:03 +00:00

同样遇到此问题,坐等修复

同样遇到此问题,坐等修复
// if source file need to be removed
	if p.removeSource {
		file.Close() //我加了一行,可以了
		err := os.RemoveAll(inputFile)
		if err != nil {
			return err
		}
		logger.Info("successfully converted, and source file is removed", zap.String("source", inputFile), zap.String("destination", outPath))
	} else {
		logger.Info("successfully converted", zap.String("source", inputFile), zap.String("destination", outPath))
	}
``` // if source file need to be removed if p.removeSource { file.Close() //我加了一行,可以了 err := os.RemoveAll(inputFile) if err != nil { return err } logger.Info("successfully converted, and source file is removed", zap.String("source", inputFile), zap.String("destination", outPath)) } else { logger.Info("successfully converted", zap.String("source", inputFile), zap.String("destination", outPath)) } ```

最新的版本说已经修复了该问题,但是我是用的时候好像还是不行,不知道是不是我的命令输入有误。我的平台是win64。
.\um.exe --remove-source .
通过以上命令执行后,输出打印如下(只复制了部分打印):
PS C:\Users\pang\Desktop\Music\周杰伦\叶惠美> .\um.exe --remove-source .
2024/10/06 19:22:49.411 INFO um/main.go:241 skipping while no suitable decoder {"source": "um.exe"}
2024/10/06 19:22:49.411 INFO um/main.go:241 skipping while no suitable decoder {"source": "三年二班 - 周杰伦.lrc"}
2024/10/06 19:22:49.505 INFO um/main.go:388 successfully converted {"source": "三年二班 - 周杰伦.mflac", "source": "三年二班 - 周杰伦.mflac", "destination": "C:\Users\pang\Desktop\Music\周杰伦\叶惠美\三年二班 - 周杰伦.flac"}
2024/10/06 19:22:49.505 INFO um/main.go:241 skipping while no suitable decoder {"source": "东风破 - 周杰伦.lrc"}
2024/10/06 19:22:49.600 INFO um/main.go:388 successfully converted {"source": "东风破 - 周杰伦.mflac", "source": " 东风破 - 周杰伦.mflac", "destination": "C:\Users\pang\Desktop\Music\周杰伦\叶惠美\东风破 - 周杰伦.flac"}
2024/10/06 19:22:49.600 INFO um/main.go:241 skipping while no suitable decoder {"source": "以父之名 - 周杰伦.lrc"}
2024/10/06 19:22:49.697 INFO um/main.go:388 successfully converted {"source": "以父之名 - 周杰伦.mflac", "source": "以父之名 - 周杰伦.mflac", "destination": "C:\Users\pang\Desktop\Music\周杰伦\叶惠美\以父之名 - 周杰伦.flac"}
2024/10/06 19:22:49.697 INFO um/main.go:241 skipping while no suitable decoder {"source": "你听得到 - 周杰伦.lrc"}
2024/10/06 19:22:49.760 INFO um/main.go:388 successfully converted {"source": "你听得到 - 周杰伦.mflac", "source": "你听得到 - 周杰伦.mflac", "destination": "C:\Users\pang\Desktop\Music\周杰伦\叶惠美\你听得到 - 周杰伦.flac"}

最新的版本说已经修复了该问题,但是我是用的时候好像还是不行,不知道是不是我的命令输入有误。我的平台是win64。 .\um.exe --remove-source . 通过以上命令执行后,输出打印如下(只复制了部分打印): PS C:\Users\pang\Desktop\Music\周杰伦\叶惠美> .\um.exe --remove-source . 2024/10/06 19:22:49.411 INFO um/main.go:241 skipping while no suitable decoder {"source": "um.exe"} 2024/10/06 19:22:49.411 INFO um/main.go:241 skipping while no suitable decoder {"source": "三年二班 - 周杰伦.lrc"} 2024/10/06 19:22:49.505 INFO um/main.go:388 successfully converted {"source": "三年二班 - 周杰伦.mflac", "source": "三年二班 - 周杰伦.mflac", "destination": "C:\\Users\\pang\\Desktop\\Music\\周杰伦\\叶惠美\\三年二班 - 周杰伦.flac"} 2024/10/06 19:22:49.505 INFO um/main.go:241 skipping while no suitable decoder {"source": "东风破 - 周杰伦.lrc"} 2024/10/06 19:22:49.600 INFO um/main.go:388 successfully converted {"source": "东风破 - 周杰伦.mflac", "source": " 东风破 - 周杰伦.mflac", "destination": "C:\\Users\\pang\\Desktop\\Music\\周杰伦\\叶惠美\\东风破 - 周杰伦.flac"} 2024/10/06 19:22:49.600 INFO um/main.go:241 skipping while no suitable decoder {"source": "以父之名 - 周杰伦.lrc"} 2024/10/06 19:22:49.697 INFO um/main.go:388 successfully converted {"source": "以父之名 - 周杰伦.mflac", "source": "以父之名 - 周杰伦.mflac", "destination": "C:\\Users\\pang\\Desktop\\Music\\周杰伦\\叶惠美\\以父之名 - 周杰伦.flac"} 2024/10/06 19:22:49.697 INFO um/main.go:241 skipping while no suitable decoder {"source": "你听得到 - 周杰伦.lrc"} 2024/10/06 19:22:49.760 INFO um/main.go:388 successfully converted {"source": "你听得到 - 周杰伦.mflac", "source": "你听得到 - 周杰伦.mflac", "destination": "C:\\Users\\pang\\Desktop\\Music\\周杰伦\\叶惠美\\你听得到 - 周杰伦.flac"}

我不懂go语言,但是从f258e3e8f2d958d4104855a335205d4e7fd66653这个提交来看,好像修改之后只有当输入为文件(而不是文件夹)以及监控文件更改时才会生效,当输入为文件夹时并不会生效

我不懂go语言,但是从f258e3e8f2d958d4104855a335205d4e7fd66653这个提交来看,好像修改之后只有当输入为文件(而不是文件夹)以及监控文件更改时才会生效,当输入为文件夹时并不会生效
lsr closed this issue 2024-10-08 21:06:47 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: um/cli#59
No description provided.