Max6387 0 Posted September 21, 2023 Share Posted September 21, 2023 @hthgihwaymonk would you care to share your script? please Link to comment Share on other sites More sharing options...
farberm 0 Posted October 1, 2023 Share Posted October 1, 2023 I would be interested in your script also Link to comment Share on other sites More sharing options...
Guest juanmartinbravo Posted October 2, 2023 Share Posted October 2, 2023 Yes, PMM on Emby is what I miss more from Plex. In the meantime I´d love to get that script as well Link to comment Share on other sites More sharing options...
Cr8iveLosr 53 Posted October 2, 2023 Share Posted October 2, 2023 interesting thread. will keep an eye on it. anyone have a working discord link for PMM? the one posted in OP is invalid/expired as well as the one on GH Thanks Link to comment Share on other sites More sharing options...
jaketame 86 Posted October 2, 2023 Author Share Posted October 2, 2023 This one shouldn’t expire Fresh Discord. https://discord.gg/UKQwZyGFHs 1 Link to comment Share on other sites More sharing options...
Guest juanmartinbravo Posted October 4, 2023 Share Posted October 4, 2023 I managed to do this with chatgpt. It's a python script that will create collections based on mdblists. Before running the script you'll need to: if you want replace json_url by the mdblist you want to use. Otherwise you'll use that top movies of the week list I have on the script Replace YOUR-EMBY-API-KEY by your actual api key that you can find in your emby settings Replace YOUR-EMBY-DOMAIN-OR-IPADDRESS with your server details (there are two lines where you need to do that) Once done just run `python3 name-of-script.py` It'd be even better if someone takes it to the next level and creates a row in Emby main screen (just like the top pick plugin does). I'm not programmer so I hope someone can develop this further. import requests import json import subprocess from urllib.parse import quote # URL of the JSON file containing movie data json_url = "https://mdblist.com/lists/garycrawfordgc/top-movies-of-the-week/json/" # Fetch the JSON data from the URL response = requests.get(json_url) if response.status_code == 200: # Parse the JSON data movie_data = json.loads(response.text) # Extract IMDb IDs from the JSON data and add the "imdb." prefix imdb_ids = ["imdb." + movie["imdb_id"] for movie in movie_data] # Construct the IMDb IDs string for the Emby API request imdb_ids_str = "%2C".join(imdb_ids) # Define your Emby API key emby_api_key = 'YOUR-EMBY-API-KEY' # Build the Emby API URL with the IMDb IDs emby_api_url = f"https://YOUR-EMBY-DOMAIN-OR-IPADDRESS/emby/Items?Recursive=true&AnyProviderIdEquals={imdb_ids_str}&api_key={emby_api_key}" # Print the Emby API URL print("Emby API URL:", emby_api_url) # Execute the curl command to get movie data from Emby subprocess.run(["curl", emby_api_url]) ### SECOND PART # Extract the movie IDs from the Emby API URL JSON dataA emby_response = requests.get(emby_api_url) emby_data = emby_response.json() movie_ids = [item['Id'] for item in emby_data['Items']] # Create a comma-separated string of movie IDs movie_ids_str = '%2C'.join(map(str, movie_ids)) # Define the collection name (without %20) collection_name = 'Top Movies of the week' # Encode the collection name with %20 encoded_collection_name = quote(collection_name) # Construct the curl command to create the collection curl_command = f'curl -X POST "https://YOUR-EMBY-DOMAIN-OR-IPADDRESS/emby/Collections?Name={encoded_collection_name}&Ids={movie_ids_str}&api_key={emby_api_key}" -H "accept: application/json"' # Print the curl command print("Curl command:", curl_command) # Execute the curl command subprocess.run(curl_command, shell=True) else: print("Failed to fetch JSON data") Link to comment Share on other sites More sharing options...
timtim9000 0 Posted October 5, 2023 Share Posted October 5, 2023 On 8/30/2023 at 6:53 AM, hthgihwaymonk said: making progress... need to speed up collection creating/updating though. I'm not sure if it's allowed, but $250 bounty for anyone who replicates it and shares it with everyone on Git Hub. Link to comment Share on other sites More sharing options...
rbjtech 4265 Posted October 5, 2023 Share Posted October 5, 2023 (edited) 21 hours ago, juanmartinbravo said: I managed to do this with chatgpt. It's a python script that will create collections based on mdblists. Before running the script you'll need to: if you want replace json_url by the mdblist you want to use. Otherwise you'll use that top movies of the week list I have on the script Replace YOUR-EMBY-API-KEY by your actual api key that you can find in your emby settings Replace YOUR-EMBY-DOMAIN-OR-IPADDRESS with your server details (there are two lines where you need to do that) Once done just run `python3 name-of-script.py` It'd be even better if someone takes it to the next level and creates a row in Emby main screen (just like the top pick plugin does). I'm not programmer so I hope someone can develop this further. import requests import json import subprocess from urllib.parse import quote # URL of the JSON file containing movie data json_url = "https://mdblist.com/lists/garycrawfordgc/top-movies-of-the-week/json/" # Fetch the JSON data from the URL response = requests.get(json_url) if response.status_code == 200: # Parse the JSON data movie_data = json.loads(response.text) # Extract IMDb IDs from the JSON data and add the "imdb." prefix imdb_ids = ["imdb." + movie["imdb_id"] for movie in movie_data] # Construct the IMDb IDs string for the Emby API request imdb_ids_str = "%2C".join(imdb_ids) # Define your Emby API key emby_api_key = 'YOUR-EMBY-API-KEY' # Build the Emby API URL with the IMDb IDs emby_api_url = f"https://YOUR-EMBY-DOMAIN-OR-IPADDRESS/emby/Items?Recursive=true&AnyProviderIdEquals={imdb_ids_str}&api_key={emby_api_key}" # Print the Emby API URL print("Emby API URL:", emby_api_url) # Execute the curl command to get movie data from Emby subprocess.run(["curl", emby_api_url]) ### SECOND PART # Extract the movie IDs from the Emby API URL JSON dataA emby_response = requests.get(emby_api_url) emby_data = emby_response.json() movie_ids = [item['Id'] for item in emby_data['Items']] # Create a comma-separated string of movie IDs movie_ids_str = '%2C'.join(map(str, movie_ids)) # Define the collection name (without %20) collection_name = 'Top Movies of the week' # Encode the collection name with %20 encoded_collection_name = quote(collection_name) # Construct the curl command to create the collection curl_command = f'curl -X POST "https://YOUR-EMBY-DOMAIN-OR-IPADDRESS/emby/Collections?Name={encoded_collection_name}&Ids={movie_ids_str}&api_key={emby_api_key}" -H "accept: application/json"' # Print the curl command print("Curl command:", curl_command) # Execute the curl command subprocess.run(curl_command, shell=True) else: print("Failed to fetch JSON data") So a few extra steps are needed if you only have the default pyton libraries installed Install the python http request library python -m pip install requests Likely change https, to http on the emby local urls I'd suggest creating a dedicated emby api key for this - do not use your default key --- This now works perfectly on Windows. Change the sortname to starting with an underscore - then they are all grouped at the start of the collections. Nested collections still require a hack .. I may develop this a little further ... and possibly create the channels to use on the home screen as I have that working in a Plugin for another project .. Edited October 5, 2023 by rbjtech 1 Link to comment Share on other sites More sharing options...
Guest juanmartinbravo Posted October 5, 2023 Share Posted October 5, 2023 (edited) 3 hours ago, rbjtech said: I may develop this a little further ... and possibly create the channels to use on the home screen as I have that working in a Plugin for another project .. By channels do you mean a new row in the homescreen? If so that would be great and that's what I would definitely do next if I had coding knowldinge. I wouldn't want to add a new row in the home screen for a top 250 movies collection, but for a Top 10 Watched this week then it'd be supercool! Another thing that would be cool is if we could select the poster image that should appear for the collection. But that would be low priority for me. We can always do that manually Edited October 5, 2023 by juanmartinbravo Link to comment Share on other sites More sharing options...
rbjtech 4265 Posted October 5, 2023 Share Posted October 5, 2023 1 hour ago, juanmartinbravo said: By channels do you mean a new row in the homescreen? If so that would be great and that's what I would definitely do next if I had coding knowldinge. Yes - creating a channel on the home row - is just a matter of adding the items Id's from the collection - it's easy enough to do. 1 hour ago, juanmartinbravo said: I wouldn't want to add a new row in the home screen for a top 250 movies collection, but for a Top 10 Watched this week then it'd be supercool! Sure - which is why the idea of nested collections not being available is so frustrating. I would put all the MDB lists into sub catagories and maybe show that as a row. the good news is the in the latest beta, you can already show collections as home screen rows. 1 hour ago, juanmartinbravo said: Another thing that would be cool is if we could select the poster image that should appear for the collection. But that would be low priority for me. We can always do that manually Again pretty easy to do if the MDB collections are fixed - as we can just 'borrow' the images from the github ... and post to emby via the API 1 Link to comment Share on other sites More sharing options...
hthgihwaymonk 21 Posted October 5, 2023 Share Posted October 5, 2023 To add a poster to a collection I use - where collection_poster = config.collection_titles[collection_name]['poster'] is pulled from config.py collection_titles = { 'Movies - Trakt Trending': {'sort': '_a', 'poster': 'Trends/Movies - Trakt Trending.png', 'type': 'mdblist'}, } # update poster collection_poster = config.collection_titles[collection_name]['poster'] with open(f'/opt/collections/images/{collection_poster}', 'rb') as file: image_data = file.read() image_data_base64 = base64.b64encode(image_data) headers = {"X-Emby-Token": emby_api_key, "Content-Type": "image/jpeg"} url = f"{emby_server_url}/Items/{itemID}/Images/Primary" response = requests.post(url, headers=headers, data=image_data_base64) if response.status_code == 204: print(f'Successfully updated collection the poster for "{collection_name}"') else: print(f'Error updating collection poster for "{collection_name}": {response.text}') Link to comment Share on other sites More sharing options...
Guest juanmartinbravo Posted October 5, 2023 Share Posted October 5, 2023 @hthgihwaymonkdo you mind to share your script? The more people we get sharing their findings the sooner we could get something good Link to comment Share on other sites More sharing options...
hthgihwaymonk 21 Posted October 5, 2023 Share Posted October 5, 2023 (edited) I've been trying to clean it up, make it portable, as right now it's highly specific to what I do. And once it's cleaned up, the only thing it doesn't do is - "Yes - creating a channel on the home row - is just a matter of adding the items Id's from the collection - it's easy enough to do."' Edited October 5, 2023 by hthgihwaymonk Link to comment Share on other sites More sharing options...
adminExitium 173 Posted October 5, 2023 Share Posted October 5, 2023 7 hours ago, rbjtech said: Yes - creating a channel on the home row - is just a matter of adding the items Id's from the collection - it's easy enough to do. I am not sure whether it's easy since you have done it before or whether the author is trying to accomplish something more complicated but this thread for the same has been going on for a few weeks now: Perhaps you can help out there so the effort is not duplicated because they seem to be trying to do something very similar. Link to comment Share on other sites More sharing options...
rbjtech 4265 Posted October 5, 2023 Share Posted October 5, 2023 1 hour ago, adminExitium said: I am not sure whether it's easy since you have done it before or whether the author is trying to accomplish something more complicated but this thread for the same has been going on for a few weeks now: Perhaps you can help out there so the effort is not duplicated because they seem to be trying to do something very similar. Creating a 'Channel' has been done many times before, by cheese, chef - their open source code is on Github for all to use - that's what I use to create the channel(s). Of course, that is C# and Javascript - not Python - so it all need combining to make it a stand alone Plugin for Emby. Unfortunately I don't have the time at the moment to do this - but happy to give pointers where I can - BUT while this will get Emby the collections, it will not get us anything like the full PMM experience - so it may be better to invest the development time in doing that instead. Happy to help where I can, but as I said above, I can't commit to spending much time on this at the moment I'm afraid. Link to comment Share on other sites More sharing options...
hthgihwaymonk 21 Posted October 6, 2023 Share Posted October 6, 2023 Quote by cheese, chef - their open source code is on Github for all to use @rbjtechdo you happen to have a link to one of those github repos ? Link to comment Share on other sites More sharing options...
jaketame 86 Posted October 6, 2023 Author Share Posted October 6, 2023 I've also started working on something that is a bit more module, allows input from yaml file for the tmdb list ids. Keep posted. Link to comment Share on other sites More sharing options...
Guest juanmartinbravo Posted October 6, 2023 Share Posted October 6, 2023 (edited) It's nice to see several people working to get something done, but still a shame to not see much code being shared. I'm not sure if it's due to lack of confidence in its quality or people just wanting to protect their code for potential profit. I totally understand if someone doesn't want to share some code that is unfinished or just doesn't work well yet, but at the same time one could just mention that it's unfinished, still share it and hope that others help to get it completed/improved. Anyway, I hope Jellyfin gets some traction as contributors over there don't seem so overly protective of whatever code they write. Sadly their forum is way more unknown so not many people post about plugins and what not. Edited October 6, 2023 by juanmartinbravo Link to comment Share on other sites More sharing options...
rbjtech 4265 Posted October 6, 2023 Share Posted October 6, 2023 (edited) 5 hours ago, hthgihwaymonk said: @rbjtechdo you happen to have a link to one of those github repos ? Sure - these are Public from @chef- they both create emby 'channels' based on a library query - you should be able to just modify them with the downloaded JSON and create the channel rather than create the collection. https://github.com/chefbennyj1/Emby.KidsChannel https://github.com/chefbennyj1/Emby.NewReleases I also think others are looking into this themselves - see here about creating a channel of TV shows - the collections look very familiar .. https://emby.media/community/index.php?/topic/121589-channel-of-tv-shows/ Edited October 6, 2023 by rbjtech Link to comment Share on other sites More sharing options...
joggs 24 Posted October 6, 2023 Share Posted October 6, 2023 28 minutes ago, juanmartinbravo said: It's nice to see several people working to get something done, but still a shame to not see much code being shared. I'm not sure if it's due to lack of confidence in its quality or people just wanting to protect their code for potential profit. I totally understand if someone doesn't want to share some code that is unfinished or just doesn't work well yet, but at the same time one could just mention that it's unfinished, still share it and hope that others help to get it completed/improved. Anyway, I hope Jellyfin gets some traction as contributors over there don't seem so overly protective of whatever code they write. Sadly their forum is way more unknown so not many people post about plugins and what not. Then please take the lead in this and create public repos and guide these creative people. Everyone does not have the competence or confidence to do it, or maybe note even use github etc 1 1 Link to comment Share on other sites More sharing options...
rbjtech 4265 Posted October 6, 2023 Share Posted October 6, 2023 (edited) 45 minutes ago, juanmartinbravo said: It's nice to see several people working to get something done, but still a shame to not see much code being shared. I'm not sure if it's due to lack of confidence in its quality or people just wanting to protect their code for potential profit. I totally understand if someone doesn't want to share some code that is unfinished or just doesn't work well yet, but at the same time one could just mention that it's unfinished, still share it and hope that others help to get it completed/improved. Anyway, I hope Jellyfin gets some traction as contributors over there don't seem so overly protective of whatever code they write. Sadly their forum is way more unknown so not many people post about plugins and what not. A little confused by your post - people ARE sharing their efforts to help this along. Developing something like PMM takes months of effort - and if the dev wants to get a few bucks per user - then I fully support that. People need to get 'open source = free' out of their heads - it's about contributing as a community. If you use the code and it's useful - then pay back either with a proportional financial contribution or enhance the code further and release updates ... Edited October 6, 2023 by rbjtech Link to comment Share on other sites More sharing options...
Guest juanmartinbravo Posted October 6, 2023 Share Posted October 6, 2023 (edited) 51 minutes ago, joggs said: Then please take the lead in this and create public repos and guide these creative people. Everyone does not have the competence or confidence to do it, or maybe note even use github etc I already shared a python script to create collections within seconds. I trust this could be handy to some other guys who can't code. Sadly I didn't even wrote that script, it was chatgpt who did it when I prompted it to do certain things using a curl command that rbjtech posted earlier. If I had knowledge to do more than that, rest assured I'd share the code here or with links to my github so others can help to complete it / improve it I always thought that collective coding efforts are better for the community than different individuals saying they have something but not sharing it with each other. Oh and I know people isn't obliged to share their code and they are free to charge for it if they want to... but I'm also not obliged to restrict my opinions on that matter. That's why I hope Jellyfin gets some traction, because people over their doesn't strike as people so protective with their code. Edited October 6, 2023 by juanmartinbravo Link to comment Share on other sites More sharing options...
jaketame 86 Posted October 6, 2023 Author Share Posted October 6, 2023 It will take a few days but I am willing to share the code and build from there but I want to build + test to make sure I have something working before I do. I'm not a dev but I dapple a little in coding. So will see how it goes. Link to comment Share on other sites More sharing options...
Guest juanmartinbravo Posted October 6, 2023 Share Posted October 6, 2023 (edited) In any case apologies to anyone I might have offended. On my attempt to get everyone to collaborate I might actually end up achieving the opposite! Edited October 6, 2023 by juanmartinbravo Link to comment Share on other sites More sharing options...
hthgihwaymonk 21 Posted October 6, 2023 Share Posted October 6, 2023 (edited) 7 hours ago, rbjtech said: Sure - these are Public from @chef- they both create emby 'channels' based on a library query - you should be able to just modify them with the downloaded JSON and create the channel rather than create the collection. https://github.com/chefbennyj1/Emby.KidsChannel https://github.com/chefbennyj1/Emby.NewReleases I also think others are looking into this themselves - see here about creating a channel of TV shows - the collections look very familiar .. https://emby.media/community/index.php?/topic/121589-channel-of-tv-shows/ I'll take a look at the github links, thanks And I've looked through that "Channels of TV Shows" thread already, that one makes my head hurt trying to follow along. I don't see any list of collection in that thread though. Edited October 6, 2023 by hthgihwaymonk Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now