diff --git a/.travis.yml b/.travis.yml index c00726b..33266d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ before_script: script: - "flake8 $(find . -iname '*.py')" - - "nosetests --with-coverage --cover-package=mopidy_vkontakte" - - "coverage run --source=mopidy_vkontakte setup.py test" + - "nosetests --with-coverage --cover-package=mopidy.vkontakte" + - "coverage run --source=mopidy setup.py test" after_success: - "coveralls" diff --git a/MANIFEST.in b/MANIFEST.in index 3c41bbe..9e807ff 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,6 +2,6 @@ include .travis.yml include LICENSE include MANIFEST.in include README.rst -include mopidy_vkontakte/ext.conf +include mopidy/vkontakte/default.conf recursive-include tests *.py diff --git a/README.rst b/README.rst index 9a336f4..1962814 100644 --- a/README.rst +++ b/README.rst @@ -60,36 +60,37 @@ Project resources Changelog ========= -v0.3.1 (UNRELEASED) -------------------- +v0.3.1 +------ - Fixed the encoding issue -v0.3.0 (UNRELEASED) -------------------- +v0.3.0 +------ - Fixed a problem if a client requires folders instead of playlists - Added search functionality but only if you want to find something in vkontakte but not in you library - Fixed some small issues -v0.2.0 (UNRELEASED) -------------------- +v0.2.0 +------ - Require Mopidy >= 0.18. - Fixed: ``ext.conf`` was missing from the PyPI package, stopping Mopidy from working as long as Mopidy-VKontakte is installed. -v0.1.2 (2013-11-27) -------------------- +v0.1.2 +------ -- FIXED: In some cases your token can be expired and you needed to remove a db file manually. +- Released @ 2013-11-27 +- Fixed: In some cases your token can be expired and you needed to remove a db file manually. -v0.1.1 (UNRELEASED) -------------------- +v0.1.1 +------ - Code style fixed. Setup a test cover system. -v0.1.0 (UNRELEASED) -------------------- +v0.1.0 +------ - Initial release. diff --git a/mopidy/__init__.py b/mopidy/__init__.py new file mode 100644 index 0000000..7c68785 --- /dev/null +++ b/mopidy/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- \ No newline at end of file diff --git a/mopidy_vkontakte/__init__.py b/mopidy/vkontakte/__init__.py similarity index 87% rename from mopidy_vkontakte/__init__.py rename to mopidy/vkontakte/__init__.py index 9b78906..4532ccd 100644 --- a/mopidy_vkontakte/__init__.py +++ b/mopidy/vkontakte/__init__.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from __future__ import unicode_literals import os @@ -18,7 +20,7 @@ class Extension(ext.Extension): version = __version__ def get_default_config(self): - conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf') + conf_file = os.path.join(os.path.dirname(__file__), 'default.conf') return config.read(conf_file) def get_config_schema(self): diff --git a/mopidy_vkontakte/actor.py b/mopidy/vkontakte/actor.py similarity index 96% rename from mopidy_vkontakte/actor.py rename to mopidy/vkontakte/actor.py index 5177113..5447b5d 100644 --- a/mopidy_vkontakte/actor.py +++ b/mopidy/vkontakte/actor.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from __future__ import unicode_literals import logging diff --git a/mopidy_vkontakte/ext.conf b/mopidy/vkontakte/default.conf similarity index 100% rename from mopidy_vkontakte/ext.conf rename to mopidy/vkontakte/default.conf diff --git a/mopidy/vkontakte/form_parser.py b/mopidy/vkontakte/form_parser.py new file mode 100644 index 0000000..ddfb378 --- /dev/null +++ b/mopidy/vkontakte/form_parser.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +from HTMLParser import HTMLParser + + +class FormParser(HTMLParser): + def __init__(self): + HTMLParser.__init__(self) + self.url = None + self.params = {} + self.in_form = False + self.form_parsed = False + self.method = 'GET' + + def handle_starttag(self, tag, attrs): + tag = tag.lower() + if tag == 'form': + if self.form_parsed: + raise RuntimeError('Second form on page') + if self.in_form: + raise RuntimeError('Already in form') + self.in_form = True + if not self.in_form: + return + attrs = dict((name.lower(), value) for name, value in attrs) + if tag == 'form': + self.url = attrs['action'] + if 'method' in attrs: + self.method = attrs['method'].upper() + elif tag == 'input' and 'type' in attrs and 'name' in attrs: + if attrs['type'] in ['hidden', 'text', 'password']: + self.params[attrs['name']] = attrs['value'] if 'value' \ + in attrs else '' + + def handle_endtag(self, tag): + tag = tag.lower() + if tag == 'form': + if not self.in_form: + raise RuntimeError('Unexpected end of