|
|
|
@ -25,6 +25,7 @@ import com.fongmi.android.tv.db.dao.SiteDao; |
|
|
|
import com.fongmi.android.tv.db.dao.TrackDao; |
|
|
|
import com.fongmi.android.tv.db.dao.TrackDao; |
|
|
|
import com.fongmi.android.tv.utils.Util; |
|
|
|
import com.fongmi.android.tv.utils.Util; |
|
|
|
import com.github.catvod.utils.Path; |
|
|
|
import com.github.catvod.utils.Path; |
|
|
|
|
|
|
|
import com.github.catvod.utils.Prefers; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
@ -57,6 +58,7 @@ public abstract class AppDatabase extends RoomDatabase { |
|
|
|
if (db.exists()) Path.copy(db, new File(Path.tv(), db.getName())); |
|
|
|
if (db.exists()) Path.copy(db, new File(Path.tv(), db.getName())); |
|
|
|
if (wal.exists()) Path.copy(wal, new File(Path.tv(), wal.getName())); |
|
|
|
if (wal.exists()) Path.copy(wal, new File(Path.tv(), wal.getName())); |
|
|
|
if (shm.exists()) Path.copy(shm, new File(Path.tv(), shm.getName())); |
|
|
|
if (shm.exists()) Path.copy(shm, new File(Path.tv(), shm.getName())); |
|
|
|
|
|
|
|
Prefers.backup(new File(Path.tv(), NAME + "-pref")); |
|
|
|
App.post(callback::success); |
|
|
|
App.post(callback::success); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -66,9 +68,11 @@ public abstract class AppDatabase extends RoomDatabase { |
|
|
|
File db = new File(Path.tv(), NAME); |
|
|
|
File db = new File(Path.tv(), NAME); |
|
|
|
File wal = new File(Path.tv(), NAME + "-wal"); |
|
|
|
File wal = new File(Path.tv(), NAME + "-wal"); |
|
|
|
File shm = new File(Path.tv(), NAME + "-shm"); |
|
|
|
File shm = new File(Path.tv(), NAME + "-shm"); |
|
|
|
|
|
|
|
File pref = new File(Path.tv(), NAME + "-pref"); |
|
|
|
if (db.exists()) Path.move(db, App.get().getDatabasePath(db.getName()).getAbsoluteFile()); |
|
|
|
if (db.exists()) Path.move(db, App.get().getDatabasePath(db.getName()).getAbsoluteFile()); |
|
|
|
if (wal.exists()) Path.move(wal, App.get().getDatabasePath(wal.getName()).getAbsoluteFile()); |
|
|
|
if (wal.exists()) Path.move(wal, App.get().getDatabasePath(wal.getName()).getAbsoluteFile()); |
|
|
|
if (shm.exists()) Path.move(shm, App.get().getDatabasePath(shm.getName()).getAbsoluteFile()); |
|
|
|
if (shm.exists()) Path.move(shm, App.get().getDatabasePath(shm.getName()).getAbsoluteFile()); |
|
|
|
|
|
|
|
if (pref.exists()) Prefers.restore(pref); |
|
|
|
App.post(callback::success); |
|
|
|
App.post(callback::success); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|