INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Importing Plex Data  (Read 2437 times)

tij

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1563
Importing Plex Data
« on: August 18, 2019, 06:22:36 am »

Since I have Plex ... I will look into ways to migrate metadata from Plex to MC tonight
Logged
HTPC: Win11 Pro, MC: latest 31(64b), NV Driver: v425.31, CPU: i9-12900K, 32GB RAM, GeForce: 2080ti
Screen: LG 2016 E6
NAS: FreeNAS 11.1, SuperMicro SSG-5048R-E1CR36L, E5-1620v4, 64GB ECC RAM, 18xUltrastar He12-SAS3 drives, 2x240GB SSD (OS)

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Importing Plex Data
« Reply #1 on: August 18, 2019, 06:35:21 am »

you could do this via MCWS once you've matched a plex library ID to a jriver key

i.e.

Code: [Select]
import all content to MC
write a routine to match IDs from plex to MC by querying their sqlite database and then matching entries against MC
for each watched file in plex
    call MCWS/v1/File/Played?File=<FileKey>&FileType=Key
for each in progress file in plex
   call MCWS/v1/File/SetInfo?File=<FileKey>&FileType=Key&Formatted=1&Field=Bookmark&Value=<progress in milliseconds>

I would not expect this to be terribly hard to do, a quick google finds this unofficial python plex api - https://python-plexapi.readthedocs.io/en/latest/ - which is probably a good place to start.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72446
  • Where did I put my teeth?
Re: Importing Plex Data
« Reply #2 on: August 18, 2019, 06:43:21 am »

Since I have Plex ... I will look into ways to migrate metadata from Plex to MC tonight
Thank you.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Importing Plex Data
« Reply #3 on: August 18, 2019, 07:28:17 am »

actually a simpler way to do it might be to use MCWS browse to navigate through the entire content in the MC library and then do a lookup via the plex python api for each matching item, I imagine this might not be terribly quick for a big library but would be v simple to write a script for that
Logged

tij

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1563
Re: Importing Plex Data
« Reply #4 on: August 18, 2019, 01:30:35 pm »

OK … there is a plugin for plex that can export Plex metadata to CSV or XLSX … so you can open these in Excel … the tool can also export posters and covers … I tried the tool and it works … below is the link to that tool

https://forums.plex.tv/t/rel-exporttools/175915

above link has instructions on how to install this plug-in and how to use it

So … if you are a Plex user and want to move metadata to JRiver … there are 2 ways

1. you import your media into JRiver without [Get Movie and TV Info] … then copy/paste from CSV to JRiver (somebody can fill here how to do it as I had no time to try this) … keep in mind that JRiver will use image in the same folder as the movie if its available (image name should be identical to movie or "folder.jpg" … the latter I have never tried)

2. you let JRiver do [Get Movie and TV Info] … then only copy/paste from CSV tags that JRiver doesn't have (must create that tag first … someone can fill here here too)

I personally would choose the 2nd option (though it might take a while if your library is huge … copy pasting can also take a while)

I will write a more detailed guide when I have free time … unless someone else beats me to it lol
Logged
HTPC: Win11 Pro, MC: latest 31(64b), NV Driver: v425.31, CPU: i9-12900K, 32GB RAM, GeForce: 2080ti
Screen: LG 2016 E6
NAS: FreeNAS 11.1, SuperMicro SSG-5048R-E1CR36L, E5-1620v4, 64GB ECC RAM, 18xUltrastar He12-SAS3 drives, 2x240GB SSD (OS)

Pottypotsworth

  • Member
  • *
  • Posts: 3
Re: Importing Plex Data
« Reply #5 on: August 19, 2019, 12:08:02 pm »

OK … there is a plugin for plex that can export Plex metadata to CSV or XLSX … so you can open these in Excel … the tool can also export posters and covers … I tried the tool and it works … below is the link to that tool

https://forums.plex.tv/t/rel-exporttools/175915

above link has instructions on how to install this plug-in and how to use it

So … if you are a Plex user and want to move metadata to JRiver … there are 2 ways

1. you import your media into JRiver without [Get Movie and TV Info] … then copy/paste from CSV to JRiver (somebody can fill here how to do it as I had no time to try this) … keep in mind that JRiver will use image in the same folder as the movie if its available (image name should be identical to movie or "folder.jpg" … the latter I have never tried)

2. you let JRiver do [Get Movie and TV Info] … then only copy/paste from CSV tags that JRiver doesn't have (must create that tag first … someone can fill here here too)

I personally would choose the 2nd option (though it might take a while if your library is huge … copy pasting can also take a while)

I will write a more detailed guide when I have free time … unless someone else beats me to it lol

Thank you for looking into this, tij. I guess from someone who has just imported 13,000 files. It seems a bit daunting for me to proceed with option 2 (JRIver has already grabbed a ton of info) as it seems like a massive amount of manual copying and pasting? Or have I misunderstood?

I would also imagine that many Plex users will still run the two systems alongside each other when you consider many of our family & friends are in the Plex ecosystem but using our servers. Do you think that ultimately there might be a way to automate the sync between to the two systems as an automation ran each evening via a plugin or something similar?

Many thanks again for all your help.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Importing Plex Data
« Reply #6 on: August 19, 2019, 12:27:33 pm »


I would also imagine that many Plex users will still run the two systems alongside each other when you consider many of our family & friends are in the Plex ecosystem but using our servers. Do you think that ultimately there might be a way to automate the sync between to the two systems as an automation ran each evening via a plugin or something similar?

the approach I described would facilitate this because it is just using APIs on each system to copy data back and forth. The downside is that someone needs to write that plugin/app.
Logged

tij

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1563
Re: Importing Plex Data
« Reply #7 on: August 19, 2019, 06:43:22 pm »

the approach I described would facilitate this because it is just using APIs on each system to copy data back and forth. The downside is that someone needs to write that plugin/app.
Ofcourse using api to copy data from Plex server is easiest way to go

Writing actual tool is not that hard ... we do have tool that imports playlist from iTunes (cause that’s the only thing iTunes exposes in its API)

digging through Plex and JRiver APIs manuals for right calls is a bit daunting lol

I supposed I can look into it as Plex tool I link before has source code ... and I did start some plugin for JRiver for something else (so I suppose I can reuse some codes there) ... but it might take some time ... unless one of developers want to jump in :)
Logged
HTPC: Win11 Pro, MC: latest 31(64b), NV Driver: v425.31, CPU: i9-12900K, 32GB RAM, GeForce: 2080ti
Screen: LG 2016 E6
NAS: FreeNAS 11.1, SuperMicro SSG-5048R-E1CR36L, E5-1620v4, 64GB ECC RAM, 18xUltrastar He12-SAS3 drives, 2x240GB SSD (OS)

tij

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1563
Re: Importing Plex Data
« Reply #8 on: August 19, 2019, 07:33:06 pm »

Well … fastest way I can do to sync Plex metadata to JRiver is using CSV files generated by Plex Export tool (copy and paste from that into JRiver does seems to be daunting task if you have large library)

This method will require 2 step for each category … first need to generate CSV from Plex tool … then import that CSV to JRiver … this does offer some advantages as JRiver tool then wont need to have your credentials to access Plex
Logged
HTPC: Win11 Pro, MC: latest 31(64b), NV Driver: v425.31, CPU: i9-12900K, 32GB RAM, GeForce: 2080ti
Screen: LG 2016 E6
NAS: FreeNAS 11.1, SuperMicro SSG-5048R-E1CR36L, E5-1620v4, 64GB ECC RAM, 18xUltrastar He12-SAS3 drives, 2x240GB SSD (OS)

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Importing Plex Data
« Reply #9 on: August 20, 2019, 08:21:22 am »

I looked into it a bit last night because I was bored. Plex does have their web API, but they discontinued their plugin architecture about a year ago.

It would definitely be possible to write a script or standalone application that syncs back and forth between MC and Plex, and if all you wanted was a one-time export, that should be possible to craft. There is even, apparently a python wrapper for the web API someone wrote (that was used to build a system to sync between two separate Plex servers).

If you want "forever updating", ongoing sync though, that would be much more difficult. Without some way to get callbacks or push notifications from Plex when files get played, there'd be no good way to keep play stats synced between MC and Plex permanently. You could brute force it and just scan every file in the Library nightly, and if you use the old COM API you could get "instant" notifications from MC's end (so you could sync immediately when MC plays or stops playing a file), but you wouldn't be able to sync from the Plex-end in an efficient manner.

Best you could do would be to dump a recently played list out of Plex and MC, and then update those once per day or something at night (with a periodic full rescan every so often for stuff that got missed). That's what it looked like from what I saw in looking for an hour last night. Maybe I missed something though...?
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/
Pages: [1]   Go Up