Try 30 days of free premium.

New version of Episode Guide (Android) Sync for testing

deleted wrote 5 years ago: 1

Hi @David @Jan,

I have reworked the sync code in a new version of Episode Guide and would like your feedback before I release it.

Previously the 2-way sync would do the following:

-> Upload all shows that were in the Episode Guide App to TvMaze account (Runs only once, ever)

-> Download all shows and episodes from TvMaze account and save them to Episode DB (Run every 24 hrs)

-> Delete any shows from Episode Guide DB that weren't on TvMaze account (Run every 24 hrs)

-> Upload Shows and Episodes from Episode Guide to TvMaze account (Run every 24 hrs)

The problem which occured in the past code was that the sync process was hitting the rate limit on the api and not downloading all the shows and episodes. Which meant when it came to compare the DB to TvMaze, Shows and Episodes were deleted from TvMaze.

To fix this I have added exponential backoff to the networking code so it will retry when it can't get a connection etc. I have also disabled the mass upload feature in this release.

What I am proposing to release in this next version would be the following:

-> Download Shows and Episodes from TvMaze account and save locally to Episode Guide.

-> When a user adds a new show or marks an episode in Episode Guide it will be uploaded to TvMaze account.

To confirm there is no mass uploading in this release, I want to make sure the download process is stable before I look at enabling the part that syncs all existing existing Episode Guide Shows and Episodes at once.

Would you be happy for me to create a forum post to ask for beta testers again or would you prefer to test this version internally first?


gazza911 wrote 5 years ago: 1

Just a bit of advice for the sync itself:

Have your own marked dates
When you sync to TVMaze, compare the marked date against TVMaze's date.
Then you can sync the changes in the necessary direction (TVMaze --> Episode Guide / Episode Guide --> TVMaze) dependent on which date is greater (or neither if the same).

Note: Episodes marked through the watchlist (in bulk) will have a timestamp of 0, so that's a unique situation

If the timestamp on TVMaze is 0 and there's already data in your Episode Guide, I'd recommend prompting the user as to which should get updated and allowing them to cancel the sync.

If you really want to ensure that everything's as the user wants it, you can add a preview in which will show what will get changed on both TVMaze and Episode Guide before actually performing those changes.

deleted wrote 5 years ago: 1

Thanks Gazza I will take a look at using the timestamp to refine the sync further.

gazza911 wrote:
Just a bit of advice for the sync itself:

Have your own marked dates
When you sync to TVMaze, compare the marked date against TVMaze's date.
Then you can sync the changes in the necessary direction (TVMaze --> Episode Guide / Episode Guide --> TVMaze) dependent on which date is greater (or neither if the same).

Note: Episodes marked through the watchlist (in bulk) will have a timestamp of 0, so that's a unique situation

If the timestamp on TVMaze is 0 and there's already data in your Episode Guide, I'd recommend prompting the user as to which should get updated and allowing them to cancel the sync.

If you really want to ensure that everything's as the user wants it, you can add a preview in which will show what will get changed on both TVMaze and Episode Guide before actually performing those changes.


david wrote 5 years ago: 1

If you're unsure about the sync algorithm, why not create a full backup of the user's existing TVmaze watch status on the first run? Just download the full "/user/episodes" endpoint and save it as JSON somewhere on the device. That way, if something is messed up it's relatively easy to restore to the previous state.

deleted wrote 5 years ago: 1

david wrote:
If you're unsure about the sync algorithm, why not create a full backup of the user's existing TVmaze watch status on the first run? Just download the full "/user/episodes" endpoint and save it as JSON somewhere on the device. That way, if something is messed up it's relatively easy to restore to the previous state.

Thanks David that's a good idea.

Try 30 days of free premium.