Externally call "Scan for new content" on specific TV Show
#1
Hi,

I was just wondering whether there was yet any mechanism to achieve what I have described in the title.

I run XBMC under linux and move shows into their respective directories from the command line. If there was a way I could create a script that would scan a TV show in the library associated with a particular directory from the command line then I would be very happy.

I find myself having to manually do this very frequently and it would be nice if I could at least partially automate it.

Thanks in advance for any help and thanks to all the developers and contributors for a wonderful application.

Regards,
Michal
Reply
#2
Sure.. search the forums for http api and curl/wget.

Or even search the manual.

You can use http requests to scan for new content.

For example, I use sabnzbd and when the show is done downloading, it automatically invokes my updatexbmclib.sh script:

#!/bin/sh
curl --get "http://192.168.1.254:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
42.7% of all statistics are made up on the spot

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#3
Wow. Thanks. That's fantastic.

For some reason I assumed it wasn't in the API as last time I looked there I don't believe there was a ExecBuiltIn command with access to this.

The possibilities make me really excited about playing around with these:
http://wiki.xbmc.org/?title=List_of_Built_In_Functions

Thanks again!
Reply
#4
I've run into one problem that I can't seem to find the solution for.

How do I pass a path with spaces in it? I've tried single and double quotes with and without \ to escape the spaces.

Not sure exactly what I should be searching for to find the solution. Obviously it's possible as this command gets called when you do it manually from the menu, it's just that I'm logging in remotely via ssh at the moment so I can't check.

Regards,
Michal
Reply
#5
Why not just use what I provided. Granted it will do the whole video library.

I am not sure about when you specify a path with spaces as I have not tried.

Maybe provide a log when you get one.
42.7% of all statistics are made up on the spot

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#6
and of course you can have spaces, url encode the string
Reply
#7
Probably just use %20
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#8
I just turn on the web server in xbmc then set up a bookmark on my browser that points to:

Code:
http://[i]ipaddress[/i]:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)

Simple, yet effective.

Pete
Reply
#9
Oops.
I thought I had responded but it seems my crappy internet connection ate my post.

Thanks to everyone for the help, I have however discovered that this doesn't seem to have the same effect as "Scan for New Content".

If I specify the TV Show path in which I have added new episodes it actually attempts to scan the episode directories as if they were show names. Obviously this fails.

The reason I cannot update the entire library is that many of the shows I have in it mis-scan if I try to update them creating a LOT of work for me trying to clean it up again.

It seems there is no ExecBuiltIn for the Scan for New Content function, is this right?

Regards,
Michal
Reply
#10
For what it's worth here is a log of a scan: http://pastebin.com/m31ac743a

Basically I have /mnt/media/TV Shows/<ShowDir>/<EpisodeDir>/<EpisodeFiles>

In this case the first 9 episodes have already been scanned and if I were to choose "Scan for New Content" from the show context menu in the library I would expect episodes 10 and 11 to show up.

There is no way to do this remotely so I haven't had a chance to capture the log of a successful scan yet. I scanned the earlier episodes this way as I encoded them and it worked.

Does this shed any light? Or is it just an inherent limitation to the way that this function and the path parameter work currently?

I've downloaded the XBMC Linux source to try and figure out how Scan for New Content works but I've never dealt with code of this complexity (or CPP for that matter) so it's going to take me ages to figure out without help.

Thanks in advance.

Regards,
Michal
Reply
#11
I was right. Scan for New Content works, as demonstrated in these log entries.

http://pastebin.org/12832

I still can't figure out the code. I wish someone better clued in than me could at least have a look and explain what's going on. I can only theorise that the Scan for New Content calls on the database entry for the show which points at the directory rather than starting from the directory itself. Presumably it KNOWS that the show already has a content set and just scans the path for new content. The "update library" on the other hand doesn't do so and therefore assumes that the content is not set (thus scanning for series rather than episodes of the already scanned show).

Am I on the right track? Can a new function (scan for new content) be added that is equivalent to update library with the additional check of whether the supplied path is associated with a series (and thus has a content already set)?

I'm a LONG way from understanding the code, so I hope someone more skilled could help out. I'd very much appreciate it.

Regards,
Michal
Reply
#12
Hello ! Big Grin

I think I have the same problem: I want to scan new content, but not rescan all my library (because rescanning all video library is pretty long on my xbox...).

Here's my setup:
  • XBMC for xbox r21142 with Transparency! v1.03 (but I don't think skin is important here)
  • the xbox (dns name krusty) is connected to a linux debian server (dns name moe) with a samba share
  • I added a smb video source and when I go to the Video section I have "Videos" which refers to my smb share (smb://MOE/ftp/Videos/) and inside Videos i can see the content of my server, to make it simple lets say I have two subdirectories "TV" and "Movies"

so when I try this command:

Code:
curl -s --get "http://krusty/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video)"

everything seems fine, the library starts updating itself.

If I check the list of built in functions it seems that UpdateLibrary can have another parameter for specifying a path to update:

Quote:UpdateLibrary(database,[path])
Takes either "video" or "music" as a parameter to begin updating the corresponding database. For "video" you can additionally specify a specific path to be scanned.

So I try:
Code:
13:50 madmatt@bart ~% curl -s --get "http://krusty/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video;smb://MOE/ftp/Videos/TV/Weeds))"
<html>
<li>OK</html>

in the xbmc.log file on the xbox I can see:
Code:
13:50:21 M: 37081088   DEBUG: HttpApi Start command: ExecBuiltIn  paras: ExecBuiltIn; UpdateLibrary(video;smb://MOE/ftp/Videos/TV/Weeds)

the parameter seems OK, but nothing happens Eek

I've tried different path parameters ("Videos/TV/Weeds", "/Videos/TV/Weeds", "smb://user:userpass@MOE/ftp/Videos/TV/Weeds"....) but nothing's triggering the library update when i use the path parameters.

it seems that it's the same thing you're trying to do michal...
did you find a solution ?
or can somebody tell me how the path parameter in updatelibrary works ?

Thank you Nod
Reply
#13
, not ;
Reply
#14
Yes, it should be a comma, not a semi-colon. Also, if you have a space you must use %20 to denote it.

The problem is that it's not going to work regardless. If it does, then I would be eager to see your folder hierarchies and your xbmc.log for the scan.

Regards,
Michal
Reply
#15
worked fine when i commited it - tested both local and smb shares. until i see proof otherwise, i'd say your issue is most likely pebkac
Reply

Logout Mark Read Team Forum Stats Members Help
Externally call "Scan for new content" on specific TV Show0