Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 25 additions and 1 deletion.
  1. +21 −0 addon.py
  2. +1 −1  addon.xml
  3. +3 −0  changelog.txt
View
21 addon.py
@@ -251,6 +251,26 @@ def __add_stations(stations, add_custom=False):
return plugin.finish(items, **finish_kwargs)
+def migrate_my_stations():
+ __log('migrate_my_stations')
+ if not plugin.get_setting('migrate') == 'done':
+ import os
+ import simplejson as json
+ profile_path = xbmc.translatePath(
+ plugin._addon.getAddonInfo('profile')
+ )
+ ms_file = os.path.join(profile_path, 'mystations.json')
+ if os.path.isfile(ms_file):
+ my_stations_old = json.load(open(ms_file, 'r'))
+ for old_station in my_stations_old:
+ station_id = old_station['station_id']
+ __log('migrating: %s' % station_id)
+ station = radio_api.get_station_by_station_id(station_id)
+ my_stations[station_id] = station
+ my_stations.sync()
+ plugin.set_setting('migrate', 'done')
+
+
def __get_language():
if not plugin.get_setting('not_first_run'):
xbmc_language = xbmc.getLanguage().lower()
@@ -283,6 +303,7 @@ def _(string_id):
if __name__ == '__main__':
radio_api.set_language(__get_language())
radio_api.log = __log
+ migrate_my_stations()
try:
plugin.run()
except RadioApiError:
View
2  addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.audio.radio_de" name="Radio" version="2.0.0" provider-name="Tristan Fischer (sphere@dersphere.de)">
+<addon id="plugin.audio.radio_de" name="Radio" version="2.0.1" provider-name="Tristan Fischer (sphere@dersphere.de)">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.xbmcswift2" version="1.2.0" />
View
3  changelog.txt
@@ -1,3 +1,6 @@
+2.0.1
+ - added migration code to convert old my_stations to new system
+
2.0.0 (unreleased)
- Code Rewrite
- Possibility to add custom (user defined) Stations

No commit comments for this range

Something went wrong with that request. Please try again.