{"action":"created","issue":{"url":"https://api.github.com/repos/SiCKRAGETV/SickRage/issues/2438","labels_url":"https://api.github.com/repos/SiCKRAGETV/SickRage/issues/2438/labels{/name}","comments_url":"https://api.github.com/repos/SiCKRAGETV/SickRage/issues/2438/comments","events_url":"https://api.github.com/repos/SiCKRAGETV/SickRage/issues/2438/events","html_url":"https://github.com/SiCKRAGETV/SickRage/pull/2438","id":105266192,"number":2438,"title":"Move \"Coming episodes\" logic into a dedicated class","user":{"login":"MGaetan89","id":1009664,"avatar_url":"https://avatars.githubusercontent.com/u/1009664?v=3","gravatar_id":"","url":"https://api.github.com/users/MGaetan89","html_url":"https://github.com/MGaetan89","followers_url":"https://api.github.com/users/MGaetan89/followers","following_url":"https://api.github.com/users/MGaetan89/following{/other_user}","gists_url":"https://api.github.com/users/MGaetan89/gists{/gist_id}","starred_url":"https://api.github.com/users/MGaetan89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MGaetan89/subscriptions","organizations_url":"https://api.github.com/users/MGaetan89/orgs","repos_url":"https://api.github.com/users/MGaetan89/repos","events_url":"https://api.github.com/users/MGaetan89/events{/privacy}","received_events_url":"https://api.github.com/users/MGaetan89/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SiCKRAGETV/SickRage/labels/Refactor","name":"Refactor","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-09-07T20:48:00Z","updated_at":"2015-09-19T02:10:55Z","closed_at":"2015-09-16T00:32:30Z","pull_request":{"url":"https://api.github.com/repos/SiCKRAGETV/SickRage/pulls/2438","html_url":"https://github.com/SiCKRAGETV/SickRage/pull/2438","diff_url":"https://github.com/SiCKRAGETV/SickRage/pull/2438.diff","patch_url":"https://github.com/SiCKRAGETV/SickRage/pull/2438.patch"},"body":"I am still working on this PR. But as I found a couple of differences between the API and the web UI, I decided to open this PR to track the changes and see which version is the best and validate the choices.\r\n\r\n- Qualities definition:\r\n - API ([source](https://github.com/SiCKRAGETV/SickRage/blob/v4.0.55/sickbeard/webapi.py#L736)): `qualList = Quality.DOWNLOADED + Quality.SNATCHED + [ARCHIVED, IGNORED]`\r\n - Web UI ([source](https://github.com/SiCKRAGETV/SickRage/blob/v4.0.55/sickbeard/webserve.py#L499)): `qualList = Quality.DOWNLOADED + Quality.SNATCHED + [ARCHIVED, IGNORED]`\r\n - Solution: @miigotu confirmed that `Quality.ARCHIVED` should be used (https://github.com/SiCKRAGETV/sickrage-issues/issues/2567#issuecomment-138367874)\r\n- Sorting methods:\r\n - API ([source](https://github.com/SiCKRAGETV/SickRage/blob/v4.0.55/sickbeard/webapi.py#L759)): only sort by the required field\r\n - Web UI ([source](https://github.com/SiCKRAGETV/SickRage/blob/v4.0.55/sickbeard/webserve.py#L523)): sort by the required field and then by time\r\n - Solution: I chose the web UI option. However the `date` sort might need to use `airdate` rather than `localtime`. What do you think?\r\n- Date time format:\r\n - API: `%Y-%m-%d %H:%M` (for `future` and `show` commands)\r\n - Web UI: `%Y-%m-%d %H:%M:%S`\r\n - Solution: Use the Web UI format (`%Y-%m-%d %H:%M:%S`) everywhere (https://github.com/SiCKRAGETV/SickRage/pull/2438#issuecomment-139912848)\r\n\r\nThe rest of the logic looks similar, except in the SQL queries. The API only select what is needed (at least it looks like it does), while the web UI selects **everything**. I will try to improve that to select only what we need.\r\n\r\nhttps://github.com/SiCKRAGETV/sickrage-issues/issues/2567"},"comment":{"url":"https://api.github.com/repos/SiCKRAGETV/SickRage/issues/comments/141609423","html_url":"https://github.com/SiCKRAGETV/SickRage/pull/2438#issuecomment-141609423","issue_url":"https://api.github.com/repos/SiCKRAGETV/SickRage/issues/2438","id":141609423,"user":{"login":"fernandog","id":2620870,"avatar_url":"https://avatars.githubusercontent.com/u/2620870?v=3","gravatar_id":"","url":"https://api.github.com/users/fernandog","html_url":"https://github.com/fernandog","followers_url":"https://api.github.com/users/fernandog/followers","following_url":"https://api.github.com/users/fernandog/following{/other_user}","gists_url":"https://api.github.com/users/fernandog/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandog/subscriptions","organizations_url":"https://api.github.com/users/fernandog/orgs","repos_url":"https://api.github.com/users/fernandog/repos","events_url":"https://api.github.com/users/fernandog/events{/privacy}","received_events_url":"https://api.github.com/users/fernandog/received_events","type":"User","site_admin":false},"created_at":"2015-09-19T02:10:55Z","updated_at":"2015-09-19T02:10:55Z","body":"@MGaetan89 \r\n\r\nIn \"coming episodes' Continuum appears as \"missed\" but in the API appears as Today\r\nNow its 23:10 here. Dailysearch already changed to \"Wanted\"\r\n\r\n![image](https://cloud.githubusercontent.com/assets/2620870/9974141/1d250834-5e5a-11e5-97b6-36feed6114f1.png)\r\n\r\n**Missed**\r\n```\r\n/api/*****/?cmd=future&sort=date&type=missed\r\n{\r\n    \"data\": {\r\n        \"missed\": [\r\n            {\r\n                \"airdate\": \"2015-09-17\", \r\n                \"airs\": \"quinta 11:00 \", \r\n                \"ep_name\": \"Bewilderment of Heart\", \r\n                \"ep_plot\": \"The Darkness overtakes the citizens of Vega; William wrestles with the truth about his time in the desert; Arika becomes the victim of her own manipulations; Michael grows concerned about Noma; Alex searches for the Amphora.\", \r\n                \"episode\": 11, \r\n                \"indexerid\": 277462, \r\n                \"network\": \"Syfy\", \r\n                \"paused\": 0, \r\n                \"quality\": \"Custom\", \r\n                \"season\": 2, \r\n                \"show_name\": \"Dominion\", \r\n                \"show_status\": \"Continuing\", \r\n                \"tvdbid\": 277462, \r\n                \"weekday\": 4\r\n            }\r\n        ]\r\n    }, \r\n    \"message\": \"\", \r\n    \"result\": \"success\"\r\n}\r\n```\r\n\r\n**Today**\r\n```\r\n/api/*****/?cmd=future&sort=date&type=today\r\n{\r\n    \"data\": {\r\n        \"today\": [\r\n            {\r\n                \"airdate\": \"2015-09-18\", \r\n                \"airs\": \"sexta 10:00 \", \r\n                \"ep_name\": \"Power Hour\", \r\n                \"ep_plot\": \"Alec joins Carlos and the VPD; Kiera and Garza form an alliance.\", \r\n                \"episode\": 3, \r\n                \"indexerid\": 258171, \r\n                \"network\": \"Showcase (CA)\", \r\n                \"paused\": 0, \r\n                \"quality\": \"Custom\", \r\n                \"season\": 4, \r\n                \"show_name\": \"Continuum\", \r\n                \"show_status\": \"Continuing\", \r\n                \"tvdbid\": 258171, \r\n                \"weekday\": 5\r\n            }\r\n        ]\r\n    }, \r\n    \"message\": \"\", \r\n    \"result\": \"success\"\r\n}\r\n```"}}