CN117932107A - Audio file retrieval method and system - Google Patents

Audio file retrieval method and system Download PDF

Info

Publication number
CN117932107A
CN117932107A CN202410099060.7A CN202410099060A CN117932107A CN 117932107 A CN117932107 A CN 117932107A CN 202410099060 A CN202410099060 A CN 202410099060A CN 117932107 A CN117932107 A CN 117932107A
Authority
CN
China
Prior art keywords
file
storage medium
searched
audio file
audio
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410099060.7A
Other languages
Chinese (zh)
Inventor
张金才
赵定金
明德
李昌绿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Baolun Electronics Co ltd
Original Assignee
Guangdong Baolun Electronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Baolun Electronics Co ltd filed Critical Guangdong Baolun Electronics Co ltd
Priority to CN202410099060.7A priority Critical patent/CN117932107A/en
Publication of CN117932107A publication Critical patent/CN117932107A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a system for retrieving an audio file, comprising the following steps: according to the method, a device identification code and a file system structure of a storage medium to be searched are obtained according to a device node corresponding to the storage medium to be searched, analysis of directory complexity is carried out according to the file system structure, a check value of the directory structure is generated according to the analysis, historical device identification is carried out according to the device identification code, a search path of an audio file is determined according to the identification result, when the audio file is not the historical device, the audio file is searched according to traversal of the file system structure, when the audio file is the historical device, check value matching is carried out, directory modification detection is carried out according to the matching result, a final audio path is determined according to the detection result and the historical audio file information, and therefore the efficiency and accuracy of audio file searching are improved.

Description

Audio file retrieval method and system
Technical Field
The invention relates to the technical field of information processing, in particular to an audio file retrieval method and system.
Background
In the context of large data, a large amount of data or files may be stored in a database or other mobile storage device, and identifying whether a file is an audio file from among the large amount of files generally involves detection of file type and analysis of content, where file type detection typically involves two methods, one that determines whether the file is an audio type based on a file extension, one that reads a digital signature of the file to determine the type of the file, and content analysis of the file typically involves examining file header information or using an audio feature extraction algorithm.
In the prior art, with the development of technology, audio player apparatuses are applied to more and more fields, and various types of removable storage media are supported, and the capacity of the removable storage media is also increased.
In the prior art, a player device detects the type of each file stored in a mobile storage medium according to an extension, and judges whether the file is of an audio type, but a mode depending on the extension of the file is easily affected by renaming the file or changing the extension, and misjudgment easily occurs in the detection process, so that the accuracy of detecting the file type is low.
When the player device uses the magic signature of the read file to determine the type of the file, each time the storage medium is removed, the player device opens each file to read the magic signature, the header information and the content analysis, thereby determining whether the file is an audio file, which consumes a great deal of time and computation and reduces the efficiency of audio file retrieval.
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; 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 set of files includes the number of files per unit complexity file;
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;
Reading file information of each file according to the file position, and judging whether each file is the first audio file or not according to the file information; 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; the file system structure comprises a first directory structure, a first file modification time and a first file position;
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 catalogs in the storage medium to be searched according to the first catalog structure, deleting empty catalogs in the plurality of initial catalogs and acquiring a plurality of catalogs; 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;
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 files with unit complexity to generate a plurality of file sets; wherein each set of files includes the number of files per unit complexity file;
The verification value generation unit is used for verifying the file path of each file set in the plurality of file sets, and generating and recording 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 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; 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.
Drawings
Fig. 1: the embodiment of the invention discloses a flow diagram of an audio file retrieval method;
fig. 2: the embodiment of the invention discloses a structural schematic diagram of an audio file retrieval system.
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; the file system structure comprises a first directory structure, a first file modification time and a first file position.
In this embodiment, this step is: 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.
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.
Step 102: and 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 this embodiment, the steps mainly include: 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 set of files includes the number of files per unit complexity file; 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.
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.
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 this embodiment, this step is: after the device identification code of the current device to be searched is obtained through analysis, searching historical device identification code information stored in a preset database according to the device identification code, judging that the device to be searched is historical device when the device identification code exists in the historical device identification code information, and judging that the device to be searched is new device when the device identification code does not exist in the historical device identification code information.
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 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 the first audio file position corresponding to each first audio file.
In this embodiment, this step is: 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; reading file information of each file according to the file position, and judging whether each file is the first audio file or not according to the file information; the file information comprises magi c signatures, file header information and file contents.
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: and 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.
Step 106: 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 the 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 the matching result.
In this embodiment, this step is: firstly, acquiring a directory structure and file modification time corresponding to current equipment to be searched, matching the directory structure and the file modification time with a history directory structure and history file modification time stored in the identified history play record, and determining that the files in the same storage medium are modified when the directory structure is different or the file modification time is inconsistent.
Step 107: when the storage medium to be searched is judged to be subjected to file modification, the second catalogue subjected to file modification is determined and traversed by comparing the first catalogue structure check value with the second catalogue structure check value corresponding to the second catalogue structure, each second audio file in the second catalogue is obtained, and the position of the second audio file corresponding to each second audio file is recorded.
In this embodiment, this step is: when the storage medium to be searched is judged to be subjected to file modification, the same directory complexity analysis method and the same 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 history play records one by one, so that which directory is modified is determined, the files under the directory are identified again, 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.
Step 108: 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.
In this embodiment, this step is: 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.
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 an equipment node corresponding to a storage medium to be retrieved, and obtain and store an equipment identification code and a file system structure of the storage medium to be retrieved through the equipment node; the file system structure comprises a first directory structure, a first file modification time and a first file position.
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 catalogs in the storage medium to be searched according to the first catalog structure, deleting empty catalogs in the plurality of initial catalogs and acquiring a plurality of catalogs; and 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.
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 files with unit complexity to generate a plurality of file sets; wherein each set of files includes the number of files per unit complexity file.
The verification value generation unit is used for verifying the file path of each file set in the plurality of file sets, and generating and recording 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.
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; 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.

Claims (10)

1. An audio file retrieval method, comprising:
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; 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 structure 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.
2. The method for retrieving an audio file according to claim 1, wherein said constructing a device node corresponding to a storage medium to be retrieved, and obtaining and storing, by the device node, a device identification code and a 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.
3. The method for retrieving an audio file according to claim 1, wherein the analyzing, according to the first directory structure, the directory complexity of the storage medium to be retrieved by a preset complexity analysis method, and generating the first directory structure check value corresponding to the storage medium to be retrieved, 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 set of files includes the number of files per unit complexity file;
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.
4. The method for retrieving audio files according to claim 1, wherein traversing file information of each file in the storage medium to be retrieved by the device node according to the first file location, filtering each first audio file in the storage medium to be retrieved according to the file information, comprises:
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;
Reading file information of each file according to the file position, and judging whether each file is the first audio file or not according to the file information; the file information comprises a magic signature, file header information and file content.
5. The method for retrieving an audio file according to claim 1, wherein said generating second audio file information corresponding to said storage medium to be retrieved in combination with said history audio file information according to said second audio file position comprises:
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.
6. The audio file retrieval system is characterized by comprising a node construction module, a catalog analysis module, an equipment 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; the file system structure comprises a first directory structure, a first file modification time and a first file position;
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.
7. The audio file retrieval system as recited in claim 6, wherein the node building module comprises 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.
8. The audio file retrieval system as recited in claim 6, wherein the catalog analysis module comprises 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 catalogs in the storage medium to be searched according to the first catalog structure, deleting empty catalogs in the plurality of initial catalogs and acquiring a plurality of catalogs; 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;
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 files with unit complexity to generate a plurality of file sets; wherein each set of files includes the number of files per unit complexity file;
The verification value generation unit is used for verifying the file path of each file set in the plurality of file sets, and generating and recording 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.
9. The audio file retrieval system as recited in claim 6, wherein the file retrieval module comprises a file locating 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; the file information comprises a magic signature, file header information and file content.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements an audio file retrieval method according to any one of claims 1-5.
CN202410099060.7A 2024-01-23 2024-01-23 Audio file retrieval method and system Pending CN117932107A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410099060.7A CN117932107A (en) 2024-01-23 2024-01-23 Audio file retrieval method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410099060.7A CN117932107A (en) 2024-01-23 2024-01-23 Audio file retrieval method and system

Publications (1)

Publication Number Publication Date
CN117932107A true CN117932107A (en) 2024-04-26

Family

ID=90757029

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410099060.7A Pending CN117932107A (en) 2024-01-23 2024-01-23 Audio file retrieval method and system

Country Status (1)

Country Link
CN (1) CN117932107A (en)

Similar Documents

Publication Publication Date Title
US8352259B2 (en) Methods and apparatus for audio recognition
US6185569B1 (en) Linked data structure integrity verification system which verifies actual node information with expected node information stored in a table
US6983289B2 (en) Automatic identification of DVD title using internet technologies and fuzzy matching techniques
US8751494B2 (en) Constructing album data using discrete track data from multiple sources
JP2008083914A (en) Electronic apparatus having data reproduction function
US20140244582A1 (en) Apparatus and Methods for Selective Location and Duplication of Relevant Data
CN111125298A (en) Method, equipment and storage medium for reconstructing NTFS file directory tree
CN102609531B (en) Method for pegging files according to keywords
CN106528830B (en) A kind of method and apparatus for restoring file index catalogue
EP2531902A1 (en) Automatically bookmarking digital content
US20050238314A1 (en) Recording system, recording apparatus, recording method, recording program and recording medium
KR101688629B1 (en) Method and apparatus for recovery of file system using metadata and data cluster
CN117932107A (en) Audio file retrieval method and system
CN108021472B (en) Format recovery method of ReFS file system and storage medium
WO2011037821A1 (en) Generating a synthetic table of contents for a volume by using statistical analysis
US7856443B2 (en) Automatic identification of DVD title using internet technologies and fuzzy matching techniques
CN114968663A (en) Database content recovery method and system
WO2014061846A1 (en) Method for generating index for processing mixed query, method for processing mixed query, and recording medium for recording index material structure
US6738771B2 (en) Data processing method, computer readable recording medium, and data processing device
CN113535962A (en) Data storage method, device, electronic device, program product and storage medium
KR20110023580A (en) The method and system for recovering data
US8156072B2 (en) Method for fast reconstruction of content information
CN113312007B (en) Method and device for counting directory and file sizes in NTFS (New technology File System)
JP4563313B2 (en) Content feature registration method, content search method, apparatus, and program
CN116303492A (en) Data management method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination