If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

PlexMALSync - sync your Plex library to MyAnimeList

Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass

This project started as I was tired of iffy scrobble support or having to use Trakt with an external service (txm.huere.net) to sync it that way, while the latter is fine it relies on having a public Trakt list and no options to correct mappings which I plan to add later.
Originally it was written in C# but the MAL library support isn't ideal so switched to Python 3 where everything just works out of the box.

So here's what the current version (0.0.1) can do:

  • Sync any Plex library / section to MyAnimeList and update status / watch count
  • Compare watch counts and only increment if we have new, so you don't mess up watch history
  • Title matching currently is based on standard and english title, improvements are planned like custom mappings and exact year matches (tricky with MAL it seems)

Documentation and code is located here:


I recommended using HAMA with Plex like mentioned there as matching works pretty well with it, this is the first release so errors may occur but please let me know what you think.


  • ccoolukeccooluke Posts: 5Members, Plex Pass Plex Pass

    God, I’ve been waiting for something like this. I already have plex sync up with trackt but this will help so much.

  • OriginalFoolOriginalFool Posts: 34Members, Plex Pass Plex Pass
    edited February 2

    So gave this script a test run and it does not seem to update the shows correctly.

    For shows I already had on my watching list it would update the episode count but won't move to completed if the series is watched completely.

    Secondly for shows not on any of my lists yet it does not add them in to a list (Watching, Completed, Etc) or actually update the episode count.
    This can be fixed by using the add command in addition to the update command through spice.

  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass
    edited February 2

    Completely watched will check now :)

    For the second question need a bit more info:

    • Are the shows not on your MAL list watched on Plex i.e. at least 1 episode fully watched?
    • Does the show name in Plex match exactly to that of MAL?

    Because currently I only update shows that have a watch count in Plex, otherwise might end up with a lot of shows in your 'plan to watch' as MAL doesn't have something like a general collection category.

  • OriginalFoolOriginalFool Posts: 34Members, Plex Pass Plex Pass
    edited February 2

    So the watch count in plex is >0.
    MAL has not yet had the anime added to any list and has zero episodes watched.
    I belive it happened with both titles that matched exactly and titles it had to find a match for.

    It seems it shows up under anime history correctly but it does not get added to a list properly.
    Without being added to a list when you visit the show page it shows 0 episodes watched.
    I'm doing some edits on my own and using the add function seems to work in this case to properly add it to a list.

    Still have a couple bugs to finish up fixing in my edited version.

  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass

    Gonna push a new version in a few minutes so if you want to do a PR best to base it off that one, corrected some matching and status updating.

  • OriginalFoolOriginalFool Posts: 34Members, Plex Pass Plex Pass

    Ah whoops just put one in now, will redo it.

    Also as a nice to have would be an output of all the titles that failed for not matching.

  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass
    edited February 3

    No problem :) , changes pushed and also added failure logging.
    Tested here with a few shows and seems to work but let me how it goes, still learning Python so code might not be ideal right now however did clean it up a bit.

    Next update gonna focus on config file to make it easier to push updates and year matching, next week though so feel free to make a pull request.
    Be prepared for a bunch of MAL API bugs / limitations as it's know for that :p

  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass
    edited February 3

    @OriginalFool Changes merged and thanks again :)

    Added settings file support and updated readme, will be a one time change as to make it easier to update with no messing in actual code for settings changes.
    In short after updating to current the required steps are:

    • Copy settings.ini.example to settings.ini
    • Edit settings.ini with your mal / plex details
    • Done

    Make sure to re-run pip install for the requirements (see readme) as a new one was added for console colors.

  • ben.holub@gmail.comben.holub@gmail.com Posts: 3Members, Plex Pass Plex Pass

    First off, thank you so much for making this!

    I'm having an issue when attempting to run the PlexMALSync.py script. Below is the issue (I've included the last successful item):

    2018-03-12 12:59:36 Watched 14 episodes of show: The Melancholy of Haruhi Suzumiya
    Traceback (most recent call last):
    File "PlexMALSync.py", line 89, in get_plex_watched_shows
    if ((lookup_result.index > watched_episode_count[0] and lookup_result.seasonNumber == watched_episode_count[1]) or (lookup_result.seasonNumber > watched_episode_count[1])):
    TypeError: '>' not supported between instances of 'NoneType' and 'int'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "PlexMALSync.py", line 355, in
    File "PlexMALSync.py", line 343, in start
    plex_watched_shows = get_plex_watched_shows(plex_shows)
    File "PlexMALSync.py", line 92, in get_plex_watched_shows
    logger.error(Back.RED +'Error during lookup_result processing')
    NameError: name 'Back' is not defined

    I'm guessing that lookup_result.index is resolving to a NoneType type, which I'm guessing is from a bad MAL sync? I've included my MAL details in settings.ini and confirmed that the user/pass I have in there is correct. Any ideas?


  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass
    edited March 12

    Yeah Plex supplies us with incorrect data in that case, will patch that up today :smile:

  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass
    edited March 12

    @ben.holub@gmail.com Pushed fixes, also had an old log message format which was the cause of the 2nd exception.
    It does mean for that show we have no season number so might not be able to process that later on (defaults to season 1 if that's the case), no such shows here so can't test but let me know how it goes :smile:

    Could also still be that an episode is watched in Plex but has no index which will make it skip over as it can't reliably tell it has watched episodes, not sure how that can happen but you should see that during sync.

  • ben.holub@gmail.comben.holub@gmail.com Posts: 3Members, Plex Pass Plex Pass

    @Rick164 Thank you so much! I made it past that point, and it looks like I might have hit the final error in this process.

    2018-03-12 14:20:05 [MAL] Retrieving updated list for season matching...
    Traceback (most recent call last):
    File "PlexMALSync.py", line 361, in
    File "PlexMALSync.py", line 353, in start
    updated_mal_list = update_mal_list_with_seasons(seasoned_list,plex_watched_shows)
    File "PlexMALSync.py", line 177, in update_mal_list_with_seasons
    original_name_treated = matched_list[0][0].title
    IndexError: list index out of range

    I really appreciate your super fast response to the last one, completely understand if this one takes a little more time.


  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass

    It's no problem :) , think that one is MAL related as it's missing either a date or range is invalid.
    Added some additional checks which will log these and continue operation, plan to improve the overall code as with the new season lookups it's harder to keep track of that many internal lists.

  • ststephenststephen Posts: 3Members ✭✭
    via Email
    Just sent

    Sent from the Grateful iPhone
    of Dr. Steve Fassman
  • ben.holub@gmail.comben.holub@gmail.com Posts: 3Members, Plex Pass Plex Pass

    Hey @Rick164 just wanted to let you know I finally got it all of the way through the process, but I had to make a modification to where you're casting lookup_show in update_mal_entry.

    I wrapped that declaration in a try/except and logged an error if spice wasn't able to get a MAL match on the show ID (in my case, the show exists and confirmed by checking the URL with the ID but w/e). Once that was wrapped in a try/except the whole process worked flawlessly.

    Thanks again for all of your help!

  • Rick164Rick164 Posts: 21Members, Plex Pass Plex Pass

    Awesome, might be that MAL isn't returning anything or we run into a spice library error.
    Added the try/catch there and just let me know if you spot any more bugs :smile:

Sign In or Register to comment.