kingosticks / mopidy-tunein

Mopidy extension for playing music from tunein
Apache License 2.0
65 stars 14 forks source link

Allow user to specify their location for local radio #4

Open kingosticks opened 10 years ago

kingosticks commented 10 years ago

Add a config setting to specify the location to use for "local" radio. TuneIn supports a latlon parameter containing a comma separated latitude-longitude pair i.e. http://opml.radiotime.com/Browse.ashx?c=local&latlon=37,118.

kingosticks commented 10 years ago

The config parameter could take a location name and we can look up the latitude/longitude using https://developers.google.com/maps/documentation/geocoding/?csw=1#GeocodingRequests. i.e. http://maps.googleapis.com/maps/api/geocode/json?address=London,uk&sensor=false gives

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "London",
               "short_name" : "London",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "United Kingdom",
               "short_name" : "GB",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "London, UK",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 51.6723432,
                  "lng" : 0.148271
               },
               "southwest" : {
                  "lat" : 51.38494009999999,
                  "lng" : -0.3514683
               }
            },
            "location" : {
               "lat" : 51.508515,
               "lng" : -0.1254872
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 51.6723432,
                  "lng" : 0.148271
               },
               "southwest" : {
                  "lat" : 51.38494009999999,
                  "lng" : -0.3514683
               }
            }
         },
         "types" : [ "locality", "political" ]
      }
   ],
   "status" : "OK"
}
yonailo commented 8 years ago

I am running the latest version of the plugin, but my local radio entry is empty, do you know why ? how can I fix it ?

djmattyg007 commented 3 years ago

It's worth noting that Google's geolocation APIs should now essentially be considered non-free. Any non-trivial usage is likely to get heavily rate limited. It would likely be significantly easier to just accept latitude and longitude, and link to a guide for how the user can obtain those values themselves.