⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 mp3
💻 CPP
字号:

    // includes
  #include "MP3FileInfo.h"
  #include <stdio.h>
  #include <conio.h>
  #include <windows.h>
  #include <wincon.h>


  void listUp(char* desc, char* elem) { if((elem!=0) && (strlen(elem)>0)) printf("    %-20s : %s\n", desc, elem); }
  void listUp(char* desc, int elem)   { if(elem) printf("    %-20s : %i\n", desc, elem); }
  void heading(char* title) { printf("\n  %s:\n", title); }



  int main(int argc, char** argv)
   {
    SetConsoleTitle("MP3FileInfo.exe");
    if(argc < 2)
     {
      printf("Not enough parameters.\n\n");
      printf("USAGE: MP3FileInfo.exe {Filename of MP3 File}\n\n");
      printf("Press any key to continue\n");
      _getch();
      return 1;
     }

    MP3FileInfo mp3fi;
    for(int i=1; i<argc; i++)
     {
      printf("################################################################################");

      if(!mp3fi.Init(argv[i]))
       {
        printf("\n  Error.\n\n");
        continue;
       }

      printf("\n  %s:\n", "File");
      printf("    %-20s : %s\n",        "Filename", mp3fi.szFilename);
      printf("    %-20s : %i bytes\n",  "Filesize", mp3fi.nFileSize);
      printf("    %-20s : %s%s%s\n",    "ID3 Tags", (mp3fi.bHasV1Tag?"ID3V1":""), (mp3fi.bHasV1Tag&mp3fi.bHasV2Tag?" and ":""), (mp3fi.bHasV2Tag?"ID3V2":""));
      if(mp3fi.bHasLyrics)
       printf("    %-20s : yes\n", "Lyrics");
 
      printf("\n  %s:\n", "Header");
      printf("    %-20s : %s %s\n",       "MPEG",     mp3fi.szMpegVersion, mp3fi.szMpegLayer);
      printf("    %-20s : %s\n",          "BitRate",  mp3fi.szBitRate);
      printf("    %-20s : %iHz %s\n",     "Audio",    mp3fi.nSampleRate, mp3fi.szChannelMode);
      printf("    %-20s : %i seconds\n",  "Length",   mp3fi.nLength);

      if(mp3fi.bHasV1Tag || mp3fi.bHasV2Tag)
       {
        heading("ID3V1 Tag (and up)");
        listUp("Artist",  mp3fi.szArtist);
        listUp("Title",   mp3fi.szTitle);
        listUp("Track",   mp3fi.nTrack);
        listUp("Album",   mp3fi.szAlbum);
        listUp("Year",    mp3fi.nYear);
        listUp("Genre",   mp3fi.szGenre);
        listUp("Comment", mp3fi.szComment);
       }

      if(mp3fi.bHasV2Tag)
       {
        heading("V2 specific");
        listUp("Composer", mp3fi.szComposer);
        listUp("Encoded By", mp3fi.szEncodedBy);
        listUp("Original Artist", mp3fi.szOriginalArtist);
        listUp("URL", mp3fi.szURL);
        listUp("Copyright", mp3fi.szCopyright);
       }

      printf("\n");
      printf("Press any key to continue\n");
      _getch();
     }

    return 0;
   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -