How to export a downloaded music file from the iOS Cool music Box
The contents of this article are used for technical study, do not use for improper use, otherwise the consequences are at your own risk.
Music files downloaded from the cool music iOS version, when viewed through software such as Sync Assistant, find that music files are named after a string of numbers. Find the files by searching online and trying them out, and find that they are all audio files changed to the file name. As long as you modify the filename, you can play the same as normal music.
Reference URL: http://blog.sina.com.cn/s/blog_4d5428240101enzu.html
Found a software on the Internet, that is, the above reference URL of the software, but the use of the time there is a problem, prompted subscript out of range, the program can not continue to execute. So I decided to use Java to write one to deal with.
First copy the Cloud.db database file from the phone, the SQLite database file. With SQLite Database Browser Open, see the inside and the music is closely related to the main three table,playlistsinfo saved playlist information, the field title is the list name, the field ID is the list ID. Playlistmusics saves the music and playlist correspondence, the field title, artist and so on as the music information, the RID is the music resource ID, the field playlist_id corresponds to the owning playlist ID. Musicresource is the music information and file correspondence, the field file is the corresponding filename, format is the file, the RID is the music resource ID.
So the workflow of the program is this: 1, first fromMusicresource Each read the rid of each piece of music;2, through the RIDs inFind in Playlistmusicsplaylist_id, may not be found, may be more than one, because the same music may be in multiple lists, here simply take the largestplaylist_id, usually should be relatively new playlists;3. Then infound in Playlistsinfoplaylist_id the correspondingplaylist name, as a subfolder of the target music;4. Finally rename the source file to "singer name-song name." Extension and move to the destination folder.
to facilitate the exchange of learning, here to provide the source code of the program.
Import Java.io.file;import java.sql.connection;import Java.sql.drivermanager;import Java.sql.resultset;import Java.sql.statement;import Java.util.arraylist;import Java.util.list;public class Test {/** * store data structures for playlists * * @author JZJ */static class PlayList {int id; String Name;public PlayList (string name, int id) {this.name = Name;this.id = ID;}} Database full path static final string db_path = "g:\\ios\\cloud.db";//source folder static final string src_dir = "g:\\ios\\music\\";//target text Folder static final String Dst_dir = "g:\\ios\\music1\\";p ublic static void Main (string[] args) throws Exception {Class.forName ("Org.sqlite.JDBC"); Connection conn = Drivermanager.getconnection ("jdbc:sqlite:" + Db_path); Statement STAT1 = Conn.createstatement (); Statement stat2 = Conn.createstatement ();//Read playlist list<playlist> lists = new arraylist<test.playlist> (); ResultSet rs_list = Stat1.executequery ("select * from Playlistsinfo;"); while (Rs_list.next ()) {final int id = rs_list.getint ("id"); final String name = rs_list.geTstring ("title"); switch (name) {//Ignore these list case "local song": Case "Default list": Case "recently played": Case "My Station": Break;case "I like to listen to":d efault: Lists.add (New PlayList (name, id));}} Read music information ResultSet rs_res = stat1.executequery ("select * from Musicresource;"); while (Rs_res.next ()) {//source file path String fname = rs_res.getstring ("file"); if (fname = = NULL | | fname.length () = = 0)//if file The word blank skips the continue; String Src_path = Src_dir + fname; File src = new file (Src_path), if (!src.exists ())//If the source file does not exist, skip continue;//to get the music ridint rid = rs_res.getint ("rid");//Find the Music In the playlist ID, if not found, -1resultset RS_PL = stat2.executequery (New StringBuilder ("Select playlist_id from Playlistmusics where Rid= "). Append (RID). Append (';'). ToString ()); int playlist_id = -1;while (Rs_pl.next ()) {//By default a song is placed in the most numbered playlist (that is, the newly created list) int p_id = Rs_pl.getint (" playlist_id "); if (p_id > playlist_id) playlist_id = p_id;} Rs_pl.close ();//destination folder path StringBuilder b2 = new StringBuilder (dst_dir); if (playlist_id >= 0) {String Playlist_name = Get Playlist (lists, playlist_id); if (playlist_name! = null) {b2.append (playlist_name). append (' \ \ ');}} String dir = b2.tostring (); new File (dir). Mkdirs ();//target file name: Artist-song name. Extension "StringBuilder B3 = new StringBuilder (); B3.appen D (rs_res.getstring ("Artist")). Append ("-"). Append (rs_res.getstring ("title")). Append ('. '). Append (rs_res.getstring ("format")); String Dst_path = dir + b3.tostring ();//move and rename file DST = new file (Dst_path); Src.renameto (DST);//Output Information System.out.println ( New StringBuilder (Src_path). Append ("--->"). Append (Dst_path));} Rs_res.close (); Conn.close ();} Static String getplaylist (list<playlist> lists, int playlist_id) {for (PlayList pl:lists) {if (pl.id = = Playlist_i d) return pl.name;} return null;}}
because of the database operations involved, you need to add a database support package to the Java project, see this articlehttp://ttitfly.iteye.com/blog/143934using nested package: Sqlitejdbc-v037-nested.jar
The audio files are copied out, put in the program src_dir the specified directory, the database file cloud.db saved in Db_path specified location, set the target folder Dst_dir, execute the program can be rectified export audio files, measured more than 700 music, Renaming and moving work takes less than a minute.
Complete project can be downloaded here: http://pan.baidu.com/s/1hGNT0