Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
44b1f4bd
Commit
44b1f4bd
authored
Dec 03, 2018
by
songxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片转webp格式
parent
fd523fce
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
38 deletions
+17
-38
FileUtils.java
...mmon/src/main/java/com/pcloud/common/utils/FileUtils.java
+0
-0
OssUtils.java
...rc/main/java/com/pcloud/common/utils/aliyun/OssUtils.java
+17
-38
No files found.
pcloud-common/src/main/java/com/pcloud/common/utils/FileUtils.java
View file @
44b1f4bd
This diff is collapsed.
Click to expand it.
pcloud-common/src/main/java/com/pcloud/common/utils/aliyun/OssUtils.java
View file @
44b1f4bd
...
...
@@ -151,6 +151,23 @@ public class OssUtils {
}
/**
* 父子文件上传,子文件全路径和父文件相同,文件后缀类型自定义
*
* @param filePath
* 子文件本地路径
* @param parentFileUrl
* 仅限OSS的全路径,其他本地文件路径均不支持
* @return
* @throws FileException
*/
public
static
UploadResultInfo
uploadLocalFile4Child
(
String
filePath
,
String
parentFileUrl
)
throws
FileException
{
String
fileType
=
FileUtils
.
getFileType
(
filePath
);
String
outObjectKey
=
splitObjectKey
(
parentFileUrl
)
+
"."
+
fileType
;
uploadPointFile2OSS
(
filePath
,
AliyunConstant
.
FILE_BUCKET
,
outObjectKey
);
return
getResultInfo
(
outObjectKey
,
new
File
(
filePath
).
length
(),
null
,
AliyunConstant
.
FILE_BUCKET
);
}
/**
* byte[]数组文件流上传 ,isFlag=true,表示上传成功
*
* @param buff
...
...
@@ -747,36 +764,6 @@ public class OssUtils {
return
resultFileUrl
;
}
public
static
String
submitClipJobFixBug
(
String
fileName
,
String
fileUrl
,
String
seek
,
String
duration
)
throws
FileException
{
LOGGER
.
info
(
"【aliOSS】提交音视频剪切作业(fixBug).<START>.[fileUrl]="
+
fileUrl
+
",[seek]="
+
seek
+
",[duration]="
+
duration
);
if
(
StringUtil
.
isEmpty
(
duration
))
{
return
null
;
}
String
fileType
=
FileUtils
.
getFileType
(
fileUrl
);
String
gatherName
=
FileUtils
.
getGatherName
(
fileType
);
if
(!(
FileUtils
.
VIDEO
.
equals
(
gatherName
)
||
FileUtils
.
AUDIO
.
equals
(
gatherName
)))
{
return
null
;
}
String
resultFileUrl
=
""
;
String
outFileType
=
FileUtils
.
VIDEO
.
equals
(
gatherName
)
?
"mp4"
:
"mp3"
;
if
(
StringTools
.
contains
(
fileUrl
,
AliyunConstant
.
OSS_CDN_URLS
))
{
String
inObjectKey
=
splitObjectKey
(
fileUrl
);
String
inBucketName
=
fileUrlExist001
(
fileUrl
)
?
AliyunConstant
.
INPUT_BUCKET
:
AliyunConstant
.
getBucketName
(
fileUrl
);
OSSFileDO
ossFileDO
=
new
OSSFileDO
(
AliyunConstant
.
getOssRegion
(
inBucketName
),
inBucketName
,
inObjectKey
);
String
outObjectKey
=
getOutObjectKeyFixBug
(
AliyunEnum
.
CUT
.
value
,
fileName
,
outFileType
);
resultFileUrl
=
clipJob
(
ossFileDO
,
outObjectKey
,
seek
,
duration
);
}
else
{
String
inObjectKey
=
getInObjectKey
(
AliyunEnum
.
CUT
.
value
,
fileName
,
fileType
);
OSSFileDO
ossFileDO
=
uploadPointFile2OSS
(
fileUrl
,
AliyunConstant
.
FILE_BUCKET
,
inObjectKey
);
String
outObjectKey
=
getOutObjectKey
(
AliyunEnum
.
CUT
.
value
,
fileName
,
outFileType
);
resultFileUrl
=
clipJob
(
ossFileDO
,
outObjectKey
,
seek
,
duration
);
}
LOGGER
.
info
(
"【aliOSS】提交音视频剪切作业.<END>.[resultFileUrl]="
+
resultFileUrl
);
return
resultFileUrl
;
}
/**
* 提交视频剪切作业
*
...
...
@@ -1279,14 +1266,6 @@ public class OssUtils {
.
append
(
"/"
).
append
(
fileName
).
append
(
"."
).
append
(
fileType
).
toString
();
}
private
static
String
getOutObjectKeyFixBug
(
String
uploadType
,
String
fileName
,
String
fileType
)
{
fileName
=
StringUtil
.
isEmpty
(
fileName
)
?
UUIDUitl
.
taskName
()
:
FileUtils
.
formatName
(
fileName
);
String
gatherName
=
FileUtils
.
getGatherName
(
fileType
);
gatherName
=
StringUtil
.
isEmpty
(
gatherName
)
?
"other"
:
gatherName
.
toLowerCase
();
return
new
StringBuilder
(
"oss/"
).
append
(
uploadType
).
append
(
"/"
).
append
(
gatherName
).
append
(
"/"
).
append
(
fileType
)
.
append
(
"/"
).
append
(
fileName
).
append
(
"."
).
append
(
fileType
).
toString
();
}
/**
* 获取文件下载加密密钥,默认有效期48小时 <br>
* 密钥需要结合域名https://download.5rs.me使用,可以在浏览器直接下载 <br>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment