Kodi Community Forum
XBMC.MyLibrary - Scan any source to the library (Hulu/Netflix/Plugins) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: XBMC.MyLibrary - Scan any source to the library (Hulu/Netflix/Plugins) (/showthread.php?tid=98210)



- yonu - 2011-07-30

ok I renamed them but I get an error in XBMC that it says it can't play the file(yes I updated the library) I am using playon if that helps


- pkscout - 2011-07-30

yonu Wrote:Very Dumb question

I used the netflix template in the userguide and it reads my queue but I endup with a folder full of mpg files that XBMC says it can't load. What did I miss and what do I need to post inorder to get help

it's worth understanding the process this script uses to get things working, it helps with issues like this. Here goes my try.

1- the script scans your Netflix queue and creates a stub file with a .mpg extension for each movie (or TV show episode) it finds. That mpg file isn't playable, but it has to be a mpg file in order for step 2 to work.

2- the script then triggers an XBMC library update. That process attempts to scan the directory with those fake mpg files and loads them into XBMC based on the scraper you have set. If the scraper can't figure out what movie is associated with the file XBMC won't load it.

3- the script then figures out what items got loaded in step 2 and renames the items to .strm files (which will play properly). It also does some magic in the XBMC database to associate the old mob entry with the newly named .strm file.

The most common problem I have is that the scraper can't figure out the movie based on it's name. My solution there is to create a .nfo file that contains only the link to the right entry in the moviedb database and put it in the same directory as the movie with the same name (but with .nfo file extension). Then I rerun the script and everything tends to work.


- Batch - 2011-07-30

I figured out a solution for IceFilms to have their movies in the database without hammering their servers. I did some script modifications and keep the link to the page containing the links to the different mirrors instead of the mirrors themselves.

(I also did a minor hack to be able to use XBMC.MyLibrary with IceFIlms but I hope you don't mind since I'm avoiding to spam HTTP requests...)

Grown Ups (2010).strm:
Code:
plugin://plugin.video.icefilms/?url=http%3A%2F%2Fwww.icefilms.info%2Fip.php%3Fv%3D109700%26&mode=400&name=Grown+Ups+%282010%29

Image
When selecting a movie the script scrapes the movies page at IceFilms and let me choose what quality and mirror I want to use.

I tracked all traffic with Wireshark to be sure I didn't accidently hammer IceFilms server. When I filled my library (11639 movies) the script only did about one page request every 5 minutes from IceFilms.info since it only needed to load the pages listing the movies in alphabetic order.

Everything works quite good but I got a few problems:
1) I would like to skip the phase where old movies are deleted. Because the library is as big as it is I'm only scraping all movies once. The scrapes after that first scrape only scrapes the movies found on the "recent movies" page. I fixed this by setting the HoursThreshold really high but it would be better if I just could turn it off.
2) Problems seem to occur when the database gets to big.
Code:
07/30/2011 09:15:44 em INFO    ContentScan      Querying JSON-RPC interface for all videos in library.
07/30/2011 09:15:53 em WARNING ContentScan      The response from XBMC is not a valid JSON string:
                                                    {
                                                       "id" : "1",
                                                       "jsonrpc" : "2.0",
                                                       "result" : {
                                                          "end" : 11724,
                                                          "movies" : [
                                                             {
                                                                "fanart" : "special://masterprofile/Thumbnails/Video/Fanart/db7441f0.tbn",
                                                                "file" : "C:\\dropbox\\Movies\\500 Days of Summer (2009) HD.strm",
                                                                "label" : "(500) Days of Summer",
                                                                "movieid" : 1,
                                                                "thumbnail" : "special://masterprofile/Thumbnails/Video/d/db7441f0.tbn"
                                                             },
                                                             {
                                                                "fanart" : "special://masterprofile/Thumbnails/Video/Fanart/fa92ccc9.tbn",
                                                                "file" : "C:\\dropbox\\Movies\\District 9 (2009) HD.strm",
                                                                "label" : "District 9",
                                                                "movieid" : 2,
                                                                "thumbnail" : "special://masterprofile/Thumbnails/Video/f/fa92ccc9.tbn"
                                                             },

                                                              ... (more movies goes here)

                                                             {
                                                                "fanart" : "special://masterprofile/Thumbnails/Video/Fanart/3f84684a.tbn",
                                                                "file" : "C:\\dropbox\\Movies\\The Morgue (2008).mpg",
                                                                "label" : "The Morgue",
                                                                "movieid" : 7115
                                                             },
                                                             {
                                                                "fan
07/30/2011 09:16:07 em WARNING ContentScan      JSON Returned was not valid (attempt 1 of 3), will try again...
07/30/2011 09:16:09 em WARNING ContentScan      The response from XBMC is not a valid JSON string:
                                                    
07/30/2011 09:16:09 em WARNING ContentScan      JSON Returned was not valid (attempt 2 of 3), will try again...
07/30/2011 09:16:29 em INFO    ContentScan      JSON was successfully retrieved after attempt #3
07/30/2011 09:16:29 em INFO    ContentScan      No TV Shows found in XBMC's library for this series: {"id":"1","result":{"total":0,"start":0,"end":0},"jsonrpc":"2.0"}
07/30/2011 09:16:29 em WARNING ContentScan      No TV Shows/Series/Episodes were found in XBMC's library...
07/30/2011 09:16:29 em INFO    ContentScan      No music videos were found in XBMC's library.
07/30/2011 09:16:29 em INFO    ContentScan      Found 11724 unique files in video library (11724 movies, 0 episodes, 0 music videos)
07/30/2011 09:16:29 em NOTICE  ContentScan      11724 videos found in library. (Previous count was 11724, a change of 0)
07/30/2011 09:16:29 em NOTICE  ContentScan      Since no more videos were added in the last 2.0 minutes, continuing on...



Hulu via Bluecop Plugin Requires Source Type? - pkscout - 2011-08-06

Now that Bluecop's Hulu plugin is working again, I've switched back over to using to as my Hulu source rather than PlayOn. To make my configuration simpler, I have XBMC.MyLibrary look at my Hulu Queue to figure out what to add to my library. My queue has both movies and TV Shows in it.

Given that, here's the config I'm trying use:

Code:
<Hulu path="plugin://plugin.video.hulu">
    <subfolder name="Queue" suffix=" (Hulu)" movie_set=" Streaming"/>
</Hulu>

Set that way I get the following error:

Code:
08/06/2011 07:34:03 AM INFO    Find:Subfolder   Searching for subfolder: Hulu/Queue
08/06/2011 07:34:04 AM NOTICE  Found!           Hulu's subfolder "Hulu/Queue" maps to source: plugin://plugin.video.hulu/?url="http%3A%2F%2Fm.hulu.com%2Fmenu%2Fhd_user_queue"&mode="Queue"&name="Queue"&page="1"&perpage="2000"&popular="false"&updatelisting="false" (Hulu/Queue)
08/06/2011 07:34:04 AM INFO    Search:Hulu      Found 89 videos that are already archived in dropbox from source "Hulu"
08/06/2011 07:34:04 AM NOTICE  Search:Hulu      Finding all matching videos under subfolder: Hulu/Queue
08/06/2011 07:34:04 AM NOTICE  Search:Hulu      Done retrieving files from JSON-RPC for subfolder: Hulu/Queue
08/06/2011 07:34:04 AM INFO    Archive:Skip     SKIPPING: This video source type was not specified (type="auto_determine_type") or is not yet supported: Hulu/Queue/Burn Notice - 5x3 - Mind Games
08/06/2011 07:34:04 AM WARNING Archiving        Cannot be archived: series=null, title=null, season=-1, episode=-1
                                                    Hulu/Queue/Burn Notice - 5x3 - Mind Games

If I add type="episodes" to the config, it works fine, except that it can't add the movies anymore. This same config worked when I was using PlayOn, so I'm wondering if there is anything I can do to have my Hulu queue parsed for both movies and episodes again.

Thanks.


- matmabro - 2011-08-08

@Batch

So how'd you get icefilms working? I was looking at the code and it looks like it would be pretty easy to uncomplie edit and recompile to get icefilms back, but I don't want to hammer their servers and piss anyone off especially considering the recent downtime they've had over the weekend.

I've just started playing with this 2 nights ago and I'm currently stuck with mpg files, but all the popular hulu shows are in my library... I think I should be able to fix by moving my dropbox folder, but I haven't tried that yet.

@bradvido

This is a great little script you wrote. looking forawrd to you releasing it to the community. From what I can tell, it doesn't seem like it should be too hard to turn this into an add-on, I mean mostly you are just editing the XML document then launching the script.


- bradvido88 - 2011-08-08

Sorry I've been MIA for a couple weeks. I'll try to address most of the issues here:
pkscuot Wrote:it's worth understanding the process this script uses to get things working, it helps with issues like this. Here goes my try.

1- the script scans your Netflix queue and creates a stub file with a .mpg extension for each movie (or TV show episode) it finds. That mpg file isn't playable, but it has to be a mpg file in order for step 2 to work.

2- the script then triggers an XBMC library update. That process attempts to scan the directory with those fake mpg files and loads them into XBMC based on the scraper you have set. If the scraper can't figure out what movie is associated with the file XBMC won't load it.

3- the script then figures out what items got loaded in step 2 and renames the items to .strm files (which will play properly). It also does some magic in the XBMC database to associate the old mob entry with the newly named .strm file.

The most common problem I have is that the scraper can't figure out the movie based on it's name. My solution there is to create a .nfo file that contains only the link to the right entry in the moviedb database and put it in the same directory as the movie with the same name (but with .nfo file extension). Then I rerun the script and everything tends to work.
Yes, that's pretty good overview of what this script does. XBMC doesn't allow scraping of .strm files (TV Episodes are allowed, strangely), so that's why they need to be .mpg's first. It it a bit Rube Goldberg, but usually works.

Batch Wrote:I figured out a solution for IceFilms to have their movies in the database without hammering their servers. I did some script modifications and keep the link to the page containing the links to the different mirrors instead of the mirrors themselves.

(I also did a minor hack to be able to use XBMC.MyLibrary with IceFIlms but I hope you don't mind since I'm avoiding to spam HTTP requests...)

Grown Ups (2010).strm:
Code:
plugin://plugin.video.icefilms/?url=http%3A%2F%2Fwww.icefilms.info%2Fip.php%3Fv%3D109700%26&mode=400&name=Grown+Ups+%282010%29
Image
When selecting a movie the script scrapes the movies page at IceFilms and let me choose what quality and mirror I want to use.

I tracked all traffic with Wireshark to be sure I didn't accidently hammer IceFilms server. When I filled my library (11639 movies) the script only did about one page request every 5 minutes from IceFilms.info since it only needed to load the pages listing the movies in alphabetic order.

Everything works quite good but I got a few problems:
1) I would like to skip the phase where old movies are deleted. Because the library is as big as it is I'm only scraping all movies once. The scrapes after that first scrape only scrapes the movies found on the "recent movies" page. I fixed this by setting the HoursThreshold really high but it would be better if I just could turn it off.
2) Problems seem to occur when the database gets to big.
Code:
07/30/2011 09:15:44 em INFO    ContentScan      Querying JSON-RPC interface for all videos in library.
07/30/2011 09:15:53 em WARNING ContentScan      The response from XBMC is not a valid JSON string:
                                                    {
                                                       "id" : "1",
                                                    .....
This looks great. I don't care if you hacked the code; it's the IceFilms community that gets crabby. Hopefully you can help in getting this working for all of us as well. I'm probably just going to release this on SVN, since that's what it's currently using. I've been toying with the idea of converting it to GIT, but don't have the time. Check back on this thread for more info soon (hopefully).
1) - For now, a really high hours threshold will have to be the work-around. Maybe you can add an option when the code is avail.
2) - This tends to happen when there is a slow network. It defaults to reading the JSON on a raw TCP connection (because it's fast), but there isn't an easy way to tell when the data stream has ended, so it uses a timeout of X milliseconds. If there are network issues, this timeout can be hit when the data-stream hasn't ended. Your options are to use a wired network if you aren't already or configure it to use the slower curl option.

pkscuot Wrote:Now that Bluecop's Hulu plugin is working again, I've switched back over to using to as my Hulu source rather than PlayOn. To make my configuration simpler, I have XBMC.MyLibrary look at my Hulu Queue to figure out what to add to my library. My queue has both movies and TV Shows in it.

Given that, here's the config I'm trying use:

Code:
<Hulu path="plugin://plugin.video.hulu">
    <subfolder name="Queue" suffix=" (Hulu)" movie_set=" Streaming"/>
</Hulu>
Set that way I get the following error:

Code:
08/06/2011 07:34:03 AM INFO    Find:Subfolder   Searching for subfolder: Hulu/Queue
08/06/2011 07:34:04 AM NOTICE  Found!           Hulu's subfolder "Hulu/Queue" maps to source: plugin://plugin.video.hulu/?url="http%3A%2F%2Fm.hulu.com%2Fmenu%2Fhd_user_queue"&mode="Queue"&name="Queue"&page="1"&perpage="2000"&popular="false"&updatelisting="false" (Hulu/Queue)
08/06/2011 07:34:04 AM INFO    Search:Hulu      Found 89 videos that are already archived in dropbox from source "Hulu"
08/06/2011 07:34:04 AM NOTICE  Search:Hulu      Finding all matching videos under subfolder: Hulu/Queue
08/06/2011 07:34:04 AM NOTICE  Search:Hulu      Done retrieving files from JSON-RPC for subfolder: Hulu/Queue
08/06/2011 07:34:04 AM INFO    Archive:Skip     SKIPPING: This video source type was not specified (type="auto_determine_type") or is not yet supported: Hulu/Queue/Burn Notice - 5x3 - Mind Games
08/06/2011 07:34:04 AM WARNING Archiving        Cannot be archived: series=null, title=null, season=-1, episode=-1
                                                    Hulu/Queue/Burn Notice - 5x3 - Mind Games
If I add type="episodes" to the config, it works fine, except that it can't add the movies anymore. This same config worked when I was using PlayOn, so I'm wondering if there is anything I can do to have my Hulu queue parsed for both movies and episodes again.

Thanks.
How did you get BlueCop's Hulu to work... did you have to do anything special? It's still not working for me.
The issue you are running into is that the PlayOn custom parsing I wrote is better than the parsing for BlueCop's plugin... This can be fixed, but will take time and effort. Hopefully this can be crowd-sourced when I post the public SVN.

matmabro Wrote:@Batch

So how'd you get icefilms working? I was looking at the code and it looks like it would be pretty easy to uncomplie edit and recompile to get icefilms back, but I don't want to hammer their servers and piss anyone off especially considering the recent downtime they've had over the weekend.

I've just started playing with this 2 nights ago and I'm currently stuck with mpg files, but all the popular hulu shows are in my library... I think I should be able to fix by moving my dropbox folder, but I haven't tried that yet.

@bradvido

This is a great little script you wrote. looking forawrd to you releasing it to the community. From what I can tell, it doesn't seem like it should be too hard to turn this into an add-on, I mean mostly you are just editing the XML document then launching the script.
There should be no need to decompile once i release it, but there will be a need for some unlucky soul to clean up the code, since is wrote it in a furious few nights Blush


- bradvido88 - 2011-08-08

OK, show me what you guys can do: http://code.google.com/p/xbmc-mylibrary/


- pkscout - 2011-08-08

bradvido88 Wrote:How did you get BlueCop's Hulu to work... did you have to do anything special? It's still not working for me.
The issue you are running into is that the PlayOn custom parsing I wrote is better than the parsing for BlueCop's plugin... This can be fixed, but will take time and effort. Hopefully this can be crowd-sourced when I post the public SVN.

I figured there was different parsing. I'll either wait for someone to help add parsing or I'll just do the hack I came up with and add the Queue directory twice (once with each type). It creates lots of files I don't really want or need, but none of them get parsed into XBMC anyway.

Bluecop's Hulu plugin requires the most up-to-date librtmp. If you check the hulu plugin thread there is a post somewhere on where to get the current version. The one that was just released adds support for whatever magic flash thing Hulu was using. It's really nice to have it back, as the stream quality (even the 480p one) is much better than what I got through PlayOn.


- Batch - 2011-08-09

bradvido88 Wrote:OK, show me what you guys can do: http://code.google.com/p/xbmc-mylibrary/
Great, will look at this tomorrow. Smile

If I get my Icefilms modification to work better then I will share it. At the moment new movies added get recognized but not renamed. Having access to your code will probably help me solve it.


- Batch - 2011-08-09

matmabro Wrote:@Batch

So how'd you get icefilms working? I was looking at the code and it looks like it would be pretty easy to uncomplie edit and recompile to get icefilms back, but I don't want to hammer their servers and piss anyone off especially considering the recent downtime they've had over the weekend.
Now when the source code is released I see no harm in telling how I did it. Smile

I didn't need to decompile the jar-file. I just opened it up in a text editor and replaced all occurances of "Icefilms" to "Acefilms". Wink

If you are unsure whatever or not you are hammering their servers then you should probably avoid experimenting with Icefilms since it will get you banned.


- bradvido88 - 2011-08-09

Batch Wrote:Now when the source code is released I see no harm in telling how I did it. Smile

I didn't need to decompile the jar-file. I just opened it up in a text editor and replaced all occurances of "Icefilms" to "Acefilms". Wink

If you are unsure whatever or not you are hammering their servers then you should probably avoid experimenting with Icefilms since it will get you banned.
The thing is that my script never connects to IceFilms. It only calls the native XBMC plugin for IceFilms, which in turn talk to the IceFilms servers...
All my script does is automate what existing plugins already do in XBMC


- matmabro - 2011-08-09

As far as the jar file is concerned, that's odd. I did just change icefilms to "icesfilms" in notepad and then in a java text editor. I got an error after running saying the file was corrupt. This is why I figured I had to uncompile and recompile. I am not a programmer by any means but I am familiar with some code. Anyway, thanks bradvido for posting the raw files. I'd like to take a look at it.

Concerning the timeout error, is there any way to just adjust how long until the timeout kicks in? If you just add a couple zeros and get the whole library to load, you can confirm there's nothing actually wrong with the script. It'll all be refinement from there.


- bradvido88 - 2011-08-10

The timeout can be adjusted, but currently it's hard-coded...




- pkscout - 2011-08-11

I've looked through the configuration file docs, and I'm not seeing an option for something I would like to do. Specifically I would like to be able to specify the name of the folder that a given subfolder should create and download to. Here's my specific use case. When using Bluecop's freecable plugin to create links to shows from the CW, the final directory foe every show is called Full Episodes, and that's what XBMC.MyLibrary uses as the folder name in the file system. With just one show from the CW, I can tell XBMC what show that is and everything works fine. But I now have two other showsid like to add, but I can't, as all the episodes will be added in the same Full Episodes directory. Did I miss something in the configuration, or could this get on the implementation list. I know the code is open now, but I've never done any Java or python programming, so it would be a bit of an uphill battle for me to add it myself without someone pointing to exactly where the directory creation code is as we'll as the configuration file parser part.


- matmabro - 2011-08-12

OK, so I must be retarded or something. I have tried multiple java editors and your basic text editors to try to change the mylibrary jar file. each time I end up with a corrupt file. @bradvido, what encoding did you use on the initial jar file? I've tried all the english ones I could find... I think, but I've found like 50 or so possible options. OR, is there an easy way to edit this so as to not come out with a corrupt file in the end.

@Batch... once I get this damn file edited (or perhaps you can just send me your file you changed) I'd like to sync up just my icefilms favourites folder. What was your trick to slowing down the process so as not to overload icefilms?

--- still stellar script, just working the kinks out. I know my wife will be thrilled once I get this working as she really likes XBMC... just not having to use the plugins.