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,903
Joined: May 2009
Reputation: 178
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,903
Joined: May 2009
Reputation: 178
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,903
Joined: May 2009
Reputation: 178
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: 3
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
greatbazunka1 Offline
Junior Member
Posts: 1
Joined: Dec 2014
Reputation: 0
Post: #675
I have a question for anyone that can answer it. Please let me know if I am not making complete sense. I think my setup here is pretty simple, but let me explain what I have going on and what I would like to achieve:

The directory structures in general are the way I want them. I just want to rename the files with nicer looking file names. All of the files are in the directories where I want them, so basically I want to just use sorttv to rename the files where they sit using the normal sorttv naming convention. The problem arises in situations as follows. For example there is a directory of pokemon episodes. There are 16 seasons all sorted into their respective folders (e.g. pokemon/season 1/ episode file.mkv). But they all seem to have different naming schemes. Some are marked with season and episode number, others have total episode number on them for instance "426 pokemon episode.mkv". Some start with the word "Pokémon" and others start with the words "Pokémon: Season name". Here are a few example file names to explain better:

[P 0] Pokémon Johto Journeys 01 'Don't Touch That 'dile'.mkv
Pokémon.Rival.Destinies.S15E01.Enter.Elesa,Electrifying.Gym.Leader.mkv
pokemon indigo league 020.mkv
420 pokemon episode.mkv
(^ this is the complete series episode number that I was talking about)

Perhaps this is just a problem with Pokémon episodes and not being able to find them on the tvdb, but there are many files of different series that have different naming convensions and I tend to have to go back and rename all of these problem files to get sorttv to find them, which seems counter productive as I might as well just rename all the files manually since sorttv cant seem to find the correct information for en episode unless the file is already named just so.

So my question to all of you is this. Has anyone run into such a situation, and what is the easiest way to remedy it without having to rename all of the files manually?
It would make this whole thing easier if sorttv was smart enough to look at the current folder structure where a file resides and use that information to locate the episode information.
find quote
Post Reply