zoukankan      html  css  js  c++  java
  • C# 获取mp3文件的歌曲时间长度

    添加命名空间:
        using Shell32;
        using System.Text.RegularExpressions;
    添加引用:COM组件的Microsoft Shell Controls And Automation

    string dirName = Path.GetDirectoryName(SongPath);
    SongName = Path.GetFileName(SongPath);//获得歌曲名称
    FileInfo fInfo = new FileInfo(SongPath);
    ShellClass sh = new ShellClass();
    Folder dir = sh.NameSpace(dirName);
    FolderItem item = dir.ParseName(SongName);
    SongTime = Regex.Match(dir.GetDetailsOf(item, -1), "\d:\d{2}:\d{2}").Value;//获取歌曲时间
     
  • 相关阅读:
    SQL学习记录
    Python 函数和变量作用域
    Python 使用socket实现一对多通信
    Flask wtforms validate_on_submit() 无法返回值问题
    Flask WTForm BooleanField用法
    Python3 中的nonlocal用法
    Python 实现二进制循环效果
    Python 各种类型转换
    第一章:数据结构
    Python Challenge
  • 原文地址:https://www.cnblogs.com/yechangzhong-826217795/p/7100080.html
Copyright © 2011-2022 走看看