Disclosure of Invention
In order to solve the technical problems, the invention discloses an audio file retrieval method and system, which improves the efficiency and accuracy of audio file retrieval.
To achieve the above object, in a first aspect, the present invention discloses an audio file retrieval method, including:
constructing a device node corresponding to a storage medium to be searched, and obtaining and storing a device identification code and a file system structure of the storage medium to be searched through the device node, wherein the file system structure comprises a first directory structure, a first file modification time and a first file position;
According to the first directory structure, analyzing directory complexity of the storage medium to be searched through a preset complexity analysis method, and generating a first directory structure check value corresponding to the storage medium to be searched;
inquiring historical equipment identification code information stored in a preset database according to the equipment identification code, and judging whether the storage medium to be searched is historical equipment or not;
when the storage medium to be searched is not history equipment, traversing file information of each file in the storage medium to be searched through the equipment node according to the first file position, screening each first audio file in the storage medium to be searched according to the file information, and recording a first audio file position corresponding to each first audio file;
generating and storing first audio file information corresponding to the storage medium to be searched according to the equipment identification code, the first audio file position, the file system format and the first directory structure check value;
When the storage medium to be searched is a history device, acquiring history audio file information corresponding to the storage medium to be searched from the database according to the device identification code, matching the first directory structure and the first file modification time with a second directory structure and a second file modification time in the history audio file information, and judging whether the storage medium to be searched is subjected to file modification according to a matching result;
When the storage medium to be searched is judged to be subjected to file modification, determining and traversing a second directory subjected to file modification by comparing the first directory structure check value with a second directory structure check value corresponding to the second directory structure, obtaining each second audio file in the second directory, and recording the position of the second audio file corresponding to each second audio file;
and generating second audio file information corresponding to the storage medium to be retrieved according to the second audio file position and combining the historical audio file information.
When the audio file searching method disclosed by the invention is used for searching the audio file of the storage medium to be searched, firstly, the equipment node corresponding to the storage medium to be searched is constructed, so that the storage medium is directly opened by using the equipment node to analyze file data when the file searching is carried out, the technical means that a file system abstract layer is added to read the file data in the prior art is avoided, the file reading speed is improved, after the equipment node is constructed, the equipment identification code and the file system format in the storage medium to be searched are read from the equipment node, meanwhile, the directory structure check value corresponding to the storage medium to be searched is constructed by using the directory structure in the file system format, the modification of the directory of the file is checked according to the directory structure check value, and then when the storage medium to be searched is judged to be a history device, the modified file directory can be directly locked by the check, the audio file is searched by directly traversing the modified directory, the whole storage medium is avoided, the file traversing efficiency is improved, simultaneously, after the directory structure check value is constructed, the equipment identification code and the file is read from the current position by using the directory structure check value, the identification code is combined with the audio file identification code, the audio file is read from the current position of the audio file identification code, the audio file is read, the file identification information is recorded according to the audio file identification code is read from the new file identification position, and the audio file identification information is recorded according to the audio file identification information, and generating and storing the first audio file information corresponding to the storage medium to be searched, so that the audio file can be directly read according to the stored first audio file information when the storage medium is used next time, the repeated reading time is reduced, and the audio file searching efficiency is improved.
As a preferred example, the constructing the device node corresponding to the storage medium to be retrieved, and obtaining and storing, by the device node, the device identifier and the file system structure of the storage medium to be retrieved includes:
Automatically detecting the plug operation of the storage medium to be searched according to a preset operation detection method, and creating a device node corresponding to the storage medium to be searched when the plug operation of the storage medium to be searched is detected;
And acquiring a file system format corresponding to the storage medium to be searched through a preset file system type query instruction, accessing the equipment node according to the file system format, and analyzing to acquire an equipment identification code and a file system structure corresponding to the storage medium to be searched.
The invention constructs the equipment node so that the storage medium can be directly opened for data reading through the equipment node, the frequency of file opening and closing is reduced, the efficiency of file reading is improved, and then the equipment identification code and the file system structure of the storage medium are read by the equipment node, so that the identification of later equipment and the identification of files are facilitated, and the efficiency and the accuracy of file reading are improved.
As a preferred example, the analyzing, according to the first directory structure, the directory complexity of the storage medium to be searched by a preset complexity analysis method, and generating a first directory structure check value corresponding to the storage medium to be searched includes:
Acquiring a plurality of initial directories in the storage medium to be searched according to the first directory structure, and deleting empty directories in the plurality of initial directories to acquire a plurality of directories;
Acquiring a catalog letter corresponding to each catalog in the plurality of catalogs, and sequencing the plurality of catalogs according to the sequence from big to small of the catalog letters;
Dividing the files in the plurality of catalogues according to the first file position and the preset number of files with unit complexity to generate a plurality of file sets, wherein each file set comprises the files with the number of files with unit complexity;
verifying the file path of each file set in the plurality of file sets to generate and record a unique value corresponding to each file set;
And generating a first directory structure check value corresponding to the storage medium to be searched according to the sorting and the unique value corresponding to each file set.
According to the first file position, the file path is checked by the calculated file complexity corresponding to each directory, and the check value corresponding to the complexity is generated by utilizing the complexity and is used for checking whether the file is deleted or added when the storage medium is used for audio file retrieval next time, so that the reading efficiency of the audio file is improved.
As a preferred example, traversing, by the device node, file information of each file in the storage medium to be retrieved according to the first file location, and filtering, according to the file information, each first audio file in the storage medium to be retrieved includes:
According to the first file position, shifting to a file position corresponding to each file in the storage medium to be searched by accessing the equipment node;
And reading the file information of each file according to the file position, and judging whether each file is the first audio file according to the file information, wherein the file information comprises a magic signature, file header information and file content.
According to the invention, whether the current file is an audio file is determined by reading magi c signature, file header information and content analysis of the file, so that the finally screened file is an audio file from multiple aspects, and the accuracy of extracting the audio file is improved.
As a preferred example, the generating, according to the second audio file location, the second audio file information corresponding to the storage medium to be retrieved in combination with the historical audio file information includes:
and generating second audio file information corresponding to the storage medium to be searched by replacing the historical audio file position corresponding to the second directory with the second audio file position.
According to the invention, the complete audio file list can be generated only by identifying the audio files under the modified directory under the condition that the same storage medium is changed, so that the efficiency of reading the audio files is improved.
The invention discloses an audio file retrieval system, which comprises a node construction module, a catalog analysis module, a device identification module, a file retrieval module, an information generation module, a file detection module, a catalog modification module and an information update module;
The node construction module is used for constructing equipment nodes corresponding to the storage media to be searched, and acquiring and storing equipment identification codes and file system structures of the storage media to be searched through the equipment nodes, wherein the file system structures comprise a first directory structure, first file modification time and first file positions;
The catalog analysis module is used for analyzing the catalog complexity of the storage medium to be searched through a preset complexity analysis method according to the first catalog structure and generating a first catalog structure check value corresponding to the storage medium to be searched;
The device identification module is used for inquiring historical device identification code information stored in a preset database according to the device identification code and judging whether the storage medium to be searched is historical device or not;
The file retrieval module is used for traversing the file information of each file in the storage medium to be retrieved through the equipment node according to the first file position when the storage medium to be retrieved is not history equipment, screening each first audio file in the storage medium to be retrieved according to the file information, and recording the first audio file position corresponding to each first audio file;
The information generating module is used for generating and storing first audio file information corresponding to the storage medium to be searched according to the equipment identification code, the first audio file position, the file system format and the first directory structure check value;
The file detection module is used for acquiring historical audio file information corresponding to the storage medium to be searched from the database according to the equipment identification code when the storage medium to be searched is historical equipment, matching the first directory structure and the first file modification time with a second directory structure and the second file modification time in the historical audio file information, and judging whether the storage medium to be searched is subjected to file modification according to the matching result;
the catalog modification module is used for determining and traversing a second catalog of file modification through comparing the first catalog structure check value with a second catalog structure check value corresponding to the second catalog structure when the storage medium to be searched is judged to be subjected to file modification, obtaining each second audio file in the second catalog, and recording a second audio file position corresponding to each second audio file;
the information updating module is used for generating second audio file information corresponding to the storage medium to be searched according to the second audio file position and the historical audio file information.
When the audio file retrieval system disclosed by the invention is used for retrieving an audio file from a storage medium to be retrieved, firstly, a device node corresponding to the storage medium to be retrieved is constructed, so that the storage medium is directly opened by using the device node to analyze file data when the file retrieval is carried out, the technical means that a file system abstract layer is added to read file data is avoided, the file reading speed is improved, after the device node is constructed, a device identification code and a file system format in the storage medium to be retrieved are read from the device node, meanwhile, a directory structure check value corresponding to the storage medium to be retrieved is constructed by using a directory structure in the file system format, so that the modification of the directory of the file is checked according to the directory structure check value, and then when the storage medium to be retrieved is judged to be a history device, the modified file directory can be directly locked by the check, the retrieval of the audio file is carried out by directly traversing the modified directory, the whole storage medium is avoided, the file traversing efficiency is improved, simultaneously, after the directory structure check value is constructed, the device identification code and the file identification code is read from the new storage medium to the current storage medium, the audio file is read from the audio file storage medium according to the audio file identification code, the audio file identification system identification code is read from the new file identification position, and the audio file identification information is recorded when the audio file is read from the audio file identification medium, and generating and storing the first audio file information corresponding to the storage medium to be searched, so that the audio file can be directly read according to the stored first audio file information when the storage medium is used next time, the repeated reading time is reduced, and the audio file searching efficiency is improved.
As a preferable example, the node building module includes a node creation unit and a node access unit;
the node creation unit is used for automatically detecting the plug operation of the storage medium to be searched according to a preset operation detection method, and creating a device node corresponding to the storage medium to be searched when the plug operation of the storage medium to be searched is detected;
The node access unit is used for obtaining a file system format corresponding to the storage medium to be searched through a preset file system type query instruction, accessing the equipment node according to the file system format, and analyzing and obtaining an equipment identification code and a file system structure corresponding to the storage medium to be searched.
The invention constructs the equipment node so that the storage medium can be directly opened for data reading through the equipment node, the frequency of file opening and closing is reduced, the efficiency of file reading is improved, and then the equipment identification code and the file system structure of the storage medium are read by the equipment node, so that the identification of later equipment and the identification of files are facilitated, and the efficiency and the accuracy of file reading are improved.
As a preferable example, the catalog analysis module includes a catalog acquisition unit, a complexity analysis unit, and a check value generation unit;
The catalog acquisition unit is used for acquiring a plurality of initial catalogues in the storage medium to be searched according to the first catalog structure, deleting empty catalogues in the plurality of initial catalogues to acquire a plurality of catalogues;
The complexity analysis unit is used for dividing the files in the plurality of catalogues according to the first file position and the preset number of the files with unit complexity to generate a plurality of file sets, wherein each file set comprises the files with the number of the files with unit complexity;
the verification value generation unit is used for verifying the file path of each file set in the plurality of file sets to generate and record a unique value corresponding to each file set, and generating a first directory structure verification value corresponding to the storage medium to be searched according to the sorting and the unique value corresponding to each file set.
According to the first file position, the calculated file complexity under each directory is used as the complexity check value of the directory, so that whether the file is deleted or added is checked when the storage medium is used for audio file retrieval next time, and the reading efficiency of the audio file is improved.
As a preferable example, the file retrieval module includes a file positioning unit and an information reading unit;
The file positioning unit is used for shifting to the file position corresponding to each file in the storage medium to be searched by accessing the equipment node according to the first file position;
The information reading unit is used for reading the file information of each file according to the file position and judging whether each file is the first audio file according to the file information, wherein the file information comprises a magic signature, file header information and file content.
According to the invention, whether the current file is an audio file is determined by reading the magic signature, the file header information and the content analysis of the file, so that the finally screened file is an audio file from multiple aspects, and the accuracy of extracting the audio file is improved.
In a third aspect, the present invention discloses a computer readable storage medium, in which a computer program is stored, which when being executed by a processor, implements an audio file retrieval method according to the first aspect.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
The embodiment discloses an audio file retrieval method, and a specific implementation flow of the retrieval method may refer to fig. 1, and mainly includes steps 101 to 106, where the steps include:
Step 101, constructing a device node corresponding to a storage medium to be searched, and obtaining and storing a device identification code and a file system structure of the storage medium to be searched through the device node, wherein the file system structure comprises a first directory structure, a first file modification time and a first file position.
In the embodiment, the method comprises the steps of automatically detecting the plug operation of the storage medium to be searched according to a preset operation detection method, creating a device node corresponding to the storage medium to be searched when the plug operation of the storage medium to be searched is detected, acquiring a file system format corresponding to the storage medium to be searched through a preset file system type query instruction, accessing the device node according to the file system format, and analyzing and obtaining a device identification code and a file system structure corresponding to the storage medium to be searched.
Specifically, in a certain possible implementation manner provided in this embodiment, when the storage medium to be retrieved is a mobile storage medium, including a mobile hard disk or a USB, and the like, when the mobile storage medium is inserted into an audio playing device or other devices for audio file retrieval, an insertion operation of the mobile storage medium is detected first by a preset operation detection method, then a device node corresponding to the mobile storage medium is created, and no mounting is required, and optionally, when the device node is created, operations such as device registration, device identification or device allocation may also be performed on the mobile storage medium, so that the above optional operations are selected according to a device requirement connected to the mobile storage medium.
Preferably, after the device node is created by referring to the audio playing device and connecting the mobile storage medium, a device unplugging message of the mobile storage medium is uploaded, a file system type query instruction can be used to monitor the message and analyze the unplugging/plugging action and the device node thereof from the message, further, the file system type query instruction can be a netlink instruction, when the netlink instruction is selected for query, a file system format of the mobile storage medium is obtained by using blkid, and the device node is directly opened to read data (as with reading a file), and a device identification code and a file system structure corresponding to the mobile storage medium are analyzed according to a corresponding file system specification, wherein the file system structure comprises a directory structure, a file modification time and a file position.
In this embodiment, the step constructs the device node so that the device node can directly open the storage medium to perform data reading, so as to reduce the frequency of opening and closing the file, improve the efficiency of file reading, and then utilize the device node to read the device identification code and the file system structure of the storage medium to facilitate the identification of later-stage devices and the identification of the file, and improve the efficiency and the accuracy of file reading.
And 102, analyzing the directory complexity of the storage medium to be searched through a preset complexity analysis method according to the first directory structure, and generating a first directory structure check value corresponding to the storage medium to be searched.
In the embodiment, the method mainly comprises the steps of obtaining a plurality of initial directories in a storage medium to be searched according to a first directory structure, deleting empty directories in the plurality of initial directories to obtain a plurality of directories, obtaining directory letters corresponding to each directory in the plurality of directories, sorting the plurality of directories according to the sequence from large to small of the directory letters, dividing files in the plurality of directories according to the first file position and the preset number of files with unit complexity to generate a plurality of file sets, wherein each file set comprises files with the number of files with unit complexity, checking file paths of each file in the plurality of file sets to generate and record unique values corresponding to each file set, and generating a first directory structure check value corresponding to the storage medium to be searched according to the sorting and the unique values corresponding to each file set.
Specifically, in a certain specific implementation manner provided in this embodiment, according to the parsed directory structure, the empty directory of the mobile storage medium is filtered, the file path of each file is temporarily stored according to the file position, the file information is obtained by sorting according to the order of the directory letters from large to small, that is, the position, the size and other information of the files in the storage medium is obtained, according to the temporarily stored file path, 1 complexity above every m files is calculated according to the unit of directory, if the number of files under all the same-level directories does not reach m, 1 complexity is recorded in the file calculation under the previous-level directory, and so on, then the calculated file path under the directory of each 1 complexity is used and checked to calculate a unique value and recorded, and the file is checked whether to delete or add files or not by using the storage medium next time.
When the directory complexity is acquired, generating a check value of a directory structure in a mobile storage medium according to the directory complexity, specifically, after acquiring file paths and sequencing according to the directory, referring 500 files to be 1 complexity, sequentially using and checking the first 500 file paths to calculate the check value, analyzing the directory where 500 files are located and recording, if the directory where 500 files are located at the current complexity has other files, merging all files under the directory into calculation, and if the calculation of the last directory is less than 500 files, calculating according to the 1 complexity.
Optionally, in the generating process of the check value, the analysis of the check value may be performed according to the directory depth, for example, the directory depth is analyzed, if the directory depth is 6 levels, then all files under the 3 rd level directory and all files under the sub-directory thereof are used and checked to calculate the check value, wherein all files under the 2 nd level directory and all files under the sub-directory thereof (only directory path, including no files) are used and checked to calculate the check value, and all files under the 1 st level directory and all files under the sub-directory thereof (only directory path, including no files) are used and checked to calculate the check value.
In this embodiment, according to the first file location, the step performs verification of the file path by using the calculated file complexity corresponding to each directory, and generates a verification value corresponding to the complexity, which is used to verify whether to delete or add a file when the storage medium is used to retrieve an audio file next time, thereby improving the reading efficiency of the audio file.
And step 103, inquiring historical equipment identification code information stored in a preset database according to the equipment identification code, and judging whether the storage medium to be searched is historical equipment or not.
In the embodiment, after the device identification code of the current device to be searched is obtained through analysis, historical device identification code information stored in a preset database is searched according to the device identification code, when the device identification code exists in the historical device identification code information, the device to be searched is judged to be historical device, and when the device identification code does not exist in the historical device identification code information, the device to be searched is judged to be new device.
Specifically, referring to the mobile storage medium inserted into the audio playing device, the device node is utilized to analyze and obtain a unique UU ID of the mobile storage medium, that is, a unique universal identification code, and query a history playing record stored by the audio playing device according to the unique universal identification code, and determine whether the unique universal identification code exists in the history playing record, when the unique universal identification code exists in the history playing record, the mobile storage medium is illustrated as being inserted into the audio playing device before, and if the unique universal identification code does not exist in the history playing record, the mobile storage medium is illustrated as being inserted into the audio playing device for the first time.
Step 104, when the storage medium to be searched is not a history device, traversing file information of each file in the storage medium to be searched through the device node according to the first file position, screening each first audio file in the storage medium to be searched according to the file information, and recording a first audio file position corresponding to each first audio file.
In the embodiment, the method comprises the steps of shifting to a file position corresponding to each file in a storage medium to be retrieved by accessing the equipment node according to the first file position, reading file information of each file according to the file position, and judging whether each file is the first audio file according to the file information, wherein the file information comprises magi c signature, file header information and file content.
Specifically, in a certain implementation manner provided in this embodiment, the file information corresponding to each file is read through shifting to a corresponding file position according to the file position, and whether the file is an audio file is determined according to the file information, and specifically, the file information of each file includes a magi c signature, header information and content of the file, where the "magi c" signature of the file is a specific identifier of the file, usually a byte sequence of the header of the file, and is used for identifying the type of the file. This identification, which is typically composed of a number of fixed byte values or characters, can help the computer system determine the format of the files in order to properly interpret and process them, different types of audio files corresponding to different file offsets and magi c values, wherein the present embodiment provides magi c values for 38 audio formats, see the following table:
After the file is determined to be an audio file according to magi c signature, file header information and content analysis of the file, recording the file position corresponding to the current file, and simultaneously recording the total audio duration corresponding to the current audio file while recording the file position of the audio file.
In this embodiment, the step determines whether the current file is an audio file by reading magi c signature, header information and content analysis of the file, and ensures that the finally screened file is an audio file from multiple aspects, thereby improving the accuracy of extracting the audio file.
Step 105, generating and storing first audio file information corresponding to the storage medium to be searched according to the equipment identification code, the first audio file position, the file system structure and the first directory structure check value.
And 106, when the storage medium to be searched is a historical device, acquiring historical audio file information corresponding to the storage medium to be searched from the database according to the device identification code, matching the first directory structure and the first file modification time with a second directory structure and the second file modification time in the historical audio file information, and judging whether the storage medium to be searched is subjected to file modification according to the matching result.
In this embodiment, the method includes the steps of firstly obtaining a directory structure and a file modification time corresponding to a current device to be retrieved, matching the directory structure and the file modification time with a history directory structure and a history file modification time stored in the identified history play record, and determining that a file in the same storage medium is modified when the directory structure is different or the file modification time is inconsistent.
And 107, when the storage medium to be retrieved is judged to be subjected to file modification, determining and traversing a second directory subjected to file modification by comparing the first directory structure check value with a second directory structure check value corresponding to the second directory structure, obtaining each second audio file in the second directory, and recording the position of the second audio file corresponding to each second audio file.
When the storage medium to be searched is judged to be modified, the same directory complexity analysis method and check value generation method are utilized to generate check values corresponding to directory structures in the current storage medium, then the check values are compared with the check values stored in the historical play records one by one, so that which directory is modified is determined, the files under the directory are re-identified for one time, audio files under the directory are obtained, and the file positions corresponding to each audio file under the directory are recorded.
Preferably, when the storage medium to be searched is not subjected to file modification, a history-stored audio file path is directly extracted from a database, and the storage medium to be searched is subjected to audio file searching according to the audio file path.
And step 108, generating second audio file information corresponding to the storage medium to be retrieved according to the second audio file position and combining the historical audio file information.
In this embodiment, the step is to generate the second audio file information corresponding to the storage medium to be retrieved by replacing the historical audio file location corresponding to the second directory with the second audio file location.
On the other hand, the embodiment also discloses an audio file retrieval system, and the specific structural composition of the system can refer to fig. 2, and the system comprises a node construction module 201, a catalog analysis module 202, a device identification module 203, a file retrieval module 204, an information generation module 205, a file detection module 206, a catalog modification module 207 and an information update module 208.
The node construction module 201 is configured to construct a device node corresponding to a storage medium to be retrieved, and obtain and store, through the device node, a device identification code and a file system structure of the storage medium to be retrieved, where the file system structure includes a first directory structure, a first file modification time, and a first file location.
The directory analysis module 202 is configured to analyze, according to the first directory structure, directory complexity of the storage medium to be searched by using a preset complexity analysis method, and generate a first directory structure check value corresponding to the storage medium to be searched.
The device identification module 203 is configured to query historical device identification code information stored in a preset database according to the device identification code, and determine whether the storage medium to be retrieved is a historical device.
The file retrieval module 204 is configured to traverse file information of each file in the storage medium to be retrieved through the device node according to the first file location when the storage medium to be retrieved is not a history device, screen each first audio file in the storage medium to be retrieved according to the file information, and record a first audio file location corresponding to each first audio file.
The information generating module 205 is configured to generate and store first audio file information corresponding to the storage medium to be retrieved according to the device identification code, the first audio file location, the file system format, and the first directory structure check value.
The file detection module 206 is configured to obtain, when the storage medium to be retrieved is a history device, history audio file information corresponding to the storage medium to be retrieved from the database according to the device identification code, match the first directory structure and the first file modification time with a second directory structure and a second file modification time in the history audio file information, and determine whether file modification occurs to the storage medium to be retrieved according to a result of the matching.
The directory modification module 207 is configured to determine and traverse a second directory in which file modification occurs by comparing the first directory structure check value with a second directory structure check value corresponding to the second directory structure when it is determined that file modification occurs to the storage medium to be retrieved, obtain each second audio file in the second directory, and record a second audio file location corresponding to each second audio file.
The information updating module 208 is configured to generate second audio file information corresponding to the storage medium to be retrieved according to the second audio file position and in combination with the historical audio file information.
In this embodiment, the node building module 201 includes a node creating unit and a node accessing unit.
The node creation unit is used for automatically detecting the plug operation of the storage medium to be searched according to a preset operation detection method, and creating the equipment node corresponding to the storage medium to be searched when the plug operation of the storage medium to be searched is detected.
The node access unit is used for obtaining a file system format corresponding to the storage medium to be searched through a preset file system type query instruction, accessing the equipment node according to the file system format, and analyzing and obtaining an equipment identification code and a file system structure corresponding to the storage medium to be searched.
In this embodiment, the catalog analysis module 202 includes a catalog acquisition unit, a complexity analysis unit, and a check value generation unit.
The catalog acquisition unit is used for acquiring a plurality of initial catalogues in the storage medium to be searched according to the first catalog structure, deleting empty catalogues in the plurality of initial catalogues to acquire a plurality of catalogues, acquiring catalog letters corresponding to each catalog in the plurality of catalogues, and sequencing the plurality of catalogues according to the sequence from big to small of the catalog letters.
The complexity analysis unit is used for dividing the files in the plurality of catalogues according to the first file position and the preset number of the files with unit complexity to generate a plurality of file sets, wherein each file set comprises the files with the number of the files with unit complexity.
The verification value generation unit is used for verifying the file path of each file set in the plurality of file sets to generate and record a unique value corresponding to each file set, and generating a first directory structure verification value corresponding to the storage medium to be searched according to the sorting and the unique value corresponding to each file set.
In this embodiment, the file retrieving module 204 includes a file locating unit and an information reading unit.
The file locating unit is used for shifting to the file position corresponding to each file in the storage medium to be searched by accessing the equipment node according to the first file position.
The information reading unit is used for reading the file information of each file according to the file position and judging whether each file is the first audio file according to the file information, wherein the file information comprises a magic signature, file header information and file content.
In addition to the above method and system, the present embodiment also discloses a computer readable storage medium, in which a computer program is stored, where the computer program when executed by a processor implements an audio file retrieval method described in the present embodiment.
In order to increase the file reading speed, reduce the frequency of opening and closing the file and avoid introducing other abstract layers to reduce the file reading speed, the method, the system and the storage medium disclosed by the embodiment can directly read file data, namely analyze the file system structure from the equipment node, traverse the position of each file to be read, shift to the corresponding position to read the magic signature, the file header information and the content analysis of the file so as to determine whether the file is an audio file, record information if the file is an audio file, and simultaneously, in order to efficiently and accurately complete the operation of identifying the audio file, the storage medium is frequently pulled and plugged when being used on a player device, and the user needs to improve the user experience on the premise of frequently deleting, adding and modifying the file, so that the secondary reading efficiency needs to be improved. If the audio file is changed, checking whether the audio file exists in the directory, if so, skipping the identification of the audio file, and then re-identifying other audio files in the directory. Therefore, a small amount of time can be used for completing the identification operation, if no change occurs, a file list can be immediately generated, and meanwhile, the invention can ensure the accuracy of audio file retrieval from multiple aspects by identifying file signatures, file contents and file header information to retrieve audio files, has wide support and can accurately identify various audio files.
The foregoing embodiments have been provided for the purpose of illustrating the general principles of the present invention, and are not to be construed as limiting the scope of the invention. It should be noted that any modifications, equivalent substitutions, improvements, etc. made by those skilled in the art without departing from the spirit and principles of the present invention are intended to be included in the scope of the present invention.