Coder Social home page Coder Social logo

Comments (17)

martijnboland avatar martijnboland commented on June 19, 2024

@jodal I'm running into an error with Mopidy 0.19 from the github develop branch when trying to add tracks to a playlist or retrieving the current tracklist:

DEBUG 2014-06-24 12:17:53,779 [68156:Thread-10] mopidy.http.handlers
Received WebSocket message from 127.0.0.1: u'{"method":"core.tracklist.get_tl_tracks","jsonrpc":"2.0","id":52}'
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/init.py", line 851, in emit
msg = self.format(record)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/init.py", line 724, in format
return fmt.format(record)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/init.py", line 464, in format
record.message = record.getMessage()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/init.py", line 328, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Logged from file handlers.py, line 106

I followed the instructions for running Mopidy from GitHub. Do I also need to do something with with the extensions?

from moped.

jodal avatar jodal commented on June 19, 2024

Should be fixed by mopidy/mopidy@dba6e9b. Thanks!

from moped.

martijnboland avatar martijnboland commented on June 19, 2024

Fixed, excellent! Now I could see what went wrong: Angular adds an $$hashkey property to the js objects that isn't recognized when (de)serialized and sent to mopidy. Added a very dirty hack to mopidy.js that does the trick (by skipping serialization of $$hashkey properties), but I'm going to find a different solution that doesn't require patching mopidy.js.

from moped.

jodal avatar jodal commented on June 19, 2024

Looking at the comment at http://stackoverflow.com/a/23656919/828646, I guess you can't easily do angular.toJson() as the JSON serialization happens inside Mopidy.js. However, you can maybe use ng-repeat="track in tracks by track.uri"? If you tell Angular.js about an unique field in the data, it won't add the $$hashkey property.

from moped.

martijnboland avatar martijnboland commented on June 19, 2024

Looks like a neat solution. Let's give it a try.

from moped.

jodal avatar jodal commented on June 19, 2024

Just remember that the track.uri isn't unique in the tracklist, since you can have multiple instances of the same track in the tracklist. tl_track.tlid is unique within the tracklist, though.

from moped.

martijnboland avatar martijnboland commented on June 19, 2024

Can searches and lookups result in duplicate tracks? This is what we bind with ng-repeat, not tl_tracks. So far, everything works fine with the 'track by track.uri' solution.

from moped.

jodal avatar jodal commented on June 19, 2024

As far as I can remember, there's nothing in core stopping you from having duplicate tracks in searches/lookups, but I don't see a use case for it, so if there you see any duplicates anywhere than should probably be reported as a bug against that backend.

from moped.

martijnboland avatar martijnboland commented on June 19, 2024

Created a branch mopidy-0.19 and it should now be possible to install moped from here:

sudo pip install -e git+https://github.com/martijnboland/[email protected]#egg=Mopidy-Moped

from moped.

jodal avatar jodal commented on June 19, 2024

This works great! It is so nice to be able to have the Mopidy client list, Lux, the API explorer and Moped running side by side. This only becomes better and better with every client joining in :-)

I sent a PR (#6) with some small fixes. Each commit is hopefully self-explanatory.

Some other barely related notes:

  • An open issue is what to do with README.rst vs README.md. Python packages just understand plain text or rst, so maybe just merge whatever is relevant from README.md into README.rst? You should be able to include the image in the README using http://docutils.sourceforge.net/docs/ref/rst/directives.html#image
  • In the future, remember that with the setup.py, you can now increase the required Mopidy version when you start using new features in the future. Lets use the dependency management tools we have to their full extent :-)
  • If you set $locationProvider.html5Mode(true) in Angular you get prettier URLs without the /#/ on all browsers that support the History API.
  • Since the Durandal version is deprecated, maybe just branch of a Durandal branch for the history books and remove all remnants of it from the master branch?

from moped.

jodal avatar jodal commented on June 19, 2024

Found a bug: Playlists can have duplicate tracks, so by track.uri doesn't work:

Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: track in playlist.tracks track by track.uri, Duplicate key: spotify:track:5fxWongjIPVkFkIBzK10pH
http://errors.angularjs.org/1.2.18/ngRepeat/dupes?p0=track%20in%20playlist.tracks%20track%20by%20track.uri&p1=spotify%3Atrack%3A5fxWongjIPVkFkIBzK10pH
    at http://localhost:6680/moped/assets/moped-0.3.0.js:12:20112
    at http://localhost:6680/moped/assets/moped-0.3.0.js:15:26570
    at Object.d [as fn] (http://localhost:6680/moped/assets/moped-0.3.0.js:14:10734)
    at k.$digest (http://localhost:6680/moped/assets/moped-0.3.0.js:14:11413)
    at http://localhost:6680/moped/assets/moped-0.3.0.js:14:12729
    at g (http://localhost:6680/moped/assets/moped-0.3.0.js:13:5307)
    at http://localhost:6680/moped/assets/moped-0.3.0.js:13:7030

from moped.

martijnboland avatar martijnboland commented on June 19, 2024

Then I'll think of something else to prevent sending $$hashkey properties.

In the near future I will create a Durandal-vs-Angular branch for historic purposes and reorganize the rest, so there's only one Moped client left.

from moped.

jodal avatar jodal commented on June 19, 2024

Mopidy 0.19 was released yesterday. Would be great to have the mopidy-0.19 branch of Moped merged and get a release up on PyPI.

from moped.

martijnboland avatar martijnboland commented on June 19, 2024

Done. The Mopidy-Moped package can be found at: https://pypi.python.org/pypi/Mopidy-Moped/0.3.0. Can someone give it a try and see if it works? Can't test it on the Raspberry PI because there seems to be an issue with 0.19 and Tornado 3.1.

from moped.

jodal avatar jodal commented on June 19, 2024

It's working for me :-)

from moped.

jodal avatar jodal commented on June 19, 2024

There's some warnings during the installation which is caused by old entries in the MANIFEST.in file. You should probably have a go at running the check-manifest (pip install check-manifest) command and tweak the MANIFEST.in so that the files you want are included and you don't have any exclude rules that doesn't match any files in the repo.

I started updating MANIFEST.in locally, but figured you have to decide what to include in the pip package yourself. The following diff will fix the warnings, but there are still some files not explicitly included or excluded by it:

diff --git a/MANIFEST.in b/MANIFEST.in
index 1560c49..9b130c8 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,4 @@
+include CHANGELOG.md
 include LICENSE
 include MANIFEST.in
 include README.rst
@@ -5,10 +6,8 @@ include README.rst
 recursive-include mopidy_moped ext.conf
 recursive-include mopidy_moped/static *

-exclude README.md
-
-recursive-exclude angular *
 recursive-exclude dist *
-recursive-exclude durandal *
-recursive-exclude html *
+recursive-exclude karma *
 recursive-exclude screenshots *
+recursive-exclude src *
+recursive-exclude vendor *

from moped.

martijnboland avatar martijnboland commented on June 19, 2024

The manifest wasn't updated unfortunately after the source reorganization. As far as I can see everything is either included or excluded now. A new version 0.3.1 is on PyPI.

from moped.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.