gremlin icon indicating copy to clipboard operation
gremlin copied to clipboard

Problem and Solution List

Open jack4455667788 opened this issue 10 years ago • 2 comments

It would be a shame for all my trials to be repeated needlessly. Hence my documentation here.

Issue 1 - Why the heck won't gimport (/usr/bin/gimport) import my file? It always fails! Solution 1 - You must supply the full path to gimport. (ie. /var/mobile/Documents/file.mp3)

Issue 2 - Gimport said it imported successfully, but I don't see my song in the music player. Solution 2 - It may very well have succeeded after all! Song titles are not extracted from the filename but, rather, id3 tags embedded within the file. You can install and use ffmpeg for your tagging purposes from your iphone. Once the tags are fixed, the file should load properly.

Issue 3 - I fixed the tags on my file, and it LOOKS like it is right, but when I play the file, it shows "Unknown Artist" instead of the artist metadata tag value. Solution 3 - Holy hannah! I have no idea what causes this one and I am not even sure gimport had anything to do with it, but just in case it did, I'll leave my solution. You will need to know a tiny bit of SQL, but I used sqlite database browser (sourceforge, free) to edit /var/mobile/Media/iTunes_Control/iTunes/MediaLibrary.sqlitedb. I am not 100% what thing I deleted that was correct (the only other things were the items in album and album_artist that corresponded to the problem album title. You may have to do that as well), but I believe it is one of the last things I removed from the item and item_artist tables. The two queries I used were:

select * from item where album_pid = "3048132399436039054";

select * from item_artist where item_artist_pid = "884934370101945114";

First, Always back up your files before editing them willy nilly.!!

The first of the two values (album_pid) I retrieved from the album table. First I looked for the name of the album that was causing me issue (all songs from that album showed the wrong artist when played), that brought me back the album_pid. The results of the first query will contain the item_artist_pid value you need for the second query. I have left both queries as select statements. Once you have the item_artist_pid and album_pid from the queries, convert them both to delete statements and execute them against the sqlitedb. I am not sure if you need to remove the old uploaded files, or reboot the phone, but I did both. I think you might just be able to kill/restart the music player and that could do it.

** By this point it has occurred to me that the bugs I am facing are as a result of my tomfoolery and not gimport, but nevertheless I press on, documenting as I go **

Issue 4 - I've added a whole bunch of songs of one artist from multiple albums, but when I tell siri to play all songs by "artist name", it only plays some from one of the albums and doesn't play the rest. Also if I tell siri explicitly to play "album name that isn't the one that plays when I ask for all songs by artist name" it recognizes that the album is there, but never plays any songs (manually playing the song/album works) Solution 4 - Back to sqlite! I don't know if it is by design, or a result of the import method gimport uses, but it seems that unlike every other album artist in table item_artist, when files are imported via gimport the series name and series sort fields are populated (I am not sure if this has bearing on this issue, just a noted difference between all files imported via iTunes vs gimport). The real problem is that when adding music for the same artist but a different album, gimport creates more rows in item_artist with the same artist name! I don't know why it does that, I don't know if purchased songs do the same, but I know it does not work that way, as when the new row is created, it gets a new item_artist_pid and that is what is assigned to the new item (song) in the item table.

First you need to get the relevant album_artist_pid from the album table.

select * from album_artist where album_artist = "Artist Name Goes Here";

You need to delete all but one of the rows in item_artist (that correspond to the artist you are having issue with, I also made sure that series_name and sort_series_name fields are blank).

select * from item_artist where item_artist = "Artist Name Goes Here"; --this will return all the rows currently in there, choose one you want to keep and remove all the other ones

Re-run the above query after you delete all but one, and copy down the item_artist_pid. Now that you have the album_artist_pid and the item_artist_pid, you can run the query below to fix the issue.

update item set item_artist_pid = "Retrieved from last query" where album_artist_pid = "Retrieved from first query";

After overwriting the old MediaLibrary.sqlitedb (you did back it up before you started any of this right?!?!?) with the one you have just edited, all you need to do is kill the media player app or restart to have the changes take effect. Now siri will do what you asked her to.

jack4455667788 avatar Jul 01 '14 02:07 jack4455667788

Interesting stuff! But doesn't the MediaLibrary.sqlitedb get overwritten from a backup when you make changes to it directly? That used to seem to be the case at least.

newenglander avatar Nov 11 '14 19:11 newenglander

@yfrancis Could you open source the whole code so we can work on an update for iOS 8?

albertschulz avatar Dec 31 '14 15:12 albertschulz