Position: Home page » Computing » Dragon Valley to shadow Forest Center

Dragon Valley to shadow Forest Center

Publish: 2021-05-29 12:14:02
1. Extract song information from MP3

besides music information, an MP3 song also contains information such as song name and singer. When we listen to music with Winamp software, the play list will read these information automatically. Most people like to download music from the Internet, but the downloaded MP3 file name is automatically named by the file upload system, which is not consistent with the song itself, so it brings great trouble to users. However, lazy people have their own way of doing things. Why don't we write a program to automatically read out the song information and rename MP3 files

the development process is written with C #

the extra information of an MP3 is stored at the end of the file, accounting for 128 bytes, including the following contents (we define a structure description):

public struct mp3info

{

public string identity// Tag, three bytes

public string title// Song name, 30 bytes

public string artist// Singer name, 30 bytes

public string album// Record, 30 bytes

public string year// Year, 4 characters

public string comment// Comment, 28 bytes

public char reserved1// Reserved bit, one byte

public char reserved2// Reserved bit, one byte

public char reserved3// Reserved bit, one byte

}

so we just need to read out the last 128 bytes of MP3 file and save them in this structure. The function definition is as follows:

/ /

/ / / gets the last 128 bytes of MP3 file

/

/ / / file name

/ / / returns byte array


private byte [] getlast128 (string file name)

{

FileStream FS = new FileStream (file name, FileMode. Open, fileaccess. Read)< br />
Stream stream = fs; < br />
stream.Seek(-128,SeekOrigin.End); < br />
const int seekPos = 128; < br />
int rl = 0; < br />
byte[] Info = new byte[seekPos]; < br />
rl = stream.Read(Info,0,seekPos); < br />
fs.Close(); < br />
stream.Close(); < br />
return Info;

}

take out the byte array returned above and save it to the MP3 info structure<

/ /

/ / / get information about MP3 songs

/ /

/ / / binary information intercepted from MP3 files

/ / / return an MP3 info structure


private MP3 info Getmp3 info (byte [] info)

{


mp3 info MP3 info = new MP3 info()< br />
string str = null; < br />
int i; < br />
int position = 0;// The starting value of the cycle is

int currentindex = 0// The current index value of info

/ / gets the tag ID

for (I = currentindex; i

{

str = str+(char)Info[i]; < br />
position++; < br />
}

currentIndex = position; < br />
mp3Info.identify = str;

/ / get the song name

STR = null< br />
byte[] bytTitle = new byte[30];// Read the song title into a separate array

int j = 0< br />
for(i = currentIndex; i

{

bytTitle[j] = Info[i]; < br />
position++; < br />
j++; < br />
}

currentIndex = position; < br />
mp3Info.Title = this.byteToString(bytTitle);

/ / get the singer name

STR = null< br />
j = 0; < br />
byte[] bytArtist = new byte[30];// Read the singer's name into a separate array

for (I = currentindex; i

{

bytArtist[j] = Info[i]; < br />
position++; < br />
j++; < br />
}

currentIndex = position; < br />
mp3Info.Artist = this.byteToString(bytArtist);

/ / get the record name

STR = null< br />
j = 0; < br />
byte[] bytAlbum = new byte[30];// Read the record name part into a separate array

for (I = currentindex; i

{

bytAlbum[j] = Info[i]; < br />
position++; < br />
j++; < br />
}

currentIndex = position; < br />
mp3Info.Album = this.byteToString(bytAlbum);

/ / get year

STR = null< br />
j = 0; < br />
byte[] bytYear = new byte[4];// Read the year part into a separate array

for (I = currentindex; i

{

bytYear[j] = Info[i]; < br />
position++; < br />
j++; < br />
}

currentIndex = position; < br />
mp3Info.Year = this.byteToString(bytYear);

/ / get comments

STR = null< br />
j = 0; < br />
byte[] bytComment = new byte[28];// Read the comments into a separate array

for (I = currentindex; i

{

bytComment[j] = Info[i]; < br />
position++; < br />
j++; < br />
}

currentIndex = position; < br />
mp3Info.Comment = this.byteToString(bytComment);

/ / get the reserved bit below

mp3info. Reserved1 = (char) info [+ + position]< br />
mp3Info.reserved2 = (char)Info[++position]; < br />
mp3Info.reserved3 = (char)Info[++position]; < br />
return mp3Info; <

}

the above program uses the following method:

/ /

/ / / convert byte array to string

/ /

/ / / byte array

/ > / / return converted String


private string byte toString (byte [] b)

{


encoding enc = encoding. Getencoding & quot; GB2312"); < br />
string str = enc.GetString(b); < br />
str = str.Substring(0,str.IndexOf('&# 92; 0') & gt;= 0 ? str.IndexOf('&# 92; 0') : str.Length);// Remove the useless characters

return str

}

how to change the name? The procere is as follows:

/ /

/ / change the file name

/

/ / file name

/ /



private bool rename (string filepath)

{

if (file. Exists (filepath))

{

< mp3info = new mp3info()< br />
mp3Info = this.getMp3Info(this.getLast128(filePath));// Read out the file information

mp3info. Artist = this. Deletenotvalue (mp3info. Artist)< br />
mp3Info.Title = this.DeleteNotValue(mp3Info.Title); < br />
if(mp3Info.Artist.Trim().Length==0)

{

mp3Info.Artist=" Unnamed & quot< br />
}

if(mp3Info.Title.Trim().Length==0)

{

mp3Info.Title=" Unknown songs & quot

}

try

{

/ / rename

file. Move (filepath, filepath. Substring (0, filepath. Tolower(). LastIndexOf & quote&# 92;&# 92;& quot;)). Trim() + "&# 92;&# 92;& quot; + & quot;(& quot; + mp3Info.Artist.Trim() + ")& quot; + mp3Info.Title.Trim() + ". mp3"); < br />
return true; < br />
}

catch(Exception)

{

return false; < br />
}

}

else

{

return false; < br />
}

}
2. 1. Enterprises are not responsible: they can report to the local mining management department and public security department as soon as possible

2. If an enterprise owns the mining right within the defined mining scope and other people steal the mining, it will violate the national laws and regulations and the legitimate mining right of the enterprise. The enterprise has the right to ask for compensation after finding out the person who stole the mining.
3. Extract song information from MP3

besides music information, an MP3 song also contains information such as song name and singer. When we listen to music with Winamp software, the play list will read these information automatically. Most people like to download music from the Internet, but the downloaded MP3 file name is automatically named by the file upload system, which is not consistent with the song itself, so it brings great trouble to users. However, lazy people have their own way of doing things. Why don't we write a program to automatically read out the song information and rename MP3 files

the development process is written with C #

the extra information of an MP3 is stored at the end of the file, accounting for 128 bytes, including the following contents (we define a structure description):

public struct mp3info

{

public string identity// Tag, three bytes

public string title// Song name, 30 bytes

public string artist// Singer name, 30 bytes

public string album// Record, 30 bytes

public string year// Year, 4 characters

public string comment// Comment, 28 bytes

public char reserved1// Reserved bit, one byte

public char reserved2// Reserved bit, one byte

public char reserved3// Reserved bit, one byte

}

so we just need to read out the last 128 bytes of MP3 file and save them in this structure. The function definition is as follows:

/ /

/ / / gets the last 128 bytes of MP3 file

/

/ / / file name

/ / / returns byte array


private byte [] getlast128 (string file name)

{

FileStream FS = new FileStream (file name, FileMode. Open, fileaccess. Read)< br />
Stream stream = fs;< br />
stream.Seek(-128,SeekOrigin.End);< br />
const int seekPos = 128;< br />
int rl = 0;< br />
byte[] Info = new byte[seekPos];< br />
rl = stream.Read(Info,0,seekPos);< br />
fs.Close();< br />
stream.Close();< br />
return Info;

}

take out the byte array returned above and save it to the MP3 info structure<

/ /

/ / / get information about MP3 songs

/ /

/ / / binary information intercepted from MP3 files

/ / / return an MP3 info structure


private MP3 info Getmp3 info (byte [] info)

{


mp3 info MP3 info = new MP3 info()< br />
string str = null;< br />
int i;< br />
int position = 0;// The starting value of the cycle is

int currentindex = 0// The current index value of info

/ / gets the tag ID

for (I = currentindex; i

{

str = str+(char)Info[i];< br />
position++;< br />
}

currentIndex = position;< br />
mp3Info.identify = str;

/ / get the song name

STR = null< br />
byte[] bytTitle = new byte[30];// Read the song title into a separate array

int j = 0< br />
for(i = currentIndex; i

{

bytTitle[j] = Info[i];< br />
position++;< br />
j++;< br />
}

currentIndex = position;< br />
mp3Info.Title = this.byteToString(bytTitle);

/ / get the singer name

STR = null< br />
j = 0;< br />
byte[] bytArtist = new byte[30];// Read the singer's name into a separate array

for (I = currentindex; i

{

bytArtist[j] = Info[i];< br />
position++;< br />
j++;< br />
}

currentIndex = position;< br />
mp3Info.Artist = this.byteToString(bytArtist);

/ / get the record name

STR = null< br />
j = 0;< br />
byte[] bytAlbum = new byte[30];// Read the record name part into a separate array

for (I = currentindex; i

{

bytAlbum[j] = Info[i];< br />
position++;< br />
j++;< br />
}

currentIndex = position;< br />
mp3Info.Album = this.byteToString(bytAlbum);

/ / get year

STR = null< br />
j = 0;< br />
byte[] bytYear = new byte[4];// Read the year part into a separate array

for (I = currentindex; i

{

bytYear[j] = Info[i];< br />
position++;< br />
j++;< br />
}

currentIndex = position;< br />
mp3Info.Year = this.byteToString(bytYear);

/ / get comments

STR = null< br />
j = 0;< br />
byte[] bytComment = new byte[28];// Read the comments into a separate array

for (I = currentindex; i

{

bytComment[j] = Info[i];< br />
position++;< br />
j++;< br />
}

currentIndex = position;< br />
mp3Info.Comment = this.byteToString(bytComment);

/ / get the reserved bit below

mp3info. Reserved1 = (char) info [+ + position]< br />
mp3Info.reserved2 = (char)Info[++position];< br />
mp3Info.reserved3 = (char)Info[++position];< br />
return mp3Info;<

}

the above program uses the following method:

/ /

/ / / convert byte array to string

/ /

/ / / byte array

/ > / / return converted String


private string byte toString (byte [] b)

{


encoding enc = encoding. Getencoding & quot; GB2312");< br />
string str = enc.GetString(b);< br />
str = str.Substring(0,str.IndexOf('&# 92; 0') & gt;= 0 ? str.IndexOf('&# 92; 0') : str.Length);// Remove the useless characters

return str

}

how to change the name? The procere is as follows:

/ /

/ / change the file name

/

/ / file name

/ /



private bool rename (string filepath)

{

< if (file. Exists (filepath))

{

< mp3info = new mp3info()< br />
mp3Info = this.getMp3Info(this.getLast128(filePath));// Read out the file information

mp3info. Artist = this. Deletenotvalue (mp3info. Artist)< br />
mp3Info.Title = this.DeleteNotValue(mp3Info.Title);< br />
if(mp3Info.Artist.Trim().Length==0)

{

mp3Info.Artist=" Unnamed & quot< br />
}

if(mp3Info.Title.Trim().Length==0)

{

mp3Info.Title=" Unknown songs & quot

}

try


/ / rename

file. Move (filepath, filepath. Substring (0, filepath. Tolower(). LastIndexOf & quote&# 92;&# 92;& quot;)). Trim() + "&# 92;&# 92;& quot; + & quot;(& quot; + mp3Info.Artist.Trim() + ")& quot; + mp3Info.Title.Trim() + ". mp3");< br />
return true;< br />
}

catch(Exception)

{

return false;< br />
}

}

else

{

return false;< br />
}

}
4. DF - LH

lists the usage of each disk device

similar to the following:
filesystem capacity used available used% mount point
/ dev / hda8 11g 6.0g 4.4g 58% /
/ dev / SHM 236m 0 236m 0% / dev / SHM
/ dev / sda1 56g 22G 35g 39% / MNT / sda1
5. The mine card can't be seen from its parameters and appearance.
even if the core turns yellow, it doesn't have to be mine card.
just like a thief doesn't write "thief 2" on his face, even if he is furtive, he doesn't have to be a thief.
the probability of gtx1060 6G mine card is relatively high
if he takes a packaged invoice, the probability will be lower,
if the seller sells many of the same cards at a time, the probability is relatively high, because mining is done with many graphics cards
6. Leverage is not necessarily related to whether to short. This is the market maker's or exchange's rule in their own choice and investment varieties
of course, there are those without leverage.
7. China's stock market cannot be short
8. Unknown_Error
9. It gives you a chance to sell short without leverage
10. http://www.aipai.com/c21/PD0nICoqISxqJWQvKg.htm
Hot content
Inn digger Publish: 2021-05-29 20:04:36 Views: 341
Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750