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
fd523fce
Commit
fd523fce
authored
Nov 28, 2018
by
songxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
17724801
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
OssUtils.java
...rc/main/java/com/pcloud/common/utils/aliyun/OssUtils.java
+53
-0
No files found.
pcloud-common/src/main/java/com/pcloud/common/utils/aliyun/OssUtils.java
View file @
fd523fce
...
@@ -747,6 +747,36 @@ public class OssUtils {
...
@@ -747,6 +747,36 @@ public class OssUtils {
return
resultFileUrl
;
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
;
}
/**
/**
* 提交视频剪切作业
* 提交视频剪切作业
*
*
...
@@ -1249,6 +1279,14 @@ public class OssUtils {
...
@@ -1249,6 +1279,14 @@ public class OssUtils {
.
append
(
"/"
).
append
(
fileName
).
append
(
"."
).
append
(
fileType
).
toString
();
.
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>
* 获取文件下载加密密钥,默认有效期48小时 <br>
* 密钥需要结合域名https://download.5rs.me使用,可以在浏览器直接下载 <br>
* 密钥需要结合域名https://download.5rs.me使用,可以在浏览器直接下载 <br>
...
@@ -1780,4 +1818,19 @@ public class OssUtils {
...
@@ -1780,4 +1818,19 @@ public class OssUtils {
return
isUploadfe
;
return
isUploadfe
;
}
}
/**
* 判断文件是存在002中
*
* @param fileUrl
* @return true:001,false:002
*/
public
static
boolean
fileUrlExist002
(
String
fileUrl
)
{
boolean
isUploadfe
=
false
;
String
objectKey
=
splitObjectKey
(
fileUrl
);
if
(
doesObjectExist
(
AliyunConstant
.
FILE_BUCKET
,
objectKey
))
{
isUploadfe
=
true
;
}
return
isUploadfe
;
}
}
}
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