Importing python libraries to run script but which libraries?

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Re: Importing python libraries to run script but which libraries?

Post by jachin99 » Fri May 18, 2018 9:13 pm

Thanks for that but the naming convention makes them easy to find and delete. I ran your edited script, and got an index out of range error

Code: Select all

   Traceback (most recent call last):
     Python script "1", line 181, in <module>
       failed_trailer_downloads
   IndexError: tuple index out of range

jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Re: Importing python libraries to run script but which libraries?

Post by jachin99 » Mon May 21, 2018 1:29 am

I tried running it one more time because the time had changed itself to 2002 on my file server. Here is a screenshot of what eventghost showed me.
Capture.JPG

User avatar
kgschlosser
Site Admin
Posts: 4034
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Importing python libraries to run script but which libraries?

Post by kgschlosser » Mon May 21, 2018 7:53 am

I have no clue what that error is or what it is in reference to. it looks as tho it is unable to find a movie on youtube. The movie The Ten Commandments
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Re: Importing python libraries to run script but which libraries?

Post by jachin99 » Mon May 21, 2018 2:30 pm

Sorry, I'll try to be more descriptive. FIrst, I ran your cleanup script just for good measure, and there are no trailers present in my library. It looks like the script is connecting to emby, getting the list of my movies, and going to youtube to try and download them. I come to this conclusion because EG throws an error when there is a problem downloading a video. I tried going to the address of a trailer listed in the error log, and youtube just displayed a DMCA takedown notice for the video (This was an IT trailer) so I'm guessing the ten commandments error was the same thing.

So it looks like it is telling me if it can't find or download a trailer BUT its not telling me if or when it CAN find a trailer, and its not downloading anything that as far as I can tell. I upgraded to pytube 9.2.3, which is the latest but I still get the same results. Prior to adjusting for the no audio problem the script worked but didn't have audio. Do you suppose the problem is there aren't any trailers in 1080p with progressive streams. I'm ok with trying a DASH stream and specify a few different codecs for it to try. These don't HAVE to be 1080, and I'm fine with 720 for most, and I'm too picky about which audio stream either as long as its not too bad. One more thing to point out is that EG is really cranky when it runs this script. For example, if I try to even view the configuration for the script while its running, the EG GUI freezes. Thanks for all of your help, and I hope this gives you a better idea about where I'm running into problems.

jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Re: Importing python libraries to run script but which libraries?

Post by jachin99 » Mon May 21, 2018 7:31 pm

If this doesn't work out I could also install python on a client, and run it outside of eventghost. I tied EG into it just to make sure i could import an external library and use it. Another approach could be to parse .nfo files for each movie, get the youtube trailer link, and have the script download that. I don't think this would even take authenticating to emby but I would have to log onto a SMB v2 file share. These links should have audio, and I believe we would just have to reconstruct the url from the .nfo file.

User avatar
kgschlosser
Site Admin
Posts: 4034
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Importing python libraries to run script but which libraries?

Post by kgschlosser » Mon May 21, 2018 10:36 pm

well with Emby i do not know if it actually uses the nfo files for anything. It seems to store all of it's data into a SQLLight database.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Re: Importing python libraries to run script but which libraries?

Post by jachin99 » Mon May 21, 2018 10:47 pm

I can open the .nfo file with a text editor and see the YouTube trailer address.

User avatar
kgschlosser
Site Admin
Posts: 4034
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Importing python libraries to run script but which libraries?

Post by kgschlosser » Tue May 22, 2018 1:58 am

it may or may not look at that file. I have not come across anything in their code that would indicate that it grabs information from an nfo file. I have seen code for trailer data being pulled form the database. I would have to go back and look to see specifically what is gotten.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Re: Importing python libraries to run script but which libraries?

Post by jachin99 » Tue May 22, 2018 2:17 am

I asked on their forum about why they use .nfo. They told me it was so that if you want to rebuild Emby's database, it can read data from .nfo files instead of pulling it all from the internet. Another user has written a python script for Linux that taps the movie database for the trailers. From what we talked about earlier in your PM it sounds like you have a good grip on things though. I think I'll just installed python on a machine and toy around with their api. I brought up the .nfo files because its a web address to a youtube trailer that matches the movie, and has the right codecs. It was just a thought.

User avatar
kgschlosser
Site Admin
Posts: 4034
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Importing python libraries to run script but which libraries?

Post by kgschlosser » Tue May 22, 2018 3:49 am

The nfo files could be used if you had to rebuild your database. it will not give you everything only the very basic things like year, synopsis. them being there is moot. because in order to get all the artwork back it is still going to have to make that connection to the internet. and the data contained within the nfo file is so small it wouldn't be anything of a burger to add to getting all of the images. I believe that Emby also stores the images as binary data in the database. this I am not sure on tho. I have not come across any of the code for the images except in their API.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Re: Importing python libraries to run script but which libraries?

Post by jachin99 » Tue May 22, 2018 1:29 pm

I believe they also recommend their swagger UI for dealing with their api to make things easier for developers so here is a screenshot of that. I also included a .nfo file so you can see what those have in them. A lot of people use Emby as a server, and run WMC, and Kodi clients.
Ca1pture.JPG
Attachments
Batman Vs Superman The Dawn of Justice.xml
(39.72 KiB) Downloaded 11 times

Post Reply