Skip to content

Commit

Permalink
[feat]生成更清晰的组封面
Browse files Browse the repository at this point in the history
  • Loading branch information
yajuhua committed Jul 25, 2024
1 parent dc05765 commit 5fef935
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import io.github.yajuhua.download.manager.DownloadManager;
import io.github.yajuhua.podcast2.alist.Alist;
import io.github.yajuhua.podcast2.common.constant.MessageConstant;
import io.github.yajuhua.podcast2.common.constant.ReflectionMethodName;
import io.github.yajuhua.podcast2.common.constant.StatusCode;
import io.github.yajuhua.podcast2.common.exception.BaseException;
import io.github.yajuhua.podcast2.common.exception.SubNotFoundException;
Expand Down Expand Up @@ -54,7 +53,6 @@
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import java.time.Clock;
Expand Down Expand Up @@ -245,7 +243,7 @@ public String groupXml(@RequestParam("uuids") List<String> uuids, @RequestParam(
String enclosureDomain = user.getHostname()==null || user.getHostname().contains(" ") || user.getHostname().length() == 0?null:user.getHostname();
enclosureDomain = enclosureDomain==null? request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort():enclosureDomain;

//生成一个封面https://img.shields.io/badge/-组名-颜色
//生成一个封面https://img.shields.io/badge/-组名-颜色× 太糊了
// 将字节数组中的每个字节转换为十六进制表示
StringBuilder hexString = new StringBuilder();
for (byte b : group.getBytes(StandardCharsets.UTF_8)) {
Expand All @@ -267,7 +265,9 @@ public String groupXml(@RequestParam("uuids") List<String> uuids, @RequestParam(
color = hexString.substring(0,4) + hexString.substring(hexString.length()-2,hexString.length());
}

String imageUrl = "https://img.shields.io/badge/-" + group + "-" + color + ".png";
// ban了 https://face-generator-six.vercel.app/api/generate?bgColor=十六进制颜色&textContent=组名
//目前还可以访问 face.lancarjaya.eu.org
String imageUrl = "https://face.lancarjaya.eu.org/api/generate?textContent=" + group + "&bgColor=" + color;
//组频道信息
Channel groupChannel = new Channel();
groupChannel.setTitle(group);
Expand Down

0 comments on commit 5fef935

Please sign in to comment.