🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.free.newsservers
Article #132828

--

#132828
From: JeffRelf.F-M.FM
Date: Tue, 25 Jan 2011 00:30
100 lines
7107 bytes
<PRE>
To generate the following ( sorted ) list of songs,
I parsed ID3/v1, ID3/v2, ID3/v3 ( MP3 ), and ASF ( WMA ) formats.
Don't ask me why I did it, but I did.

In JeffRelf.F-M.FM/X.CPP, the code ( PlayList() ) is:

struct MP3_T ;  typedef MP3_T  *LmP ;  
struct MP3_T { wchar_t Title[44], Album[44], Artist[44];  };
typedef LmP  *LmA ;  struct LmT { LmA BB, PP, EE ;  };  LmT  Lm ;
LmP & ✚✚( LmT &amp;Lm ) { return ✚✚< LmT, LmA, LmP> ( Lm, 1 ) ;  }

inline int Cmp3( LmP  Case, LmP  Vs ) { if ( rv = strCmp( Case->Artist, Vs->Artist ), rv ) return  rv ;
  if ( rv = strCmp( Case->Album, Vs->Album ), rv ) return  rv ;  return  strCmp( Case->Title, Vs->Title );  }

Sort·by·Artist·Album·Title( LmA _B,  LmA _E ) {  if ( _E <= _B ) return;
  LmA  BB = _B - 1, EE = _E + 1 ;  LmP  Std = _B[ ( _E - _B ) / 2 ];
  LOOP { while ( Cmp3( *++BB, Std ) < 0 );  while( EE >= BB && Cmp3( *--EE, Std ) > 0 );
    if ( EE <= BB ) break;  LmP T = *BB ; * BB = *EE ; *EE = T ;  }
  Sort·by·Artist·Album·Title( _B, EE < _E ? EE : -- EE );   Sort·by·Artist·Album·Title( EE + 1, _E ); }

Dump( _LnP _B, int Len ) { _LnP _P = _B - 1 ; int WasBin = 0 ; D = B·Sh, *D = 0 ;
  Loop( Len ) { 
       Ch = *++_P, !Ch ? ( D += Str( D, L"·" ), 0 )
     : Ch >= 32 && Ch < 127 ? ( D += Str( D, L"%s%c", WasBin ? L"⦆" : L"", Ch ), WasBin = 0 ) 
     : ( D += Str( D, L"%s%x", WasBin ? L"" : L"⦅", Ch ), WasBin = 1 );
     if ( D > B·Sh + ColsWin - 6 ) _Sh( D = B·Sh );  }  _Sh( B·Sh );  }  
         
PlayList() { LnP File·Nam, t1, t2 ; DirA  CD( L"C:/__/MP3" ), ClearScreen, Ln.PP-- ; static const szPeek = 1999 ;
  //  L"Gravity .WMA"  //  L"*.MP3"   L"A Woman Rain .WMA"
  if ( DirI( L"*", 0 ) ) { int rv = 0, szIn ; _B = _LnP( B·Sh· ); __LnP F·Nam, F ;
    LOOP { gF·Nam  if ( Is_a_Dir ) Skip·Nam 
      File·Nam = FF_Rec.cFileName, fp = fopen( File·Nam, L"rb" ), szIn = fread( _B, 1, szPeek, fp );
      MP3_T &amp;MP3 = *( ✚✚( Lm ) = LmP( MallocTmp( sizeof MP3_T  ) ) );
      File·Nam[ er( szStr( File·Nam ) - 4, 43 ) ] = 0, Str( MP3.Title, L"%s", File·Nam ), *MP3.Album = *MP3.Artist = 0 ;
      if ( !_EqN( __LnP( _B ), "ID3", 3  ) ) { uchar _B2[128];
        _Sz = filelength( fileno( fp ) ), fseek( fp, _Sz - 128, 0 ), _Sz = fread( _B2, 1, 128, fp ), fclose( fp );
        if ( _EqN( __LnP( _B2 ), "TAG", 3  ) ) { fclose( fp );
          Str( B = MP3.Artist, L"%.30S", _B2 + 33 ); E = &amp;Ch»( i0, B ); WhileBac( Ch <= 32 );  P[1] = 0 ;
          Str( B = MP3.Album, L"%.30S", _B2 + 63 ); E = &amp;Ch»( i0, B ); WhileBac( Ch <= 32 );  P[1] = 0 ;  continue ;  } 

       _P = _B -1, _E = _B + szIn - 16 ;
       while ( ++_P < _E, memcmp( _P, "\x33\x26\xb2\x75\x8e\x66\xcf\x11\xa6\xd9\x00\xaa\x00\x62\xce\x6c", 16 ) );
       ushort Skip = *pShort( _P += 16 + 8 ), Len = *pShort( _P += 2 );
       Str( MP3.Artist, L"%.*s", er( Len, 43 ), _P += Skip + 8 ), _P += Len ;
       //  Dump( _P, _E - _P );
       while ( ++_P < _E, !EqN( LnP( _P ), L"WM/AlbumTitle", 13 ) );
       if ( _P < _E ) Skip = *pShort( _P - 2 ), Len = *pShort( _P += Skip + 2 ), _P += 2,
           Skip = Str( MP3.Album, L"%.*s", er( Len, 43 ), _P );  }
         
      else { int V2 = _B[3] == 2 ;  rv = 0, _P = _B + 5 ; { Loop( 4 ) rv <<= 7, rv |= *++_P ;  } _P++, rv += 10 ;
        szIn = rv <= szPeek ? rv : fread( _B + szPeek, 1, rv - szPeek, fp ) + szPeek, fclose( fp ); 
        while( _P < _B + szIn - 8 ) { F·Nam = __LnP( _P ); //  F·Nam-1,m  _B,m  _P-2,m  TAL  _P-_B
          _Sz = 0, _P += 3 - V2 ; { Loop( 4 - V2 ) _Sz <<= 8, _Sz |= *++_P ;  }
          F = __LnP( _P += 4 - 2 * V2 ), _P += --_Sz ; if ( _P > _B + szIn ) break ; if ( _Sz <= 0 ) continue ;
          if ( rv = *LnP(F) == UTF·16·Sig ) F += 2, _Sz -= 2, _Sz /= szChr ;
          if ( V2 ? _EqN( F·Nam, "TP1", 3 ) : _EqN( F·Nam, "TPE1", 4 ) || !*MP3.Artist && _EqN( F·Nam, "TPE2", 4 ) )
            Str( MP3.Artist, rv ? L"%.*s" : L"%.*S", er( _Sz, 43 ), F );
          else if ( V2 ? _EqN( F·Nam, "TAL", 3 ) : _EqN( F·Nam, "TALB", 4 ) )
             Str( MP3.Album, rv ? L"%.*s" : L"%.*S", er( _Sz, 43 ), F );  } } } }

  Sort·by·Artist·Album·Title( Lm.BB, Lm.PP ); t1 = t2 = _T, *t1 = *t2 = 0 ; 
  { LoopXx( Lm, Lm ) {
      if ( T = P->Artist, *T && !Eq( t1, T ) ) t1 = T, Sh( L"\n%s:", T );
      if ( T = P->Album, rv = *T && !Eq( t2, T ) ) t2 = T ;
      Sh( L"  %-34s  %s", P->Title, !rv ? ( !*T ? L"" : L"  ''" ) : T );  } }
  Sh( Sep ), TopReport, CD( X·Dir ); SaveReport( L"◥◤", Extend );  }

The Laurel Canyon Animal Company:
  A Woman Rain                        Music From The Pink Dolphins

John Mayer:

  Covered in Rain                     As/Is
  Split Screen Sadness                  ''
  All We Ever Do Is Say Goodbye       Battle Studies
  Assassin                              ''
  Do You Know Me                        ''
  Edge Of Desire                        ''
  Perfectly Lonely                      ''
  War Of My Life                        ''
  Belief                              Continuum
  Dreaming with a Broken Heart          ''
  Gravity                               ''
  I'm Gonna Find Another You            ''
  Stop This Train                       ''
  The Heart Of Life                     ''
  Home Life                           Heavier Things
  Wheel                                 ''
  Quiet                               Inside Wants Out
  Victoria                              ''
  3X5                                 Room for Squares
  Great Indoors                         ''
  St. Patrick's Day                     ''
  Free Fallin', Acoustic (2008)       Where the Light Is: John Mayer Live in Los 
  I Don't Need No Doctor (2008)         ''
  I Don't Trust Myself (2008)           ''
  Slow Dancing in a Burning Room (2008) ''
  The Heart of Life (2008)              ''
  Why Georgia (2008)                    ''
Technical Details
Message-ID: <JeffRelf.F-M.FM@_Ed.2011_Jan.24_.4.30.pm>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!num2.nntp.ams.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!aqua.octanews.net!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news-xxxfer.readnews.com!news-out.readnews.com!postnews7.readnews.com!not-for-mail
References: <JeffRelf.F-M.FM@_B7.2011_Jan.24_.9.57.am> <ihkiqq$klq$1@pcls6.std.com>

Show Full Headers
Complete Article Headers
Message-ID: <JeffRelf.F-M.FM@_Ed.2011_Jan.24_.4.30.pm>
Subject: --
Date: Tue, 25 Jan 2011 00:30:46 +0000
From: JeffRelf.F-M.FM
References: <JeffRelf.F-M.FM@_B7.2011_Jan.24_.9.57.am> <ihkiqq$klq$1@pcls6.std.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!num2.nntp.ams.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!aqua.octanews.net!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news-xxxfer.readnews.com!news-out.readnews.com!postnews7.readnews.com!not-for-mail
Content-Type: Text/HTML; charset=UTF-8
Newsgroups: alt.free.newsservers,alt.astronomy,sci.physics
User-Agent: JeffRelf.F-M.FM/X.TXT
Lines: 100
NNTP-Posting-Host: 92c5f7c1.blocknews.net
X-Trace: DXC=Igm`4:hbK0gA2TKGfO>eFmG^cGF?V7mId`R<[=bBmKoh[i?96V=^cLd7aQl>=UiKGfJZlTlmN@ADi@5I:EO[o54c
X-Complaints-To: abuse@blocknews.net