The branch, eden has been updated
via fa9bf05a85921ad4c63098706cea149790fda544 (commit)
via 00e2e8656f4154f4c5cd1ab18346782626ac37b6 (commit)
from 39ac2017742392e6ebdeaed04b92e023f1eaaac3 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=fa9bf05a85921ad4c63098706cea149790fda544
commit fa9bf05a85921ad4c63098706cea149790fda544
Author: spiff <[email protected]>
Date: Sat Jul 14 08:52:07 2012 +0200
[plugin.video.thisweekin] initial version (1.1.2). thanks to lextoumbourou
diff --git a/.gitignore b/.gitignore
index b8f6fdb..20f7192 100644
--- a/.gitignore
+++ b/.gitignore
@@ -95,3 +95,4 @@ plugin.video.hwclips/.git
plugin.video.eevblog/.project
plugin.video.eevblog/.pydevproject
plugin.video.eevblog/.git
+plugin.video.thisweekin/.gitignore
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=00e2e8656f4154f4c5cd1ab18346782626ac37b6
commit 00e2e8656f4154f4c5cd1ab18346782626ac37b6
Author: spiff <[email protected]>
Date: Sat Jul 14 08:49:55 2012 +0200
[plugin.audio.radio_de] updated to version 1.1.0
diff --git a/plugin.audio.radio_de/addon.py b/plugin.audio.radio_de/addon.py
index ad7501e..9cece8d 100644
--- a/plugin.audio.radio_de/addon.py
+++ b/plugin.audio.radio_de/addon.py
@@ -1,3 +1,6 @@
+import os
+import simplejson as json
+
from xbmcswift import Plugin, xbmc, xbmcplugin, xbmcgui, clean_dict
import resources.lib.scraper as scraper
@@ -115,7 +118,7 @@ def show_top_stations():
return plugin.add_items(items)
[email protected]('/stations_by_category/<category_type>')
[email protected]('/stations_by_category/<category_type>/')
def show_station_categories(category_type):
__log('show_station_categories started with category_type=%s'
% category_type)
@@ -167,14 +170,8 @@ def search():
@plugin.route('/my_stations/')
def show_mystations():
__log('show_mystations start')
- my_station_ids = __get_my_stations()
- language = __get_language()
- stations = []
- for station_id in my_station_ids:
- station = scraper.get_station_by_station_id(language, station_id)
- if station:
- stations.append(station)
- items = __format_stations(stations)
+ my_stations = __get_my_stations()
+ items = __format_stations([s['data'] for s in my_stations])
__log('show_mystations end')
return plugin.add_items(items)
@@ -183,24 +180,23 @@ def show_mystations():
def add_station_mystations(station_id):
__log('add_station_mystations started with station_id=%s' % station_id)
my_stations = __get_my_stations()
- if not station_id in my_stations:
- my_stations.append(station_id)
- my_stations_string = ','.join(my_stations)
- plugin.set_setting('my_stations', my_stations_string)
- __log('add_station_mystations ended with %d items: %s' % (len(my_stations),
- my_stations))
+ if not station_id in [s['station_id'] for s in my_stations]:
+ language = __get_language()
+ station = scraper.get_station_by_station_id(language, station_id)
+ my_stations.append({'station_id': station_id,
+ 'data': station})
+ __set_my_stations(my_stations)
+ __log('add_station_mystations ended with %d items' % len(my_stations))
@plugin.route('/my_stations/del/<station_id>/')
def del_station_mystations(station_id):
__log('del_station_mystations started with station_id=%s' % station_id)
my_stations = __get_my_stations()
- if station_id in my_stations:
- my_stations.remove(station_id)
- my_stations_string = ','.join(my_stations)
- plugin.set_setting('my_stations', my_stations_string)
- __log('del_station_mystations ended with %d items: %s' % (len(my_stations),
- my_stations))
+ if station_id in [s['station_id'] for s in my_stations]:
+ my_stations = [s for s in my_stations if s['station_id'] != station_id]
+ __set_my_stations(my_stations)
+ __log('del_station_mystations ended with %d items' % len(my_stations))
@plugin.route('/station/<id>/')
@@ -216,7 +212,8 @@ def get_stream(id):
def __format_stations(stations):
__log('__format_stations start')
items = []
- my_station_ids = __get_my_stations()
+ my_stations = __get_my_stations()
+ my_station_ids = [s['station_id'] for s in my_stations]
for station in stations:
if station['picture1Name']:
thumbnail = station['pictureBaseURL'] + station['picture1Name']
@@ -254,25 +251,35 @@ def __format_stations(stations):
def __get_my_stations():
__log('__get_my_stations start')
+ __migrate_my_stations()
my_stations = []
- my_stations_string = plugin.get_setting('my_stations')
- if my_stations_string:
- my_stations = my_stations_string.split(',')
- __log('__get_my_stations ended with %d items: %s' % (len(my_stations),
- my_stations))
+ profile_path = xbmc.translatePath(plugin._plugin.getAddonInfo('profile'))
+ ms_file = os.path.join(profile_path, 'mystations.json')
+ if os.path.isfile(ms_file):
+ my_stations = json.load(open(ms_file, 'r'))
+ __log('__get_my_stations ended with %d items' % len(my_stations))
return my_stations
+def __set_my_stations(stations):
+ __log('__set_my_stations start')
+ profile_path = xbmc.translatePath(plugin._plugin.getAddonInfo('profile'))
+ if not os.path.isdir(profile_path):
+ os.makedirs(profile_path)
+ ms_file = os.path.join(profile_path, 'mystations.json')
+ json.dump(stations, open(ms_file, 'w'), indent=1)
+
+
def __get_language():
if not plugin.get_setting('not_first_run'):
- xbmc_language = xbmc.getLanguage()
+ xbmc_language = xbmc.getLanguage().lower()
__log('__get_language has first run with xbmc_language=%s'
% xbmc_language)
- if xbmc_language == 'English':
+ if xbmc_language.startswith('english'):
plugin.set_setting('language', '0')
- elif xbmc_language == 'German':
+ elif xbmc_language.startswith('german'):
plugin.set_setting('language', '1')
- elif xbmc_language == 'French':
+ elif xbmc_language.startswith('french'):
plugin.set_setting('language', '2')
else:
plugin.open_settings()
@@ -281,8 +288,26 @@ def __get_language():
return ('english', 'german', 'french')[int(lang_id)]
+def __migrate_my_stations():
+ if not plugin.get_setting('my_stations'):
+ __log('__migrate_my_stations nothing to migrate')
+ return
+ my_stations = plugin.get_setting('my_stations').split(',')
+ __log('__migrate_my_stations start migration mystations: %s' % my_stations)
+ language = __get_language()
+ stations = []
+ for station_id in my_stations:
+ station = scraper.get_station_by_station_id(language, station_id)
+ if station:
+ stations.append({'station_id': station_id,
+ 'data': station})
+ __set_my_stations(stations)
+ plugin.set_setting('my_stations', '')
+ __log('__migrate_my_stations migration done')
+
+
def __log(text):
xbmc.log('%s addon: %s' % (__addon_name__, text))
if __name__ == '__main__':
- plugin.run()
\ No newline at end of file
+ plugin.run()
diff --git a/plugin.audio.radio_de/addon.xml b/plugin.audio.radio_de/addon.xml
index bfca5cb..57170ec 100644
--- a/plugin.audio.radio_de/addon.xml
+++ b/plugin.audio.radio_de/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.audio.radio_de" name="Radio" version="1.0.6"
provider-name="Tristan Fischer ([email protected])">
+<addon id="plugin.audio.radio_de" name="Radio" version="1.1.0"
provider-name="Tristan Fischer ([email protected])">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.xbmcswift" version="0.2.0"/>
@@ -9,6 +9,7 @@
<provides>audio</provides>
</extension>
<extension point="xbmc.addon.metadata">
+ <language></language>
<platform>all</platform>
<summary lang="en">Access >4000 radio broadcasts</summary>
<summary lang="de">Zugriff auf >4000 Radiosender</summary>
diff --git a/plugin.audio.radio_de/changelog.txt
b/plugin.audio.radio_de/changelog.txt
index c760588..5980f7b 100644
--- a/plugin.audio.radio_de/changelog.txt
+++ b/plugin.audio.radio_de/changelog.txt
@@ -1,3 +1,11 @@
+1.1.0 (unreleased)
+ - New My Station logic (listing should be much faster after initial
migration)
+ - Small fixes
+
+1.0.7 (unreleased)
+ - Fixed: error in language_guessing
+ - Fixed: routes (fix xbmcswift-xbox usecase)
+
1.0.6 (05.03.2012)
- Fixed: error if a station was added to the list of mystations but has
become unavailable
- Improved error catching
diff --git a/plugin.audio.radio_de/resources/lib/scraper.py
b/plugin.audio.radio_de/resources/lib/scraper.py
index 9074688..f8178dd 100644
--- a/plugin.audio.radio_de/resources/lib/scraper.py
+++ b/plugin.audio.radio_de/resources/lib/scraper.py
@@ -136,6 +136,9 @@ def __get_json(path, gets, language):
def __resolve_playlist(playlist_url):
__log('__resolve_playlist started with playlist_url=%s' % playlist_url)
response = __urlopen(playlist_url)
+ if not response:
+ __log('__resolve_playlist failed')
+ return playlist_url
stream_url = None
if playlist_url.endswith('m3u'):
__log('__resolve_playlist found .m3u file')
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
plugin.audio.radio_de/addon.py | 89 +++++++++++++-------
plugin.audio.radio_de/addon.xml | 3 +-
plugin.audio.radio_de/changelog.txt | 8 ++
plugin.audio.radio_de/resources/lib/scraper.py | 3 +
plugin.video.thisweekin/LICENSE.txt | 7 ++
plugin.video.thisweekin/README.markdown | 13 +++
plugin.video.thisweekin/addon.xml | 17 ++++
plugin.video.thisweekin/default.py | 56 ++++++++++++
plugin.video.thisweekin/fanart.jpg | Bin 0 -> 43090 bytes
plugin.video.thisweekin/icon.png | Bin 0 -> 24115 bytes
.../resources/__init__.py | 0
.../resources/lib}/__init__.py | 0
plugin.video.thisweekin/resources/lib/scraper.py | 78 +++++++++++++++++
plugin.video.thisweekin/resources/lib/utils.py | 80 ++++++++++++++++++
15 files changed, 322 insertions(+), 33 deletions(-)
create mode 100644 plugin.video.thisweekin/LICENSE.txt
create mode 100755 plugin.video.thisweekin/README.markdown
create mode 100755 plugin.video.thisweekin/addon.xml
create mode 100755 plugin.video.thisweekin/default.py
create mode 100644 plugin.video.thisweekin/fanart.jpg
create mode 100644 plugin.video.thisweekin/icon.png
copy {plugin.audio.radio_de => plugin.video.thisweekin}/resources/__init__.py
(100%)
mode change 100644 => 100755
copy {plugin.audio.radio_de/resources =>
plugin.video.thisweekin/resources/lib}/__init__.py (100%)
mode change 100644 => 100755
create mode 100755 plugin.video.thisweekin/resources/lib/scraper.py
create mode 100755 plugin.video.thisweekin/resources/lib/utils.py
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons