|
@@ -3,9 +3,13 @@ package cn.efunbox.audio.utils;
|
|
|
import cn.efunbox.audio.impl.AudioServiceImpl;
|
|
|
import jxl.Sheet;
|
|
|
import jxl.Workbook;
|
|
|
+import jxl.read.biff.BiffException;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.sql.ResultSet;
|
|
|
+import java.sql.SQLException;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
public class ExcelUtil {
|
|
@@ -169,10 +173,56 @@ public class ExcelUtil {
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- String pathName = "C:\\Users\\Administrator\\Desktop\\移动1.xls";
|
|
|
+ //String pathName = "C:\\Users\\Administrator\\Desktop\\移动1.xls";
|
|
|
//hyImportExcel(pathName);
|
|
|
- System.out.println(AudioServiceImpl.getMicrosecondLength("https://ai-admin-audio.ai160.com/audio/050/05007001/05007001004.mp3"));
|
|
|
- System.out.println(secToTime(225));
|
|
|
+ //System.out.println(AudioServiceImpl.getMicrosecondLength("https://ai-admin-audio.ai160.com/audio/001/00105001/00105001011.mp3"));
|
|
|
+ //System.out.println(secToTime(1220));
|
|
|
+
|
|
|
+ //String pathName = "C:\\Users\\Administrator\\Desktop\\移动1.xls";
|
|
|
+ //generatePlayTime(pathName);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void generatePlayTime(String name){
|
|
|
+
|
|
|
+ ResultSet rs = null;
|
|
|
+ DBhepler db = new DBhepler();
|
|
|
+ try {
|
|
|
+ Workbook rwb = Workbook.getWorkbook(new File(name));
|
|
|
+ Sheet rs1 = rwb.getSheet("专辑节目");
|
|
|
+
|
|
|
+ if (Objects.nonNull(rs1)) {
|
|
|
+ int clos1 = rs1.getColumns();
|
|
|
+ int rows1 = rs1.getRows();
|
|
|
+
|
|
|
+ for(int i = 1;i<rows1;i++){
|
|
|
+
|
|
|
+ /*
|
|
|
+ Thread.sleep(500);
|
|
|
+ String resContent = rs1.getCell(1,i).getContents();
|
|
|
+ rs = db.Search("select chapter_name,chapter_duration from res_ware where chapter_name = ?",new String[]{resContent});
|
|
|
+ if(rs.next()){
|
|
|
+ System.out.println(rs.getObject("chapter_duration")+" "+rs.getObject("chapter_name"));
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
+ String chapter_url = rs1.getCell(9, i).getContents();
|
|
|
+ String chapter_duration = secToTime(AudioServiceImpl.getMicrosecondLength(chapter_url));
|
|
|
+ String resContent = rs1.getCell(1,i).getContents();
|
|
|
+ System.out.println(chapter_duration+" "+resContent);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ if(rs != null){
|
|
|
+ try {
|
|
|
+ rs.close();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static String secToTime(long time) {
|