Сейчас многие знают о технологии MusicBrainz (сейчас MusicDNS), но немногие понимают, что это технология закрытая, проприетарная; а значит мы ее не можем совершенствовать. Однако существует и открытый вариант подобной технологии - FooID. Она изначально создана для модного аудиоплеера foobar2000, а значит - только для windows-платформ. Я сделал всего лишь линукс-версию этой библиотеки. libFooID
Вот описание протокола

foosic submissions protocol (rev.3 2006-5-1)
--------------------------------------------

UDP packets, to port 34000 @ in.foosic.org (always use DNS, never hardcode IP)

PACKETS
-------

    bytes  1      username length    > 0 <= 192, unsigned
           ....   username           <= 32 UTF-8 characters, max 192 bytes
           16     MD5 of password  
           1      command            unsigned
                      defined commands:
                        0 INSERT                              
                        1 INSERT_FINGERPRINT
       
    INSERT 
    bytes  1    titlelength    > 0 and <= 255, unsigned
           .... title          <= 100 UTF-8 characters, max 255 bytes
           1    artistlength   > 0 and <= 255, unsigned
           ...  artist         <= 100 UTF-8 characters, max 255 bytes
           1    albumlength    > 0 and <= 255, unsigned
           ...  album          <= 100 UTF-8 characters, max 255 bytes        
           1    genrelength    >= 0 (!) and <= 192, unsigned
           ...  genre          <= 32 UTF-8 characters, max 192 bytes
           4    length         Little-Endian, centiseconds, rounded, unsigned
           2    year           Little-Endian, unsigned
           1    va             unsigned, boolean
           1    tracknr        unsigned 
           
    INSERT_FINGERPRINT (extended version of INSERT, use this if you have FooID support)
    bytes  1    titlelength    > 0 and <= 255, unsigned
           .... title          <= 100 UTF-8 characters, max 255 bytes
           1    artistlength   > 0 and <= 255, unsigned
           ...  artist         <= 100 UTF-8 characters, max 255 bytes
           1    albumlength    > 0 and <= 255, unsigned
           ...  album          <= 100 UTF-8 characters, max 255 bytes        
           1    genrelength    >= 0 (!) and <= 192, unsigned
           ...  genre          <= 32 UTF-8 characters, max 192 bytes
           4    length         Little-Endian, centiseconds, rounded, unsigned
           2    year           Little-Endian, unsigned
           1    va             unsigned, boolean
           1    tracknr        unsigned 
           1    fp_version     unsigned
           2    fp_length      Little-Endian, unsigned
           ...  fingerprint    > 0 and == fp_length bytes
    
             
NOTES
-----
- No tags = no submission (BUT genre, length, year and tracknr are optional -> set to 0)
- Multiple artists: put together with ", " in alphabetical order.
- Various Artists: use real track artist, but set "va" flag
- Submit after song is playing for 60 seconds (watch out for seeking!). Songs < 60 seconds
  can be submitted when their playback finishes.
- You can either use INSERT or use INSERT_FINGERPRINT, but only one of the two per song.
- Checking passwords, getting stats and spelling corrections are handled via
  a seperate TCP protocol, and are completely optional (you only need to
  support this one for the system to work).


foosic libFooID fingerprint server protocol (rev.1 2006-5-10)
-------------------------------------------------------------

TCP connection, to port 35000 @ fp.foosic.org (always use DNS, never hardcode IP)

After initializing the connection, you submit a count of the number
of fingerprints you are going to submit, followed by an alternation
of fingerprint lengths and fingerprint data. 

Fingerprints belonging to the same album should be submitted as a group,
and if possible, in the correct order. 
Fingerprints from different albums should be submitted one by one.


           bytes  1   fp_count      unsigned
    
fp_count times |  1   fp_version    unsigned
               |  2   fp_length     Little-Endian, unsigned
               |  ... fingerprint   > 0 and == fp_length bytes
                      
After receiving the fingerprints, the server will start processing them.
As soon as it is done, or encounters an error, it will reply with tag
information for the songs in the same order as they were submitted,
but it may return multiple possibilites per song (num_hits).

          bytes   1   result_code   0 on success, >0 on error
                                    On error no more data follows.                                      
                                    
                                    Error codes
                                    -----------                                 
                                    1: Unknown fingerprint version
                                    2: Internal server error
                                    
fp_count times |  1   num_hits  unsigned

    num_hits times |  2   confidence    unsigned, Little-Endian ( 0 = 0.0% to 10000 = 100.00%)                          
                   |  1   tag_count     unsigned                            
                      
	    tag_count times |    1   tag_name_size      unsigned
	                    |    ... tag_name_data      <= 100 UTF-8 characters, max 255 bytes 
	                    |    1   tag_value_size     unsigned
	                    |    ... tag_value_data     <= 100 UTF-8 characters, max 255 bytes 
		                    
You can expect foosic to return the following tags (tag_name): 
    TITLE
    ARTIST
    ALBUM
    VA
    
It might also return the following:
    GENRE
    TRACKNUMBER
    YEAR
    anything else
    
Now, you can either go back to the top and submit either more songs, or terminate 
the connection by sending 0 as fp_count.

© Copyright ZooM. All Rights Reserved. Created By XVilka, 2005. Hosted by www.NAROD.ru