Nightingale Forums

Full Version: Restore data from broken database or broken file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

some days ago I had a bluesrceen on my windows 7 computer when connecting my mobile phone. At this moment Nightingale was open in the Sync folder but not running.
After the automatic reboot of my computer I did a test with chkdsk which ended without problems.
If I start Nightingale now I have similar problems as another user is having at the moment: all my playlists are gone. Only the folders of the playlists are visible. I have already opened the main database of Nightingale with SQLiteManager in Firefox which was possible without problems. The playlists still seem to be in the database. It is possible to see my playlists with the Add-On "Playlist Export Tool" and in the Sync-folder. I did a test with exporting one of the playlists successfully, so it seems I might get them back.
But when I create a playlist it is only visible as long as Nightingale is open. As soon as I close and reopen Nightingale it isn't visible any more. So there is probably something broken in my profile.
If I add a new profile everything seems to be ok but of course I haven't got the data of the old profile.

Is there a way to find the broken piece of my profile so that I can transfer the data from the broken profile to a new profile?


I would really like to keep my playlists, my song ratings and the "item-added" entries of my database. Does anybody know how to do this?

I already tried with the Add-On RatingFile but this stops without any notification at 94%. I didn't find any temp-data where I could see on which data record the problem occured.


Best regards

Stefan
(10-30-2015, 03:59 PM)Nafetz Wrote: [ -> ]All my playlists are gone. Only the folders of the playlists are visible. I have already opened the main database of Nightingale with SQLiteManager in Firefox which was possible without problems. The playlists still seem to be in the database. It is possible to see my playlists with the Add-On "Playlist Export Tool" and in the Sync-folder. I did a test with exporting one of the playlists successfully, so it seems I might get them back.
But when I create a playlist it is only visible as long as Nightingale is open. As soon as I close and reopen Nightingale it isn't visible any more. So there is probably something broken in my profile.
If I add a new profile everything seems to be ok but of course I haven't got the data of the old profile.

Is there a way to find the broken piece of my profile so that I can transfer the data from the broken profile to a new profile?
In theory, finding and fixing the issue might be possible. But finding the exact problem is a time-consuming task, thus a new profile is usually faster (Re-creating playlists from files and manually re-creating smart playlists, and migrating the rest with BackupBird or plain RatingFile). Still, I'd like to point out one possible cases that is indeed fixable without much effort.

Nevertheless, copy your profile folder and store an unchanged backup in case something goes wrong. Only try the following stuff after you made a backup of the whole profile folder!

The first possible cause I could think of would be a messed up playlist folder structure. Playlist folders are implemented as an add-on (from before Nightingale was forked from Songbird), thus you can wipe that add-on's settings to remove all folders. For that, close Nightingale, and remove the line
Code:
user_pref("extensions.playlistfolders.JSON", "<<content>>");
where <<content>> is dependent on your folders and playlists (but, usually, quite long). After doing so, attempt to re-start Nightingale -- you should now see your playlists again, but without folders. If that did not work, I'd recommend a new profile. (Oh, and don't change the setting via about:config, that won't work, as playlist folders are written from memory when exiting Nightingale)

(10-30-2015, 03:59 PM)Nafetz Wrote: [ -> ]I would really like to keep my playlists, my song ratings and the "item-added" entries of my database. Does anybody know how to do this?

I already tried with the Add-On RatingFile but this stops without any notification at 94%. I didn't find any temp-data where I could see on which data record the problem occured.
To debug RatingFile issues, set the "extensions.ratingfile.debug" setting to true (via about:config). Then, open an error console (tools menu) and export your ratings again while keeping an eye on the error console. You should see quite verbose output of what's going on, and thus might be able to see which file causes the issue. I'd recommend you to use the special version I posted in another thread on this forum providing even more debug output.
(10-31-2015, 11:49 AM)rsjtdrjgfuzkfg Wrote: [ -> ]To debug RatingFile issues, set the "extensions.ratingfile.debug" setting to true (via about:config). Then, open an error console (tools menu) and export your ratings again while keeping an eye on the error console. You should see quite verbose output of what's going on, and thus might be able to see which file causes the issue. I'd recommend you to use the special version I posted in another thread on this forum providing even more debug output.

Thank you very much!
Yesterday evening I found a solution which was very exhausting because I didn't know how to do this right - maybe just at the time you wrote your answer (there was no answer here when I started).

Because I didn't know how to get the debug information, I opened the file dialog.js in the ratingfile source code and changed the line

Code:
if (!this._prefs.getBoolPref("debug"))

into

Code:
if (this._prefs.getBoolPref("debug"))


Then I opened the error console and excluded in the loop every data record where ratingfile stopped with

Code:
if (i == 11581 || i == 11586 || ............) {
} else {
...all the code of the loop...
}


It took some time but after 20 - 30 tries I got all database information that I needed and was able to import it into a new profile. The values "i" of the data-records unfortunately didn't match with the id of the database, so I could't exactly find out which records caused the problems. But chances are very high that all of them were playlists, because the errors occured in ranges, where several playlists where stored. This could be seen in the debug information of the error console.

So I will try your suggestions to get back my playlists in the next week. I have a lot of them and exporting and re-importing would be a lot of work, too. So maybe your suggestion may save a lot of time.
I will send a message here how it worked Wink

Thank you very much for your help!
(10-31-2015, 07:36 PM)Nafetz Wrote: [ -> ]
Code:
if (i == 11581 || i == 11586 || ............) {
} else {
...all the code of the loop...
}
It took some time but after 20 - 30 tries I got all database information that I needed and was able to import it into a new profile. The values "i" of the data-records unfortunately didn't match with the id of the database, so I could't exactly find out which records caused the problems.

As you seem to be able to code a technical note: I'd assume an exception is thrown for the files you have issues with; the version I linked in the last post will catch and report any exception, and I'd like to know the issue, as it is certainly a bug in RatingFile. If you do not wish to wait for the whole export, you could simply change your version to
Code:
if (i == 11581 || i == 11586 || ............) {
  try {
    ...all the code of the loop...
  } catch (e) {
    this._debugMsg("FATAL: " + e);
    return false;
  }
} else {
}
This is the final message when inserting you code:

Code:
RatingFile: FATAL: [Exception... "Component returned failure code: 0x80070057
(NS_ERROR_ILLEGAL_VALUE) [sbILibrary.getItemByIndex]"  nsresult: "0x80070057
(NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://ratingfile/content/dialog.js ::
anonymous :: line 173"  data: no]

In my modified dialog.js line 173 is

Code:
var ent = mainLibView.getItemByIndex(i);
(10-31-2015, 11:49 AM)rsjtdrjgfuzkfg Wrote: [ -> ]The first possible cause I could think of would be a messed up playlist folder structure. Playlist folders are implemented as an add-on (from before Nightingale was forked from Songbird), thus you can wipe that add-on's settings to remove all folders. For that, close Nightingale, and remove the line
Code:
user_pref("extensions.playlistfolders.JSON", "<<content>>");
where <<content>> is dependent on your folders and playlists (but, usually, quite long). After doing so, attempt to re-start Nightingale -- you should now see your playlists again, but without folders. If that did not work, I'd recommend a new profile. (Oh, and don't change the setting via about:config, that won't work, as playlist folders are written from memory when exiting Nightingale)

Too bad - didn't work. After that the playlist folders and playlists were gone but still were visible in the sync-folder and in the playlist export Add-On. And still it isn't possible to add a new playlist that is visible after a restart of Nightingale.

Seems to me the only chance is to export and import into a new profile...?
Thanks for the exception log.

(11-01-2015, 07:08 AM)Nafetz Wrote: [ -> ]Seems to me the only chance is to export and import into a new profile...?

Unless someone else comes up with another guess on the issue, sadly yes. Unless, of course, you wish to manually debug Nightingale to determine the source of the error. When knowing the exact issue, it might be able to fix the problem. But I'd recommend the new profile.