Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trakt to Sonarr plugin: Add couple more options. #2040

Merged
merged 12 commits into from Dec 19, 2017

Conversation

Projects
None yet
3 participants
@JourneyOver
Copy link
Contributor

commented Dec 15, 2017

Motivation for changes:

Adding more options to the sonarr plugin for Trakt to sonarr

Detailed changes:

  • Added option to set quality profile ID (defaults to 1/any) -- You can find quality profile/profile ID at http://localhost:8989/api/profile?apikey=APIKEY
  • Added option to set season folder -- True/False (Default is False)
  • Added option to set monitored status of whole series -- True/False (Default is True)

*** NOTE
One thing I don't understand is the why there is a profileId and a qualityProfileId as it seems only the profileId actually does anything, but I'm leaving it in as it seems it's part of the API call anyways versus profileId not being any part of the Sonarr API..

EDIT:

  • Added option to set rootfolderpath -- The way I had to set this up was that it uses the ID instead of a string path (as I couldn't get string paths to work for some reason) and it would take the number from "rootFolderPath" config and subtract it by 1 due to how things are currently programs in the sonarr.py script, so 1 = 0, 2 = 1, so on and so forth. (Defaults to 1) You can find the rootFolder ID here http://localhost:8989/api/rootfolder?apikey=APIKEY

Sadly the way I had to setup rootFolderPath means you have to already have 1 or more rootFolderPaths already created in sonarr for this option to work.

EDIT2:

  • Added Option for seriesType, string value of standard, daily, or anime. (default value is standard)
Add couple more options.
~ Added option to set quality profile ID (defaults to 1/any) -- You can find quality profile/profile ID at http://localhost:8989/api/profile?apikey={APIKEY}
~ Added option to set season folder -- True/False Default is False
~ Added option to set monitored status of whole series -- True/False Default is True

*** NOTE
One thing I don't understand is the why there is a profileId and a qualityProfileId as it seems only the profileId actually does anything, but I'm leaving it in as it seems it's part of the API call anyways versus profileId not being any part of the Sonarr API..

@JourneyOver JourneyOver changed the title Add couple more options. Trakt to Sonarr plugin: Add couple more options. Dec 15, 2017

Make option for rootFolderPath
~ The way I had to set this up was that it uses the ID instead of a string path and it would take the number from "rootFolderPath" config and subtract it by 1, so 1 = 0, 2 = 1, so on and so forth. You can find the rootFolderID here http://localhost:8989/api/rootfolder?apikey={APIKEY}

*** Note
Again I don't really know if this messes with anything for trakt/sonarr to only flexget. Doesn't mess anything up for trakt to sonarr though.
@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 16, 2017

If you need me to explain a little bit better on how the rootFolderPath stuff is setup let me know but it should be kinda easy to understand in some form.

1 = 0
2 = 1
3 = 2
and so on

Let's say you have 3 rootFolderPaths setup for an example.
"D:\Media\TV Shows"
"D:\Media\Anime"
"F:\Media\Anime"

the first rootFolderPath in the API is set as 1, but the current iteration of the trakt to sonarr plugin sees/makes the first one act like a 0 instead, second one would be a 2 but plugin sees it as a 1 and third would be 3 but again plugin sees it as a 2. So this is where my subtract 1 comes into play. Say you want the rootFolderPath to be "F:\Media\Anime" for example, well the ID for it in reality is 3 so you can put 3 in your config for "rootFolderPath" and when the trakt to sonarr plugin runs it'll push the correct rootFolderPath since I am subtracting 1 from that 3 so the plugin sees it as 2 which would be correct in the plugins eyes.

'profile_id': {'type': 'number', 'default': 1},
'season_folder': {'type': 'boolean', 'default': False},
'monitored': {'type': 'boolean', 'default': True},
'rootFolderPath': {'type': 'number', 'default': 1}

This comment has been minimized.

Copy link
@cvium

cvium Dec 16, 2017

Member

We always use snake case and not camel case

This comment has been minimized.

Copy link
@JourneyOver

JourneyOver Dec 16, 2017

Author Contributor

@cvium will have it fixed up here in a moment.

This comment has been minimized.

Copy link
@cvium

This comment has been minimized.

Copy link
@JourneyOver

JourneyOver Dec 16, 2017

Author Contributor

This has now been taken care of.

Add seriesType option
~ Adds Option for seriesType, string value of standard, daily, or anime. (default value is standard)

## Currently working on getting an option to set tags, but it's being very tricky..
@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 16, 2017

And with the seriesType option I believe that is now everything that is possible. I am waiting on an answer about tags, but I believe it's not possible during the phase of adding a series so I guess we can call this finished.

@JourneyOver JourneyOver referenced this pull request Dec 16, 2017

Open

Trakt Integration #309

0 of 2 tasks complete
'season_folder': {'type': 'boolean', 'default': False},
'monitored': {'type': 'boolean', 'default': True},
'root_folder_path': {'type': 'number', 'default': 1},
'series_type': {'type': 'string', 'default': 'standard'}

This comment has been minimized.

Copy link
@liiight

liiight Dec 17, 2017

Member

This is a closed list right? Please limit it with an enum

This comment has been minimized.

Copy link
@JourneyOver

JourneyOver Dec 17, 2017

Author Contributor

yes and done.

'profile_id': {'type': 'number', 'default': 1},
'season_folder': {'type': 'boolean', 'default': False},
'monitored': {'type': 'boolean', 'default': True},
'root_folder_path': {'type': 'number', 'default': 1},

This comment has been minimized.

Copy link
@liiight

liiight Dec 17, 2017

Member

I think this should be an integer

This comment has been minimized.

Copy link
@JourneyOver

JourneyOver Dec 17, 2017

Author Contributor

it doesn't seem to matter between it being a number or an integer typing as both ways work just fine, but I went ahead and switched it and profile_id to be an integer type instead of number type (as it's an int as well going by https://github.com/Sonarr/Sonarr/wiki/Series#post).

@liiight

This comment has been minimized.

Copy link
Member

commented Dec 17, 2017

Thanks for this, I plan to give this a closer look and maybe even test this on Monday

Requested changes
~ Changed root_folder_path to be an int instead of a number, did the same to profile_id as it's supposed to be an int anyways as well..
~ Added an enum to series_type as it's a closed list
@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 17, 2017

@liiight not a problem at all :p didn't know if/when you where going to do my requests so I just took it upon myself to get them done, and along the way I added options I didn't even request as well xD I hope that I made the root_folder_path change somewhat understandable in my explanation on how it all works now.

btw don't forget to test my #2041 bug while your at it ;) since it's an issue even with the default plugin.

@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2017

So I'm adding tags as an option now as I have now gotten confirmation that it's possible during series creation phase, two notes though.

  1. You can't create new tags during this phase so you will have to create all tags you want to use before hand in sonarrs webUI.
  2. You have to use an ID number to set the tag as you can only pass an integer for tags (like profile ID)

You can find the ID for each tag by going here http://localhost:8989/api/tag?apikey=APIKEY

I have set the default value of a 0 to not pass any tags in if you don't add tags to your config.

============================================

I should mention for anyone who is wanting to test/use this before it gets merged / I update the plugin page (which will happen once this gets merged) the newest additions are

profile_id:

Allows you to change the quality profile that is selected during series creation | You can find quality profile/profile ID at http://localhost:8989/api/profile?apikey=APIKEY | Default value is 1 (any)

season_folder:

Allows you to set the season folder to either true or false | Values are True / False | Default value is false

monitored:

Allows you to set the series to either monitored or paused instead of just a episodes with file/no files basis | Values are True (monitored) / False (paused) | Default value is true. | If set to false you don't have to use "ignore_episodes_with_files" or "ignore_episodes_without_files".

root_folder_path:

Allows you to change the location of the root folder path | You can find the rootFolder ID at http://localhost:8989/api/rootfolder?apikey=APIKEY | Requires you to have pre-setup any root folders you plan on using. | Default value points to the root folder path you first setup.

series_type:

Allows you to change the series type between standard, daily, or anime | Values are standard / daily / anime | Default value is standard | Value must be lowercase

tags:

Allows you to set tags | Has to be by ID and has to be set up like example [1,2,3,4,5] (replacing any numbers with your tag IDs) Tag ID's can be found at http://localhost:8989/api/tag?apikey=APIKEY | Requires you to have pre-setup any tags you plan on using. | Default value is [0] (not passing any tags)

Add option to set tags
Allows you to set tags | Has to be by ID and has to be set up like example [1,2,3,4,5] (replacing any numbers with your tag IDs) Tag ID's can be found at http://localhost:8989/api/tag?apikey=API | Requires you to have pre-setup any tags you plan on using. | Default value is [0] (not passing any tags)
@liiight

This comment has been minimized.

Copy link
Member

commented Dec 18, 2017

what was the issue with specifying a path for rootFolderPath? that int thingy is weird...

@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2017

@liiight for some reason I couldn't get a string value to work exactly for rootFolderPath, I think it's due to the way the script is setup (plus I don't know enough python to really dive into the the script), and part of the reason for setting up using int is for the default value.

@liiight

This comment has been minimized.

Copy link
Member

commented Dec 18, 2017

I can see you can also send path directly. Might be better just to use that (or maybe keep both).
other than that i'm fine with the changes.

I kinda wished we had some tests for sonarr but that's a tall order that's unrelated to this pr

@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2017

Actually path was already in there by default (in the default script), you need to send both rootfolderpath and path together as path appends to the end of rootfolderpath. so instead of it just being for example

D:\Media\TV Shows

it turns into

D:\Media\TV Shows\{nameofshow}

if you only use path, then it would fail since you'd only be passing in {nameofshow}

@liiight

This comment has been minimized.

Copy link
Member

commented Dec 18, 2017

ah, my bad. ill see about that failing test though and merge this

@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2017

Alright thanks ^^ btw for the most part the int thing for the rootFolderPath shouldn't be hard on any users as everyone will be using the actual ID of the rootFolderPath, it may just seem confusing to people who look at it from the script point of things xD

@liiight

This comment has been minimized.

Copy link
Member

commented Dec 18, 2017

maybe add a comment in the code then

@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2017

Yea I can do that while your working on seeing what the issue is with #2041 should have a comment on the code up in a jiffy

JourneyOver added some commits Dec 18, 2017

@JourneyOver

This comment has been minimized.

Copy link
Contributor Author

commented Dec 18, 2017

@liiight added comments, idk if it makes it any easier really as I tend to make comments confusing sometimes even if I don't mean to, just how my brain works :x but let me know if it's any better.

'profile_id': {'type': 'integer', 'default': 1},
'season_folder': {'type': 'boolean', 'default': False},
'monitored': {'type': 'boolean', 'default': True},
'root_folder_path': {'type': 'integer', 'default': 1}, # Users are passing actual rootFolderPath ID (number (integer) starting from 1 and going up) as apposed to an number (integer) system starting from 0. Passing root_folder_path as a string seems to make the script fail, so that's why it's coded as an integerinstead. Read comment on show['rootFolderPath'] for more information.

This comment has been minimized.

Copy link
@liiight

liiight Dec 18, 2017

Member

That's way too long, keep line limit to 108 chars please

This comment has been minimized.

Copy link
@JourneyOver

JourneyOver Dec 18, 2017

Author Contributor

Okay, I'll try to condense it down in some way.

This comment has been minimized.

Copy link
@liiight

liiight Dec 18, 2017

Member

Feel free to use multi line comments

Make comments less than 120 chars & multi line.
I hope this is better >..<

JourneyOver added some commits Dec 18, 2017

@liiight liiight merged commit be5f3ab into Flexget:develop Dec 19, 2017

4 of 5 checks passed

ci/circleci: test-py36 Your tests failed on CircleCI
Details
Codacy/PR Quality Review Good work! A positive pull request.
Details
ci/circleci: test-py27 Your tests passed on CircleCI!
Details
ci/circleci: test-py34 Your tests passed on CircleCI!
Details
ci/circleci: test-py35 Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.