{"action":"opened","issue":{"url":"https://api.github.com/repos/simon-weber/gmusicapi/issues/370","labels_url":"https://api.github.com/repos/simon-weber/gmusicapi/issues/370/labels{/name}","comments_url":"https://api.github.com/repos/simon-weber/gmusicapi/issues/370/comments","events_url":"https://api.github.com/repos/simon-weber/gmusicapi/issues/370/events","html_url":"https://github.com/simon-weber/gmusicapi/issues/370","id":111161433,"number":370,"title":"Mobileclient v2.0w - Station Categories","user":{"login":"Tadly","id":503647,"avatar_url":"https://avatars.githubusercontent.com/u/503647?v=3","gravatar_id":"","url":"https://api.github.com/users/Tadly","html_url":"https://github.com/Tadly","followers_url":"https://api.github.com/users/Tadly/followers","following_url":"https://api.github.com/users/Tadly/following{/other_user}","gists_url":"https://api.github.com/users/Tadly/gists{/gist_id}","starred_url":"https://api.github.com/users/Tadly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tadly/subscriptions","organizations_url":"https://api.github.com/users/Tadly/orgs","repos_url":"https://api.github.com/users/Tadly/repos","events_url":"https://api.github.com/users/Tadly/events{/privacy}","received_events_url":"https://api.github.com/users/Tadly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-13T11:33:04Z","updated_at":"2015-10-13T11:33:04Z","closed_at":null,"body":"Mobileclient v2.0w - Station Categories\r\n\r\nNew API-Url\r\nhttps://mclients.googleapis.com/sj/v2.0w/\r\n\r\n**Listen now** content can be retrieved via:\r\n```sj_url + browse/stationcategories```\r\n```sj_url + browse/stations/<station_id> (supports dynamic_param -> location_id)```\r\n\r\n**Original response (stripped-down) -> browse/stationcategories**\r\n```json\r\n{\r\n    \"kind\": \"sj#getStationCategoriesResponse\", \r\n    \"root\": {\r\n        \"kind\": \"sj#stationCategory\", \r\n        \"subcategories\": [\r\n            {\r\n                \"kind\": \"sj#stationCategory\", \r\n                \"subcategories\": [\r\n                    {\r\n                        \"kind\": \"sj#stationCategory\", \r\n                        \"display_name\": \"Dance & Electronic\", \r\n                        \"id\": \"JZC3321\"\r\n                    }\r\n                ], \r\n                \"display_name\": \"Genres\", \r\n                \"id\": \"JZC3319\"\r\n            }, \r\n            {\r\n                \"kind\": \"sj#stationCategory\", \r\n                \"subcategories\": [\r\n                    {\r\n                        \"kind\": \"sj#stationCategory\", \r\n                        \"display_name\": \"Falling Asleep\", \r\n                        \"id\": \"JZC3306\"\r\n                    }\r\n                ], \r\n                \"display_name\": \"Activities\", \r\n                \"id\": \"JZC3320\"\r\n            }, \r\n            {\r\n                \"kind\": \"sj#stationCategory\", \r\n                \"subcategories\": [\r\n                    {\r\n                        \"kind\": \"sj#stationCategory\", \r\n                        \"display_name\": \"Energetic\", \r\n                        \"id\": \"JZC3346\"\r\n                    }\r\n                ], \r\n                \"display_name\": \"Moods\", \r\n                \"id\": \"JZC3310\"\r\n            }, \r\n            {\r\n                \"kind\": \"sj#stationCategory\", \r\n                \"subcategories\": [\r\n                    {\r\n                        \"kind\": \"sj#stationCategory\", \r\n                        \"display_name\": \"1980s\", \r\n                        \"id\": \"JZC3356\"\r\n                    }\r\n                ], \r\n                \"display_name\": \"Decades\", \r\n                \"id\": \"JZC3311\"\r\n            }\r\n        ], \r\n        \"display_name\": \"BROWSE_STATIONS_ROOT\", \r\n        \"id\": \"BROWSE_STATIONS_ROOT\"\r\n    }\r\n}\r\n```\r\n\r\n**Proof-of-Concept implementation**\r\n```python\r\n#protocol/mobileclient.py\r\nclass GetStationCategories(McCall):\r\n    static_params = {'alt': 'json'}\r\n    static_method = 'GET'\r\n    static_url = sj_url + 'browse/stationcategories'\r\n\r\n#clients/mobileclient.py\r\n...\r\ndef get_station_categories(self):\r\n    res = self._make_call(mobileclient.GetStationCategories)\r\n    return res['root']['subcategories']\r\n...\r\n```\r\n\r\n**Original response (stripped-down) -> browse/stations/JZC3321 (id picked from Genres -> Dance & Electronic. location_id=en_US)**\r\n```json\r\n{\r\n    \"kind\": \"sj#getStationsResponse\", \r\n    \"stations\": [\r\n        {\r\n            \"kind\": \"sj#radioStation\",\r\n            \"name\": \"Relaxed Electronica\",\r\n            \"compositeArtRefs\": [\r\n                {\r\n                    \"url\": \"http://lh3.googleusercontent.com/...\",\r\n                    \"kind\": \"sj#imageRef\",\r\n                    \"aspectRatio\": \"2\"\r\n                }\r\n            ],\r\n            \"seed\": {\r\n                \"kind\": \"sj#radioSeed\",\r\n                \"curatedStationId\": \"Ltsxgnw2ay732rpoaoqijj5quwu\",\r\n                \"seedType\": \"9\"\r\n            },\r\n            \"skipEventHistory\": [],\r\n            \"stationSeeds\": [\r\n                {\r\n                    \"kind\": \"sj#radioSeed\",\r\n                    \"curatedStationId\": \"Ltsxgnw2ay732rpoaoqijj5quwu\",\r\n                    \"seedType\": \"9\"\r\n                }\r\n            ],\r\n            \"imageUrls\": [\r\n                {\r\n                    \"url\": \"http://lh5.ggpht.com/...\",\r\n                    \"kind\": \"sj#imageRef\",\r\n                    \"aspectRatio\": \"1\",\r\n                    \"autogen\": false\r\n                }\r\n            ],\r\n            \"description\": \"Relaxed songs for travel, dream or just to chill out.\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\n**Proof-of-Concept implementation**\r\n```python\r\n#protocol/mobileclient.py\r\nclass GetStations(McCall):\r\n    static_params = {'alt': 'json'}\r\n    static_method = 'GET'\r\n\r\n    @staticmethod\r\n    def dynamic_url(station_id, location_id):\r\n        return sj_url + 'browse/stations/' + station_id\r\n\r\n    @staticmethod\r\n    def dynamic_params(station_id, location_id):\r\n        return {'hl': location_id}\r\n\r\n#clients/mobileclient.py\r\n...\r\ndef get_stations(self, station_id, location_id):\r\n    res = self._make_call(mobileclient.GetStations, station_id, location_id)\r\n    return res['stations']\r\n...\r\n```"}}