Introduction
Over the weekend, I once again attempted to self-host Jellyfin, an open-source media server solution, as I have done multiple times before. Generally, we use Emby as our in-house media server, but I prefer utilizing open-source software when possible. While trying to migrate the watched status from Emby to Jellyfin, I tried out a Python tool that I had used in the past, Emby2Jelly. However, I encountered an issue where it took an excessively long time to list out all the users on the server, and eventually timed out after a couple of hours. After examining the Emby2Jelly script, I realized that writing a similar tool in C# would likely be more efficient for me than attempting to fix the Python script, as I am not very proficient in the Python language.
Problem Statement and Planning
The primary problem was that manually entering watch history in Emby or Jellyfin can be incredibly time-consuming and laborious, especially if you have a large media library and have been watching content for an extended period. To save time and effort, an automated tool for migrating watch history was needed. To solve this problem, I took inspiration from Emby2Jelly and decided to write a tool utilizing the APIs of both Emby and Jellyfin. To better understand the requirements and plan the development process, I created a flow chart to visualize the desired functionality.
Development Process
The development process involved the following steps:
- I created an empty console application in Visual Studio as a starting point.
- I began by writing the base functionality to retrieve user information from the source and destination servers, and create users on the destination server if they did not already exist.
- I created a cache of accessible items for each user on both the source and destination servers.
- For each user, I compiled a library of items they had watched on the source server.
- I matched the IDs of the watched items with corresponding items in the destination server's library cache.
- Finally, I updated each user's watch status on the destination server based on their watched history from the source server.
Retrospective and Future Improvements
During the development process, I learned a great deal about making API calls and reusing HTTP clients effectively. Currently, the tool successfully creates users and migrates their watched status from one server to another. However, in the future, I would like to enhance the tool's functionality to keep two servers in sync by periodically running the tool and updating any changes in watched status. The tool is available freely on GitHub and open to collaboration from the community.
Conclusion
Developing the Emby Exodus tool was a rewarding experience that allowed me to solve a practical problem while expanding my knowledge of API integration and application development. By automating the migration of watch history between media servers, this tool can save users a significant amount of time and effort. While the current version fulfills its primary purpose, there is still room for improvement and additional features. I look forward to continuing to enhance and refine Emby Exodus based on user feedback and potential contributions from the open-source community.