SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac)

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jappish84 Offline
Junior Member
Posts: 15
Joined: Mar 2013
Reputation: 0
Post: #661
First of all let me say thank you for a great script! It is awesome!

I don't know if it's already possible to do what I'm trying to do, but I haven't managed to get it right.

I would like not to rename sorted tv shows or movies, but I would like SortTV to sort movies into directories anyway, is this possible to do? Seems like I have to activate renaming for the create-folder function to work.


Thanks
find quote
mdmacd1 Offline
Junior Member
Posts: 3
Joined: Oct 2014
Reputation: 0
Post: #662
I have just started working with XBMC and SortTV and I have run into a bit of a wall. I searched the forums and was not able to find a solution, so I hope that I didn't miss it.

The SortTV script seems to work perfectly with the only issue being that I can't seem to get it to update my XBMC. When I run the script, I can see is properly setting up a socket and sending data, but XBMC doesn't get updated and there is no pop up. The data it sends is:

{"id":1,"method":"VideoLibrary.Scan","params":[],"jsonrpc":"2.0"}{"jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": 1}\n
{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"New Shows Available to Watch","message":"My Favorite Show S01E01","image":""},"displaytime":10000,"id":1}

When I use the following:

curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://localhost:8080/jsonrpc

It works properly. Can anybody suggest a solution or where to look?
find quote
nickr Offline
Donor
Posts: 9,640
Joined: May 2009
Reputation: 174
Location: Christchurch NZ
Post: #663
(2014-10-26 21:43)mdmacd1 Wrote:  I have just started working with XBMC and SortTV and I have run into a bit of a wall. I searched the forums and was not able to find a solution, so I hope that I didn't miss it.

The SortTV script seems to work perfectly with the only issue being that I can't seem to get it to update my XBMC. When I run the script, I can see is properly setting up a socket and sending data, but XBMC doesn't get updated and there is no pop up. The data it sends is:

{"id":1,"method":"VideoLibrary.Scan","params":[],"jsonrpc":"2.0"}{"jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": 1}\n
{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"New Shows Available to Watch","message":"My Favorite Show S01E01","image":""},"displaytime":10000,"id":1}

When I use the following:

curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://localhost:8080/jsonrpc

It works properly. Can anybody suggest a solution or where to look?

Your first example runs VideoLibrary.ScanForContent. the second runs VideoLibrary.Scan. The latter is correct.

If I have helped you or increased your knowledge, click the plus button and increase my reputation :)
find quote
mdmacd1 Offline
Junior Member
Posts: 3
Joined: Oct 2014
Reputation: 0
Post: #664
(2014-10-26 22:17)nickr Wrote:  Your first example runs VideoLibrary.ScanForContent. the second runs VideoLibrary.Scan. The latter is correct.

Thanks but the first example is what is being sent from SortTV. Does it need to be modified?
find quote
nickr Offline
Donor
Posts: 9,640
Joined: May 2009
Reputation: 174
Location: Christchurch NZ
Post: #665
(2014-10-27 00:16)mdmacd1 Wrote:  
(2014-10-26 22:17)nickr Wrote:  Your first example runs VideoLibrary.ScanForContent. the second runs VideoLibrary.Scan. The latter is correct.

Thanks but the first example is what is being sent from SortTV. Does it need to be modified?

Well I don't see scanforcontent on this page: http://kodi.wiki/view/JSON-RPC_API/v6

If I have helped you or increased your knowledge, click the plus button and increase my reputation :)
find quote
mdmacd1 Offline
Junior Member
Posts: 3
Joined: Oct 2014
Reputation: 0
Post: #666
(2014-10-27 00:58)nickr Wrote:  
(2014-10-27 00:16)mdmacd1 Wrote:  
(2014-10-26 22:17)nickr Wrote:  Your first example runs VideoLibrary.ScanForContent. the second runs VideoLibrary.Scan. The latter is correct.

Thanks but the first example is what is being sent from SortTV. Does it need to be modified?

Well I don't see scanforcontent on this page: http://kodi.wiki/view/JSON-RPC_API/v6

Neither do I, I guess I need to try to modify the sorttv.pl script
find quote
mrbrookz Offline
Junior Member
Posts: 3
Joined: Jul 2014
Reputation: 0
Post: #667
(2014-10-27 01:51)mdmacd1 Wrote:  
(2014-10-27 00:58)nickr Wrote:  
(2014-10-27 00:16)mdmacd1 Wrote:  Thanks but the first example is what is being sent from SortTV. Does it need to be modified?

Well I don't see scanforcontent on this page: http://kodi.wiki/view/JSON-RPC_API/v6

Neither do I, I guess I need to try to modify the sorttv.pl script

One possible work-around, not sure if this is of much use: I use to sortTV script to sort into folders, e.g. once every 4 hours with cron, then use the library updater addon (http://kodi.wiki/view/Add-on:XBMC_Library_Auto_Update) to scan the library every 4 hours.
find quote
10480 Offline
Junior Member
Posts: 2
Joined: Nov 2014
Reputation: 0
Post: #668
I've searched around and haven't found a solution to what is probably the simplest of issues. I have this script, which is amazing, set to run after the completion of a download. The only issue I can't seem to resolve is that instead of extracting and placing the file in the designated folder, it extracts into the source folder from the original download, then copies the file over to the designated folder. This leaves me with 2 copies. I have "sort-by=MOVE" set. Am I missing something?

Thanks
find quote
FaQuid Offline
Junior Member
Posts: 7
Joined: Aug 2005
Reputation: 0
Location: Göteborg - Sweden
Post: #669
Hi,

First of I would like to thank you for this very nice script!

Second here is a very small code contribution:

Code:
@subtitleext("ssa", "srt", "sub", "idx");

I added the idx part since VobSub uses both an .sub file and an .idx file
find quote
FaQuid Offline
Junior Member
Posts: 7
Joined: Aug 2005
Reputation: 0
Location: Göteborg - Sweden
Post: #670
(2014-10-27 01:51)mdmacd1 Wrote:  
(2014-10-27 00:58)nickr Wrote:  
(2014-10-27 00:16)mdmacd1 Wrote:  Thanks but the first example is what is being sent from SortTV. Does it need to be modified?

Well I don't see scanforcontent on this page: http://kodi.wiki/view/JSON-RPC_API/v6

Neither do I, I guess I need to try to modify the sorttv.pl script

This works fine for me on 13.2:
Code:
curl --data-binary '{"id":1,"method":"VideoLibrary.Scan","params":[],"jsonrpc":"2.0"}{"jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": 1}\n' -H 'content-type: application/json;' http://localhost:8080/jsonrpc
Result:
Code:
{"id":1,"jsonrpc":"2.0","result":"OK"}

But not this:
Code:
curl --data-binary '{"jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": 1}\n' -H 'content-type: application/json;' http://localhost:8080/jsonrpc
Result:
Code:
{"error":{"code":-32601,"message":"Method not found."},"id":1,"jsonrpc":"2.0"}
Which is not surprising since that method is no longer supported and is now the Scan method. I don't know how the chain works here, but it might accually just pick the one that the target xbmc is using.

What are your values for xbmc-remote-control and xbmc-remote-control-port?
find quote
nickr Offline
Donor
Posts: 9,640
Joined: May 2009
Reputation: 174
Location: Christchurch NZ
Post: #671
The current master code on sourceforge for this function is:

Code:
update_xbmc {
$new = '' if !$new;
my $sock = new IO::Socket::INET (
PeerAddr => $xbmcaddress,
PeerPort => $xbmcport,
Proto => 'tcp', 6 );
if($sock) {
print $sock '{"id":1,"method":"VideoLibrary.Scan","params":[],"jsonrpc":"2.0"}';
print $sock '{"jsonrpc": "2.0", "method": "VideoLibrary.ScanForContent", "id": 1}\n';
print $sock "{\"jsonrpc\":\"2.0\",\"method\":\"GUI.ShowNotification\",\"params\":{\"title\":\"New Shows Available to Watch\",\"message\":\"$new\",\"image\":\"\"},\"displaytime\":10000,\"id\":1}\n";
close($sock);
} else {
out("warn", "WARN: Could not connect to xbmc server: $!\n");
}

Which seems to send 3 JSON commands. The third is a notification.

The first two seem to be trying to scan, however the second one is wrong according to the current API. Perhaps due to the fact that all three commands have id of 1 the JSON server is getting confused? The JSON-RPC spec says:

Quote:id - The request id. This can be of any type. It is used to match the response with the request that it is replying to.
- I would have thought the id should be unique if you are sending three commands in rapid succession.

The code doesn't seem to do anything with the response either. Surely it should? How else does it tell that the command was successful. The ionly thing it seems to test is whether a socket is actually established. That doesn't tell you if the command is successful.

If I have helped you or increased your knowledge, click the plus button and increase my reputation :)
find quote
10480 Offline
Junior Member
Posts: 2
Joined: Nov 2014
Reputation: 0
Post: #672
(2014-11-01 01:58)10480 Wrote:  I've searched around and haven't found a solution to what is probably the simplest of issues. I have this script, which is amazing, set to run after the completion of a download. The only issue I can't seem to resolve is that instead of extracting and placing the file in the designated folder, it extracts into the source folder from the original download, then copies the file over to the designated folder. This leaves me with 2 copies. I have "sort-by=MOVE" set. Am I missing something?

Thanks

I've also noticed that even with the polling feature hashed out, it's still running every 5 minutes. Has anyone else experienced this?
find quote
vcarriere Offline
Junior Member
Posts: 3
Joined: Nov 2013
Reputation: 0
Post: #673
Does anyone have an idea how i could make the script not search inside folder with ".app" in the folder name.

Its messing up applications on my mac server.

Edit :

Answered my own question.

Added ignore=*.app* in the ignore file list.
(This post was last modified: 2014-11-10 05:15 by vcarriere.)
find quote
true_blue Offline
Junior Member
Posts: 2
Joined: Sep 2014
Reputation: 0
Post: #674
I can get it to sort movies but NOT TV shows. The sorting folder stays in tact and the sorted folder is still empty. Please help.......
find quote
Post Reply