[RELEASE] Subsonic

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
mason Offline
Senior Member
Posts: 267
Joined: Sep 2008
Reputation: 0
Location: Germany
Post: #131
@t0mm0

here's my debug log.

I'm running on

Platform: Windows 7, 64-bit (WoW) Service Pack 1 build 7601. Built on Nov 5 2011 (Git:20111025-8970aa9, compiler 1600)
Intel® Core™ i7 CPU 860 @ 2.80GHz
Desktop Resolution: 1920x1200 32Bit at 60Hz

Subsonic is 4.5 (build 2384) – 10. August 2011

http://pastebin.com/HhtYa8xP

hope this helps, if you need some more details just let me know.

thanks for your help!
(This post was last modified: 2011-11-20 11:47 by mason.)
find quote
t0mm0 Offline
Fan
Posts: 521
Joined: Mar 2011
Reputation: 8
Location: UK
Post: #132
mason Wrote:@t0mm0

here's my debug log.

I'm running on

Platform: Windows 7, 64-bit (WoW) Service Pack 1 build 7601. Built on Nov 5 2011 (Git:20111025-8970aa9, compiler 1600)
Intel® Core™ i7 CPU 860 @ 2.80GHz
Desktop Resolution: 1920x1200 32Bit at 60Hz

Subsonic is 4.5 (build 2384) – 10. August 2011


hope this helps, if you need some more details just let me know.

thanks for your help!

looks like either a network error or you typed in incorrect host/port/user/pass.

try loading the url in the log after 'Subsonic: getting' in a browser on the xbmc machine and see what happens.

(please use pastebin.com or equivalent to post logs in future it makes it much easier to read, keeps thje forum tidy and i can point you to line numbers if needed)

thanks,

t0mm0
find quote
mason Offline
Senior Member
Posts: 267
Joined: Sep 2008
Reputation: 0
Location: Germany
Post: #133
EDIT SOLVED: I rebuilded the Subsonic Server and everything seems to work now Big Grin Sorry for bothering you!

it looks like I forgot to specify the port, but even then I get the following:

Code:
10:38:31 T:7484   DEBUG: Subsonic: getting http://host.com:8091/rest/ping.view?p=pass&c=xbmc&v=1.4.0&u=user&f=json
10:38:31 T:7484   ERROR: Subsonic: Error reading response from server.

I checkd the functions and api, and it looks like the API part of Subsonic is foobared :/
(This post was last modified: 2011-11-20 12:26 by mason.)
find quote
t0mm0 Offline
Fan
Posts: 521
Joined: Mar 2011
Reputation: 8
Location: UK
Post: #134
mason Wrote:EDIT SOLVED: I rebuilded the Subsonic Server and everything seems to work now Big Grin Sorry for bothering you!

it looks like I forgot to specify the port, but even then I get the following:

Code:
10:38:31 T:7484   DEBUG: Subsonic: getting http://host.com:8091/rest/ping.view?p=pass&c=xbmc&v=1.4.0&u=user&f=json
10:38:31 T:7484   ERROR: Subsonic: Error reading response from server.

I checkd the functions and api, and it looks like the API part of Subsonic is foobared :/

no problem! glad you got it sorted Wink
find quote
Qwyrp Offline
Junior Member
Posts: 11
Joined: Sep 2006
Reputation: 0
Post: #135
I'm using your subsonic-plugin and it runs well inside XBMC but I want to control it with another pc in my house. Is there a (subsonic)interface I can load and if so how exactly?
find quote
dybuk Offline
Junior Member
Posts: 6
Joined: Jun 2011
Reputation: 0
Post: #136
Okay so I realise about 6 months have passed since I said I'd try to some stuff with it. Had little time and motivation until today.

My plan for this plugin was mainly video usage. 6 months ago my problems with the add-on where the following :

a) Bit rate settings too low.
b) I proxy via mod_proxy under ssl and use basic authentication for my external subsonic. Yeah I know I'm paranoid.
c) When playing files in the plugin it would start multiple ffmpegs on the server and start multiple streams to xbmc.

============

I fixed a) one the following simple change :

Settings.xml

Code:
<setting id="bitrate" type="enum" label="30105" default="13" values="32k|40k|48k|56k|64k|80k|96k|112k|128k|160k|192k|224k|256k|320k" enable="eq(-1,true)" />

to

Code:
<setting id="bitrate" type="enum" label="30105" default="13" values="32k|40k|48k|56k|64k|80k|96k|112k|128k|160k|192k|224k|256k|320k|512K|720K|1024K|1​500K|2048K" enable="eq(-1,true)" />

and

Subsonic.py

Code:
bitrates = [32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320]

Code:
bitrates = [32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 512, 720, 1024, 1500, 2048]

Nice and simple.

======

I fixed b) with the following function changes. https was working fine it was the basic auth that was causing the problem. I don't think this would cause an issue if basic auth was switched off but saying that I didn't test it.

Subsonic.py

Code:
def play(self, song_id):
        Addon.log('play: ' + song_id)
        if Addon.get_setting('transcode') == 'true':
            bitrate = self.bitrates[int(Addon.get_setting('bitrate'))]
            
            non_user_url = self.build_rest_url('stream.view',
                {'id': song_id,
                'maxBitRate': bitrate});
            
            user_url = non_user_url.replace("://", "://" +self.user + ":" + self.password + "@",1)
            
            Addon.resolve_url(user_url)
        else:
            Addon.resolve_url(self.build_rest_url('download.view',
                                                  {'id': song_id}))

....

  def __get_json(self, method, queries={}):
        json_response = None
        url = self.build_rest_url(method, queries)
        Addon.log('getting ' + url)
        try:
            password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
            password_mgr.add_password(None, self.server, self.user, self.password)
            handler = urllib2.HTTPBasicAuthHandler(password_mgr)
            opener = urllib2.build_opener(handler)
            urllib2.install_opener(opener)
            
            response = urllib2.urlopen(url)
            try:
                json_response = json.loads(response.read())
            except ValueError:
                Addon.show_error([Addon.get_string(30002)])
                return False
        except urllib2.URLError, e:
            Addon.show_error([Addon.get_string(30001), str(e.reason)])
            return False

        payload = json_response.get('subsonic-response', None)
        if payload.get('status', 'failed') == 'ok':              
            return payload
        else:
            Addon.show_error([payload['error']['message'],
                       'json version: ' + payload['version']])  
            return False


======

c) was somewhat tricker. Have no clue about xbmc or python addons I just assumed it was some problem with the plugin. However after digging these seems to be a problem with the way Xbmc Interacts with Subsonic.

It looks as though instead of just getting the stream from subsonic with a GET request it will do one or more HEAD request first. I can only guess this is so that it can select the right player.

Subsonic doesn't differentiate between the HEAD and GET and sends the full body instead of just the http header. So hence the multiple streams.

Here is a change I made to subsonic to get around this issue :

StreamController.java

Code:
....
                String transcodedSuffix = transcodingService.getSuffix(player, file, preferredTargetFormat);
                response.setContentType(StringUtil.getMimeType(transcodedSuffix));

                if (file.isVideo()) {
                    videoTranscodingSettings = createVideoTranscodingSettings(file, request);
                }
....

to

Code:
String transcodedSuffix = transcodingService.getSuffix(player, file, preferredTargetFormat);
                response.setContentType(StringUtil.getMimeType(transcodedSuffix));

                if (request.getMethod().equals("HEAD"))
                {
                    return null;
                }
                
                if (file.isVideo()) {
                    videoTranscodingSettings = createVideoTranscodingSettings(file, request);
                }

I just compiled the project and replaced this class file with a tomcat restart.

I suspect this may also have caused symptoms like having to manually select the DVD Player which just worked after this change.


========

I tried this with xbmc running on an original xbox and on xbmc running on an atv2. Both worked really well after these changes.


Disclaimer : I'm not a python/java developer so these mods may not be the best way to handle these problems and may be a bit "hacky".

Dybuk
find quote
nutt318 Offline
Junior Member
Posts: 30
Joined: Jan 2012
Reputation: 0
Post: #137
dybuk,

Are these settings modified on my pc with xbmc and the plugin or on my server with subsonic installed?
find quote
dybuk Offline
Junior Member
Posts: 6
Joined: Jun 2011
Reputation: 0
Post: #138
nutt318 Wrote:dybuk,

Are these settings modified on my pc with xbmc and the plugin or on my server with subsonic installed?

for a) and b) they are a modification of the plugin zip file. Or they can just be modified in the revenant xbmc directory.

for c) you need to modify subsonic and recompile it. Something like :

- Install subversion and maven.
- svn co https://subsonic.svn.sourceforge.net/svn...elease-4.6
- Modify the streamController.java as described above.
- mvn compile
- find streamController.class in your newly compiled version and copy that over the top of streamContoller.class on your server.
- Restart subsonic.

I sent an email to the subsonic developer and he said he'd look to include a fix for this in 4.7

Dybuk.
find quote
nojokes Offline
Junior Member
Posts: 10
Joined: Jan 2012
Reputation: 0
Post: #139
First of all. Thanks for the great addon. It's brilliant.

I'm not sure that I am posting this in the right forum, but I think so.

I have the latest version of the addon running with the latest Eden beta on an ATV 2. The music is organized on the server like this:

library name/artist/album title/song title

I can display the library names as a list (the way I want it).
I can display the artists as a list (the way I want it).
I cannot display the album titles as thumbnails unless I go into each folder and specifically set it. Is there a way that I can set this for all albums? Having to set this manually for 1,000s of albums wouldn't be any fun at all.

Thanks in advance.
A
find quote
hogfan Offline
Fan
Posts: 380
Joined: Nov 2009
Reputation: 0
Post: #140
I've had Subsonic for awhile and ran across this when I was thinking of making a plugin myself. Nice to see it is already out there and works with Eden. However, I don't see the plugin on the subsonic pages. Where can I download this?

-hogfan

[Image: watched-fanart.jpg]
find quote
Post Reply