Jump to content

Python-PlexLibrary


fbrassin

Recommended Posts

fbrassin

Hello,

i discovered this project that i think is very interesting.

https://github.com/adamgot/python-plexlibrary

Based on the list you want, It creates a dir with links of movies present in plex library and creates a new library library, putting a number in from on the name of the movie for example to have a library like imdb top250.

It is working for plex, my question is: is there anyone that uses something like that for emby, or someone that knows how to port it to emby.

I think this should be very usefull.

 

Tnx

Link to comment
Share on other sites

Hi, I don't know of any but I'm sure that could be adapted easily. You could also check out the smart playlists plugin.

Link to comment
Share on other sites

fbrassin

I tried it, but i don't think there is a way to put in a playlist the movies on a list and give them a order, or am i wrong?

 

About adapting python-plexlibrary i think it could be done but it is needed to be able to 😄

Link to comment
Share on other sites

Quote

I tried it, but i don't think there is a way to put in a playlist the movies on a list and give them a order, or am i wrong?

I'm not sure. I would ask in the thread for the plugin.

Link to comment
Share on other sites

PenkethBoy

Something similar could be done in two ways - of the top of my head without a great deal of thought

1 add a tag/genre to the top 250 movies you have already - then the smartplaylist plugin can do its stuff using those markers
Downside would be having to manually add the markers - as emby does not have multi edit yet - slow going but only a one time thing - no collection created.

2 .create a script to read the top250 - compare those with what emby has (match on imdb id (if present) or could be done by name (flaky)) and create a playlist or more likely a collection
downside - scrapping is not allowed from imdb re their TOS - do the list appear on other less strick sites??

Link to comment
Share on other sites

fbrassin

I think the second one should be better. (but can you create that script?)

Do you think it should be possible to create a script to make not only a playlist, but also a library starting from a list?

I see most script around are based on Trakt list, maybe because of its api.

This is a list for axample for top250

https://api.trakt.tv/users/justin/lists/imdb-top-rated-movies/items/movies

https://trakt.tv/users/justin/lists/imdb-top-rated-movies

 

Link to comment
Share on other sites

PenkethBoy

My post was to give you or others clues/guidance how to do it. Its not something I or my friends would use so would be well down my list of priorities. 

To answer your questions 

Yes I could do it or better yet advise/support how to do it - but not a beginner as that would be too time consuming. 

Creating a play list, library and/or a collection are straightforward - basically anything you can do manually in the web app can be done by a script. It's only limited by your skill/imagination. 

But - you cannot have the same movie file path in more than one library without making a physical copy - that's why collections exist in emby. So I would forget creating libraries unless you have boat loads of hdd space spare. 

As long as the data can be found online and does not break TOS then that can be pulled in by the script to then apply changes to emby. 

As for what script language to use, we'll that's the coders choice as it has no impact on the result. 

One final thing - the time it would take to write a script from scratch/test would be considerably longer than doing option 1 above as I doubt the top 250 changes that often. 

Link to comment
Share on other sites

fbrassin
2 hours ago, PenkethBoy said:

 

But - you cannot have the same movie file path in more than one library without making a physical copy - that's why collections exist in emby. So I would forget creating libraries unless you have boat loads of hdd space spare. 

 

About this, python-plexlibrary looks if the movies in a list are present in movie library, for the movies present in there it creates a symbolic link of the movies dir in a new folder, then scan that new folder with the symlinks and after that renames the movies in the new library adding the order number at the beginning of the movie name.

Link to comment
Share on other sites

PenkethBoy

not necessary with a collection and potentially a disaster waiting to happen to the average user who has no idea what symlinks are etc

adding numbers to the movie name will cause issues as well - would be better as a tag or inside [ ] or add a custom sort title etc

As you have probably gathered Plex and emby dont work the same way

 

If it was me i would just create a collection - manually if necessary- and move on - no duplication, no symlinks no extra library etc etc at worst you need a script to create a collection from the list of movies - if it changes that much you need the adding to a collection to be automated - could have been done by now :)

 

Link to comment
Share on other sites

bakes82

@PenkethBoyim looking at doing this in a plugin. Is there a good sample to create a ui that takes in a collection name, a library, and then an arrray of urls?  Doing the api work in c# is easy with the trakt api.  I’ve done this in c# with plex but I didn’t it in my own blazor app so yeah.  Looks like here it’s js based and I want to slit my wrists 😛. I also haven’t found where to make a schedule tasks in the plugin/ui to persist the input.  So if you can point me that way must appreciated.

Link to comment
Share on other sites

PenkethBoy

Sorry - plugin dev is something i am just about to start myself. Been a long time scripter but want to update a useful plugin that has issues - so no choice now!

yes its c# based but js and html etc will also be needed for the gui part of the plugin

As i understand it - you can add/remove your plugin scheduled tasks as several plugins do it already - or you can do the same via scripts as the schedules tasks are json files in the server programdata folder and easy enough to find - and get read on each restart

As for examples/wiki - LOL - nope very little useful info about - and what is is out of date - probably why i and others gave plugins a swerve a long time ago.

Some plugin devs have posted their code on github and can be found easy enough searching here or on git - just make sure they are current plugins as Luke changes things on a regular basis and very recently - something to do with versions of old servers supported - but as yet dont know/understand the details

But some new KB articles re plugin dev are coming just not soon as the author has to take some time out - hopefully they will be back soon.

Good luck and see you in the API subforum asking Luke questions as to why this or that does not work etc

 

 

Link to comment
Share on other sites

fbrassin

In my opinion it should be better using a script to create a collection as playlist is not to good for movies as you have not the possibility to enter movie tab to see info but just play it, while with collection you can enter movie tab 

Link to comment
Share on other sites

fbrassin

But i have a question.

If i have a collection, can i modify names of the movies in the collection without modify those names in the library?

I mean, if i create a collection based on imdb top 250 list, can i put the cassification number before the name so that i see it only in collection but not in the movie library?

I think it is not possible.

If this is the case, it is needed to have different libraries, so that symlinks could be useful

Link to comment
Share on other sites

PenkethBoy

No you cant modify the name as its not part of the collection - but the movie - and is not in the xml either as its not needed

what you could do though is add the 250 listing to the overview of the collection - although would be a tad long on screen

or as i suggested earlier change the sortname of the movie to include the number so they sort in order 1-250

or just create a library for top 250 - and amend the sort names and you dont need a collection at all

symlinks areover kill and i think unnecessary 

Link to comment
Share on other sites

fbrassin
3 hours ago, PenkethBoy said:

or just create a library for top 250 - and amend the sort names and you dont need a collection at all

symlinks areover kill and i think unnecessary 

OK, to create a new library, but how to put only top movies into it?

I have a library with all my movies, and another with only the ones in top 250.

I should copy all the movies in a new folder so i will need much more disk space.

 

Link to comment
Share on other sites

bakes82

@PenkethBoyWhat scripting language do you use then?  I know I can make a collection by just making the XML which again is easy enough I just need to be able to pull the file path from the api.  This is where plex kind of is decent they have a good python library thats documented.  Here the C# library is outdated which would be the preferred solution.  I can do it with the rest API I just didnt want to make the models lol.

Link to comment
Share on other sites

PenkethBoy

i use powershell but thats not important - BTW c# is not a scripting language :) 

go to your dashboard page at the bottom is an api link - takes you to swagger which gives you all the api calls etc

people use all sorts of languages python, ruby, powershell, vbscript even

go and look also at the api sub forum has code snippets etc - some even from me

Link to comment
Share on other sites

PenkethBoy
1 hour ago, fbrassin said:

OK, to create a new library, but how to put only top movies into it?

I have a library with all my movies, and another with only the ones in top 250.

I should copy all the movies in a new folder so i will need much more disk space.

 

no - what you have is fine - you are over thinking it

one movie library for "normal" movies and one for the top 250 as you have - no need to copy anything - just add sort titles inot the metadata (for each by hand) so they are in the 1-250 order - no need to change the titles either

Very simple - better to keep it that way - less maintenance and users will get it - as you get a new movie in the list add it to the 250 library edit the sort title

No need for a script at all

Link to comment
Share on other sites

bakes82

Im a software engineer I know they have a swagger api layer.  I dont  want to make models in C# that correspond to the output so I can work with it easier.  C# can be whatever you want it to be if there is a decent interface.  I could do everything with C#, RestSharp and the Rest API but there is a bunch of extra code that needs to be done.  Where if the C# api was actually current it would be ideal.

Also why I started going down the plugin path, since luke said its api was current.  But w/out a guide and documenation on whats in each service etc, its worthless.  Not going to waste my time.  If questions dont get answered oh well I guess I wont work on a plugin, not a big deal to me.  I use plex mainly and was just testing this to see if it would works since its one of the big things its missing.

This is why I just stay with plex.  UI is great, the python library is great.

Edited by bakes82
Link to comment
Share on other sites

fbrassin
25 minutes ago, PenkethBoy said:

no - what you have is fine - you are over thinking it

one movie library for "normal" movies and one for the top 250 as you have - no need to copy anything - just add sort titles inot the metadata (for each by hand) so they are in the 1-250 order - no need to change the titles either

Very simple - better to keep it that way - less maintenance and users will get it - as you get a new movie in the list add it to the 250 library edit the sort title

No need for a script at all

Sorry, i'm not sure i understood, you mean in "normal" library not to have top 250 but only in top 250 library?

 

Link to comment
Share on other sites

WilhelmStroker

I've used this in Plex to create  libraries from Trakt lists so if anyone can port this to Emby that would be great so i can replicate what i have in Plex.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...