Search in sources :

Example 1 with FileProperties

use of com.zhouzifei.tool.config.FileProperties in project simpleFS by shengdingbox.

the class FastDfsOssApiClient method init.

@Override
public FastDfsOssApiClient init(FileProperties fileProperties) {
    final FastDfsFileProperties fastDfsFileProperties = fileProperties.getFast();
    this.serverUrl = fastDfsFileProperties.getServerUrl();
    this.domainUrl = fastDfsFileProperties.getUrl();
    checkDomainUrl(domainUrl);
    Properties props = new Properties();
    props.put(ClientGlobal.PROP_KEY_TRACKER_SERVERS, serverUrl);
    try {
        ClientGlobal.initByProperties(props);
    } catch (IOException e) {
        throw new ServiceException("[" + this.storageType + "]尚未配置阿里云FastDfs,文件上传功能暂时不可用!");
    }
    return this;
}
Also used : FastDfsFileProperties(com.zhouzifei.tool.config.FastDfsFileProperties) ServiceException(com.zhouzifei.tool.common.ServiceException) IOException(java.io.IOException) FileProperties(com.zhouzifei.tool.config.FileProperties) FastDfsFileProperties(com.zhouzifei.tool.config.FastDfsFileProperties)

Example 2 with FileProperties

use of com.zhouzifei.tool.config.FileProperties in project simpleFS by shengdingbox.

the class AwsS3ApiClient method main.

public static void main(String[] args) {
    final FileProperties fileProperties = new FileProperties();
    final AwsFileProperties awsFileProperties = fileProperties.getAws();
    awsFileProperties.setAccessKey("LTAI5tFpTDE26XYiPmH9dxDz");
    awsFileProperties.setSecretKey("9gC7gs5kEJJmZec6a6QupoefIL82Kr");
    awsFileProperties.setEndpoint("oss-cn-beijing.aliyuncs.com");
    awsFileProperties.setBucketName("simple-fs");
    awsFileProperties.setDomainUrl("https://simple-fs.oss-cn-beijing.aliyuncs.com/");
    final AwsS3ApiClient awsS3ApiClient = new AwsS3ApiClient(fileProperties);
    final File file = new File("/Users/Dabao/Downloads/videoplayback.mp4");
    final VirtualFile virtualFile = awsS3ApiClient.uploadFile(file);
    System.out.println(virtualFile);
    System.out.println(1);
}
Also used : VirtualFile(com.zhouzifei.tool.dto.VirtualFile) FileProperties(com.zhouzifei.tool.config.FileProperties) AwsFileProperties(com.zhouzifei.tool.config.AwsFileProperties) AwsFileProperties(com.zhouzifei.tool.config.AwsFileProperties) VirtualFile(com.zhouzifei.tool.dto.VirtualFile) File(java.io.File)

Example 3 with FileProperties

use of com.zhouzifei.tool.config.FileProperties in project simpleFS by shengdingbox.

the class GithubApiClient method main.

public static void main(String[] args) throws IOException {
    final FileInputStream fileInputStream = new FileInputStream("/Users/Dabao/Downloads/123.png");
    final FileProperties fileProperties = new FileProperties();
    final GithubFileProperties githubFileProperties = fileProperties.getGithub();
    githubFileProperties.setToken("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");
    githubFileProperties.setUser("shengdingbox");
    githubFileProperties.setRepository("static");
    final GithubApiClient githubApiClient = new GithubApiClient(fileProperties);
    final String s = githubApiClient.uploadInputStream(fileInputStream, "123.png");
    System.out.println(s);
}
Also used : GithubFileProperties(com.zhouzifei.tool.config.GithubFileProperties) FileProperties(com.zhouzifei.tool.config.FileProperties) GithubFileProperties(com.zhouzifei.tool.config.GithubFileProperties) FileInputStream(java.io.FileInputStream)

Example 4 with FileProperties

use of com.zhouzifei.tool.config.FileProperties in project simpleFS by shengdingbox.

the class M3u8DownloadFactory method main.

public static void main(String[] args) {
    M3u8DTO m3u8Download = M3u8DTO.builder().m3u8Url("https://cdn.oss-cn-hangzhou.myqcloud.com.xuetuiguang.cn/m3u8video/shouquan.m3u8").fileName("miaozhun").filePath("/Users/Dabao/mp4").retryCount("3").threadCount("3").timeout("5").build();
    M3u8DownloadFactory.M3u8Download instance = M3u8DownloadFactory.getInstance(m3u8Download);
    // 开始下载
    final String tsUrl = instance.runM3u8ToCloudTask(new FileProperties());
// final Set<String> tsSet = instance.getTsSet();
// System.out.println(tsSet);
}
Also used : FileProperties(com.zhouzifei.tool.config.FileProperties) M3u8DTO(com.zhouzifei.tool.dto.M3u8DTO)

Example 5 with FileProperties

use of com.zhouzifei.tool.config.FileProperties in project simpleFS by shengdingbox.

the class XMLYApiClient method main.

public static void main(String[] args) {
    final FileProperties fileProperties = new FileProperties();
    fileProperties.getXmly().setCookies("Hm_lvt_4a7d8ec50cfd6af753c4f8aee3425070=1639114684; login_type=password_mobile; _xmLog=h5&9ea2efdf-7a5a-4f8d-8269-d9934707ef09&2.4.7-alpha.3; xm-page-viewid=ximalaya-web; x_xmly_traffic=utm_source%253A%2526utm_medium%253A%2526utm_campaign%253A%2526utm_content%253A%2526utm_term%253A%2526utm_from%253A; fds_otp=6230401576727727914; 1&remember_me=y; 1&_token=296993092&6B46C2A0340N0CBC4A6620979932BB1AF9474CD57A95BFBAEA25D9FDEE7710FBF352868FED80140M28D23A81E28D8FF_; 1_l_flag=296993092&6B46C2A0340N0CBC4A6620979932BB1AF9474CD57A95BFBAEA25D9FDEE7710FBF352868FED80140M28D23A81E28D8FF__2021-12-1015:49:16; Hm_lpvt_4a7d8ec50cfd6af753c4f8aee3425070=1639122558\n" + "origin: https://www.ximalaya.com");
    final XMLYApiClient init = new XMLYApiClient(fileProperties);
    final VirtualFile virtualFile = init.uploadFile(new File("/Users/Dabao/Downloads/qrcode_for_gh_da74abc7de78_258.jpg"));
    System.out.println(virtualFile);
// final String s1 = "username=17600004572&password=zhoudabao521.";
// final String s = HttpUtils.DataPost(requestUrl + "/token", s1);
// final JSONObject jsonObject = JSONObject.parseObject(s);
}
Also used : VirtualFile(com.zhouzifei.tool.dto.VirtualFile) XmlyFileProperties(com.zhouzifei.tool.config.XmlyFileProperties) FileProperties(com.zhouzifei.tool.config.FileProperties) VirtualFile(com.zhouzifei.tool.dto.VirtualFile) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile)

Aggregations

FileProperties (com.zhouzifei.tool.config.FileProperties)5 VirtualFile (com.zhouzifei.tool.dto.VirtualFile)2 File (java.io.File)2 ServiceException (com.zhouzifei.tool.common.ServiceException)1 AwsFileProperties (com.zhouzifei.tool.config.AwsFileProperties)1 FastDfsFileProperties (com.zhouzifei.tool.config.FastDfsFileProperties)1 GithubFileProperties (com.zhouzifei.tool.config.GithubFileProperties)1 XmlyFileProperties (com.zhouzifei.tool.config.XmlyFileProperties)1 M3u8DTO (com.zhouzifei.tool.dto.M3u8DTO)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 MultipartFile (org.springframework.web.multipart.MultipartFile)1